Jenkins SMTP TLS - jenkins

I'm trying to setup Jenkins to use our company's SMTP server to email build notifications. We are using TLS as the encryption method on port 587. I can not seem to get the email notification to work properly though.
Here is my Hudson.Tasks.Mailer.xml file so you can see my config (I've removed the SMTP auth user and password and changed the smtpHost slightly just in case)
<hudson.tasks.Mailer_-DescriptorImpl>
<helpRedirect/>
<defaultSuffix></defaultSuffix>
<hudsonUrl>http://localhost:8080/</hudsonUrl>
<smtpAuthUsername></smtpAuthUsername>
<smtpAuthPassword></smtpAuthPassw$
<adminAddress></adminAddress>
<smtpHost>pod#####.outlook.com</smtpHost>
<useSsl>true</useSsl>
<smtpPort>587</smtpPort>
<charset>UTF-8</charset>
</hudson.tasks.Mailer_-DescriptorImpl>
It looks like this is a known issue, from http://issues.hudson-ci.org/browse/HUDSON-2206
I am not very familiar with Apple OS (which is the machine that is running Jenkins) but I thought I could resolve the issue using the workaround mentioned. I wasn't exactly sure where to put that workaround though, so I tried putting it here:
/Library/Application Support/Jenkins/jenkins-runner.sh
defaults="defaults read /Library/Preferences/org.jenkins-ci"
war=`$defaults war` || war="/Applications/Jenkins/jenkins.war"
javaArgs="-Dmail.smtp.starttls.enable=\"true\""
heapSize=`$defaults heapSize` && javaArgs="$javaArgs -Xmx${heapSize}"
permGen=`$defaults permGen` && javaArgs="$javaArgs -XX:MaxPermSize=${permGen}"
home=`$defaults JENKINS_HOME` && export JENKINS_HOME="$home"
add_to_args() {
val=`$defaults $1` && args="$args --${1}=${val}"
}
args=""
add_to_args prefix
add_to_args httpPort
add_to_args httpListenAddress
add_to_args httpsPort
add_to_args httpsListenAddress
add_to_args ajp13Port
add_to_args ajp13ListenAddress
echo "JENKINS_HOME=$JENKINS_HOME"
echo "Jenkins command line for execution"
echo /usr/bin/java $javaArgs -jar "$war" $args
exec /usr/bin/java $javaArgs -jar "$war" $args
That didn't appear to resolve it. I can see that call in the console when Jenkins is started up, but when I try a test configuration email I get the following error:
Failed to send out e-mail
javax.mail.MessagingException: Could not connect to SMTP host: pod#####.outlook.com, port: 587;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
Any ideas on what else I can try? I've tried switching the email account to use gmail's smtp server and that works fine, but I'd rather have it using our smtp server if I can.

Changing the SMTP port from 587 to 465 resolved this issue for me:
SMTP server: smtp.mandrill.com
Use SMTP Authentication: true
Use SSL: true
SMTP Port: 465
From what I can tell (disclaimer: I am by no means a Hudson/Jenkins expert)
the Hudson/Jenkins email plugin supports SSL encrypted SMTP communication - however this implementation requires that communications are encrypted from the get go.
When connecting on port 587, the server on the other end may expect a STARTTLS command (see this SSL vs TLS vs STARTTLS article). This command is sent using plain-text to 'upgrade' the connection to use SSL/TLS.
Hudson/Jenkins instead attempts to start negotiating SSL on port 587, which is promptly rejected, resulting in the following error:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
I tried adding the suggested JAVA options "-Dmail.smtp.starttls.enable=true" to enable TLS:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"
Unfortunately this didn't resolve the issue for me.
After changing the port to 465, the SSL negotiation occurred correctly and the communication succeeded.
Hope that helps.
Note: Jenkins email plugin always needs SMTP credentials that are often sender's email credentials when you checkmark "Use SMTP Authentication" option for any "SSL - port 465" or "non SSL - port 587" configuration.

I had the same issue with Jenkins but mine is installed on Centos rather than Apple OS. I still thought to post the solution here because A) you might be able to make the needed adjustments to the solution and B) Linux & Jenkins users might benefit from this.
Anyhow, find the Jenkins configuration file (in CENTOS its in /etc/sysconfig/jenkins)
In it locate the JENKINS_JAVA_OPTIONS variable and add the following option "-Dmail.smtp.starttls.enable=true"
In my case this is what I had before:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
And this is after;
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"
restart Jenkins server (in Linux)
/etc/init.d/jenkins restart

For Jenkins on Windows
Open jenkins.xml and modify the arguments node
-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dmail.smtp.starttls.enable=true -jar "%BASE%\jenkins.war" --httpPort=8080
For smtp.live.com:
Set the SMTP port to 587 and uncheck Use SSL

Even after setting -Dmail.smtp.starttls.enable=true as mentioned in #nsof's answers in the file /etc/default/jenkins (debian/ubuntu), it did not work for me.
The trick was to set the SMTP port to 587 and uncheck Use SSL as show below, then the email was sent successfully.

Try out the workaround mentioned in the bug itself:
http://issues.hudson-ci.org/browse/HUDSON-2206
In Java:
props.put("mail.smtp.starttls.enable","true");
In Tomcat:
Add JAVA_OPTS=-Dmail.smtp.starttls.enable="true" to tomcat config file.

Adding -Dmail.smtp.starttls.enable=true as arguments of JAVA_OPTS solved my problem
If your jenkins is running in stand alone mode update JAVA_OPTS in /etc/sysconfig/jenkins
If your jenkins is running in tomcat update JAVA_OPTS
catalina.sh for unix
catalina.bat for windows

For Jenkins on Ubuntu 16.04:
1 - Edit the config file:
sudo nano /etc/default/jenkins
2 - Comment out existing JAVA_ARGS, add new one shown below:
#JAVA_ARGS="-Djava.awt.headless=true"
JAVA_ARGS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"
3 - Restart Jenkins
sudo service jenkins restart

For Jenkins on Red Hat Enterprise Linux Server release 7.4 (Maipo)
edit /etc/sysconfig/jenkins to add
The Jenkins service configuration file requires root access to the machine.
In CloudBees Jenkins Enterprise, you can find this file under:
/etc/default/jenkins: location for most of the Linux distributions.
/etc/sysconfig/jenkins: location for RedHat/CentOS distribution.
C:\Program Files\Jenkins\jenkins.xml: default location for Windows

With Jenkins 2.134 the following worked for me:
JAVA_TOOL_OPTIONS=-Dmail.smtp.starttls.enable=true
Uncheck Use SSL!

This is the best possible solution in case none of the above solutions work.
https://issues.jenkins-ci.org/browse/JENKINS-47939

Following a statement in #user11791348 's answer resolved the issue for me.
The statement was: "It is IMPORTANT to note that BOTH the "E-mail Notification" section User Name AND the "Jenkins Location" section System Admin e-mail address must be valid smtp.office365.com users. If either one is not found in smtp.office365.com, you will get a "Client does not have permissions to send as this sender" error"
So, I configured System Admin e-mail address in Jenkins, Also my Jenkins.xml contains the line:
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Djava.awt.headless=true -Dmail.smtp.starttls.enable=true -jar "C:\Program Files\Jenkins\jenkins.war" --httpPort=8080 --webroot="%LocalAppData%\Jenkins\war"</arguments>
Use SSL: Unchecked
Use TLS: Unchecked
SMTP Port: 587

If Jenkins is configured as a systemd service, it seems that the $JAVA_OPTS are not picked up from /etc/default/jenkins, but rather from the systemd unit file itself.
On Debian, I edited /lib/systemd/system/jenkins.service and modified the JAVA_OPTS environment variable to the following:
Environment="JAVA_OPTS=-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"
Then flush systemd and restart the Jenkins service:
sudo systemctl daemon-reload
sudo systemctl restart jenkins
You can verify that the correct options were picked up by navigating to ${JENKINS_BASE_URL}/systemInfo and searching for mail.smtp.starttls.enable

Fast forward 9 years and no workarounds are needed anymore thanks to Basil Crow.
The E-mail Extension plugin has support for SMTP over TLS and the additional "TLS" configuration checkbox (revealed by clicking on the Advanced button) since v2.83 released in May 2021 (see its release notes). I verified it works with Gmail under latest Jenkins and plugin versions.

Related

VS Code Remote Container unable to get local issuer certificate

VSCode Version:
1.62.2
Local OS Version:
Windows 10.0.18363
Reproduces in: Remote - Containers
Name of Dev Container Definition with Issue:
/vscode/devcontainers/typescript-node
In our company we use a proxy which terminates the SSL connections. When I now try to start any devcontainer (the workspace is in the WSL2 filesystem), I get the following error message:
Installing VS Code Server for commit 3a6960b964327f0e3882ce18fcebd07ed191b316
[2021-11-12T17:01:44.400Z] Start: Downloading VS Code Server
[2021-11-12T17:01:44.400Z] 3a6960b964327f0e3882ce18fcebd07ed191b316 linux-x64 stable
[2021-11-12T17:01:44.481Z] Stop (81 ms): Downloading VS Code Server
[2021-11-12T17:01:44.499Z] Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
at TLSSocket.emit (events.js:315:20)
at TLSSocket._finishInit (_tls_wrap.js:932:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
In the dockerfile I copy the company certificates and update them:
ADD ./certs /usr/local/share/ca-certificates
RUN update-ca-certificates 2>/dev/null
The proxy environment variables are also set correctly. Out of desperation I also tried to disable the certificate check for wget:
RUN su node -c "echo check_certificate=off >> ~/.wgetrc"
Even in the devcontainer configuration I have disabled the proxy and the security check for VS code via the settings:
// Set *default* container specific settings.json values on container create.
"settings": {
"http.proxy": "http://<proxy.url>:8080",
"http.proxyStrictSSL": false
},
I have tried many other things, like setting NODE_TLS_REJECT_UNAUTHORIZED=0 as env variable inside the dockerfile, unfortunately without any success. Outside the company network, without the proxy, it works wonderfully.
Maybe one of you has an idea how I can solve this problem?
A working if not so nice solution to the problem is to add HTTPS exceptions for the following domains:
https://update.code.visualstudio.com
https://az764295.vo.msecnd.net
A list of common hostnames can be found here:
https://code.visualstudio.com/docs/setup/network

Jenkis CLI does not work: WARNING: No header 'X-SSH-Endpoint' returned by Jenkins

I have Jenkins ver. 2.205 in Windows 10 and I have the following situation
Configure Global Security has Enable security checked.
I created the id_rsa_jenkins and id_rsa_jenkins.pub keys. The value of the public key was added to Jenkins for my account in SSH Public Keys.
I have the jenkins-cli.jar file, downloaded from http://localhost:9090/cli/
CLI
When I execute the following (split in multiple lines for presentation purposes):
java -jar jenkins-cli.jar
-s http://localhost:9090/
-i C:\Users\windowsusername/.ssh/id_rsa_jenkins
-ssh
-user jenkinsusername
help
Appears:
Enter passphrase for C:\Users\windowsusername\.ssh\id_rsa_jenkins:
Problem
I write the valid passphrase and then appears the following:
Nov 23, 2019 11:28:22 AM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider
INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider
Nov 23, 2019 11:28:22 AM hudson.cli.SSHCLI sshConnection
WARNING: No header 'X-SSH-Endpoint' returned by Jenkins
As shown above, does not appear the expected data
It happens for any Jenkins CLI command, such as:
help
who-am-i
list-jobs
etc.
What is missing or wrong?
For the audience:
The instructions provided in the original post are mandatory. But the following instructions are mandatory too:
Have installed the SSH plugin
In Configure Global Security, in the SSH Server section (in the bottom), proceed to enable it, in this case I use the Fixed value option.
Note seems the random option is only useful for the jenkins-cli.jar case. It because through the SSH connection (i.e: ssh -l jenkinsusername -p 2020 localhost list-jobs) is mandatory know the port, in this case 2020.
Therefore Fixed or Random is viable for jenkins-cli.jar (it does not ask for use a port number) but for SSH connection is mandatory know the port number (here Fixed is need it)
Furthemore in Jenkins SSH indicates:
Configuration
By default, Jenkins will listen on a random available port, so as not to break
existing deployments. But this is most likely not very useful, so the administrator
is encouraged to change this from the global security configuration page by assigning
a fixed port. This configuration UI will also allow you to disable this feature.
Was very valuable this video:
Jenkins in Telugu part 17 | Jenkins CLI (with ssh)

Jenkins rewrites URL to root when setting up behind HAProxy [duplicate]

I'm trying to follow the directions here: https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache to set up my Jenkins server to appear at http://myhost/jenkins. It works, but the Jenkins website thinks http://myhost/ is the jenkins/ root.
I believe this problem is caused by the first warning flag on that web page, i.e. that my context path is not set correctly. However, I can't figure out where to set the context path. The instructions for ubuntu and windows are clear enough, but on Mac OS X 10.6, there is no jenkins.xml file, no /etc/default/jenkins file, and nothing of relevance I can see in ~/.jenkins/config.xml.
So, what am I missing? Where can I tell jenkins that its root is in /jenkins/ instead of /?
Paraphrasing from the document you mentioned;
You need to specify the context/prefix of the Jenkins instance, this can be done by modifying the Jenkins configuration as follows;
Either, set the context path by modifying the jenkins.xml configuration file and adding --prefix=/jenkins (or similar) to the entry.
Or Set the context path when using by adding --prefix=/jenkins to JENKINS_ARGS in /etc/default/jenkins (Ubuntu) or in an appropriate startup file.
So, how to find these things...
The Jenkins.xml file should be in the $JENKINS_HOME directory, I'm not sure if Mac OS has the "updatedb" and "locate " commands, but you could try doing updatedb && locate jenkins.xml
Also, have a look in the startup scripts; /etc/init.d if installed from a package, or add the JENKINS_ARGS to the environment properties for the User running Jenkins (append to ~user/.profile) or the arguments for the container running Jenkins.
Be aware that if your Jenkins installation (without the prefix argument) was running under:
http://myserver:8080/ => 200 Jenkins is here
adding --prefix=/ci/dashboard in the arguments will produce this behaviour:
http://myserver:8080/ => 404
http://myserver:8080/ci/dashboard => 200 Jenkins is now here
Not sure where to look in config.xml, but at http://myhost/jenkins/configure, there's an option called "Jenkins URL" that you can use to set that.
Just to provide some recent confirmation of the suggested approaches, on CentOS 7, with Jenkins 1.610, I was able to achieve this by changing jenkinsUrl in jenkins.model.JenkinsLocationConfiguration.xml to the desired one (e.g. http://127.0.0.1:8080/jenkins), adding
JENKINS_ARGS="--prefix=/jenkins"
inside /etc/sysconfig/jenkins, and restarting Jenkins.
FYI the Jenkins installation was made via Puppet, using this Puppet module.
Add prefix attribute to /etc/default/jenkins file:
JENKINS_ARGS="--webroot=/var/cache/jenkins/war --prefix=/jenkins --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT
Configure your web server (e.g. - nginx) to redirect /jenkins to localhost:8080;
Put this into /etc/apache2/other/jenkins.conf:
ProxyPass /jenkins http://localhost:8009/jenkins
ProxyPassReverse /jenkins http://localhost:8009/jenkins
ProxyRequests Off
<Proxy http://localhost:8009/jenkins*>
Order deny,allow
Allow from 127.0.0.1
</Proxy>
Then execute these commands:
sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 8009
sudo defaults write /Library/Preferences/org.jenkins-ci prefix /jenkins
sudo launchctl stop org.jenkins-ci
The last command tells launchd to stop the running instance of Jenkins. And a new one will automatically be started because the launchd has been configured to always keep Jenkins running.
This is how I fixed it under Debian Wheezy running Jenkin 1.557
in /etc/default/jenkins , modify the JENKINS_ARGS line by adding "--prefix=$PREFIX"
JENKINS_ARGS=" ..... --prefix=$PREFIX"
you need to edit jenkins config file in directory
such like :
sudo vi /etc/default/jenkins and change var HTTP_PORT
next restart jenkins
sudo /etc/init.d/jenkins restart
hope this is helpful
I'm using CentOS7, add JENKINS_ARGS="--prefix=/jenkins" to /etc/sysconfig/jenkins and restart Jenkins worked. Then you can visit via ip:8080/jenkins
I'm not sure if people are still looking for this, but as I just ran across it, I figured I'd post my solution here.
By following the instructions at here, I was able to set the context located in Library/Preferences/org.jenkins-ci.plist to a more preferable address. The link has all the settings you can edit with an OS X native install.
I needed to configure Jenkins on a CentOS box via Puppet using the rtyler/jenkins module. Looking through the module code might suggest that HTTP_PORT and PREFIX should be the parameters in the config_hash but this did not work for me. What worked for me was something like the following Puppet configuration:
class { 'jenkins':
config_hash => {
'JENKINS_PORT' => { 'value' => '8085' },
'JENKINS_ARGS' => { 'value' => '--prefix=/jenkins' },
},
}
I was able to confirm that this updated the contents of "/etc/sysconfig/jenkins" (I believe this is the CentOS/RedHat file location).
For a Windows installation add the prefix within the <arguments> tag (jenkins.xml) and restart the service (Powershell Restart-Service jenkins). E.g.:
<executable>%BASE%\jre\bin\java</executable>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war" --prefix=/jenkins</arguments>

Error when trying to build the 'opencv_contrib' using cmake-gui

enter image description here1. I have downloaded and extracted the 'opencv_contrib-master' & 'opencv-master' from Git repo.
2. cmake 3.9 version is installed.
When I run the cmake, I am getting the below error:
I am using Visual Studio 2017 and Windows 10. Any help?
This is a screnshot of the CMAkeDownloadLog.txt
ErrorLog
From ErrorLog:
#use_cache "C:/Downloads/OPENCV/opencv-master/.cache"
#do_copy "opencv_ffmpeg.dll" "b8120c07962d591e2e9071a1bf566fd0" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0a0e88972a7ea97708378d0488a65f83e7cc5e69/ffmpeg/opencv_ffmpeg.dll" "C:/OpenCV/3rdparty/ffmpeg"
#missing "C:/OpenCV/3rdparty/ffmpeg/opencv_ffmpeg.dll"
#check_md5 "C:/Downloads/OPENCV/opencv-master/.cache/ffmpeg/b8120c07962d591e2e9071a1bf566fd0-opencv_ffmpeg.dll"
#mismatch_md5 "C:/Downloads/OPENCV/opencv-master/.cache/ffmpeg/b8120c07962d591e2e9071a1bf566fd0-opencv_ffmpeg.dll" "d41d8cd98f00b204e9800998ecf8427e"
#delete "C:/Downloads/OPENCV/opencv-master/.cache/ffmpeg/b8120c07962d591e2e9071a1bf566fd0-opencv_ffmpeg.dll"
#cmake_download "C:/Downloads/OPENCV/opencv-master/.cache/ffmpeg/b8120c07962d591e2e9071a1bf566fd0-opencv_ffmpeg.dll" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0a0e88972a7ea97708378d0488a65f83e7cc5e69/ffmpeg/opencv_ffmpeg.dll"
# timeout on name lookup is not supported
# Trying 151.101.112.133...
# TCP_NODELAY set
# connect to 151.101.112.133 port 443 failed: Timed out
# Failed to connect to raw.githubusercontent.com port 443: Timed out
# Closing connection 0
As you probably noticed, CMake cannot connect to the server providing the file it needs to download. Most likely that is some problem with your network connection.
For me CMake didn't know about the company https proxy. CMake knows about this through the environment variables HTTP_PROXY and HTTPS_PROXY. If this is your problem, you can set these variables for your system. If you cannot set environment variables system wide or you just want a quick test, start up command prompt and run
set HTTP_PROXY=<your-proxy-here>
set HTTPS_PROXY=<your-proxy-here>
c:\program files\cmake\bin\cmake-gui.exe
The path to cmake may be different, if it was installed to a different location.
If this is not the cause, something else is blocking your connection. E. g. a firewall, malware protection, etc.

Jenkins website root path

I'm trying to follow the directions here: https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache to set up my Jenkins server to appear at http://myhost/jenkins. It works, but the Jenkins website thinks http://myhost/ is the jenkins/ root.
I believe this problem is caused by the first warning flag on that web page, i.e. that my context path is not set correctly. However, I can't figure out where to set the context path. The instructions for ubuntu and windows are clear enough, but on Mac OS X 10.6, there is no jenkins.xml file, no /etc/default/jenkins file, and nothing of relevance I can see in ~/.jenkins/config.xml.
So, what am I missing? Where can I tell jenkins that its root is in /jenkins/ instead of /?
Paraphrasing from the document you mentioned;
You need to specify the context/prefix of the Jenkins instance, this can be done by modifying the Jenkins configuration as follows;
Either, set the context path by modifying the jenkins.xml configuration file and adding --prefix=/jenkins (or similar) to the entry.
Or Set the context path when using by adding --prefix=/jenkins to JENKINS_ARGS in /etc/default/jenkins (Ubuntu) or in an appropriate startup file.
So, how to find these things...
The Jenkins.xml file should be in the $JENKINS_HOME directory, I'm not sure if Mac OS has the "updatedb" and "locate " commands, but you could try doing updatedb && locate jenkins.xml
Also, have a look in the startup scripts; /etc/init.d if installed from a package, or add the JENKINS_ARGS to the environment properties for the User running Jenkins (append to ~user/.profile) or the arguments for the container running Jenkins.
Be aware that if your Jenkins installation (without the prefix argument) was running under:
http://myserver:8080/ => 200 Jenkins is here
adding --prefix=/ci/dashboard in the arguments will produce this behaviour:
http://myserver:8080/ => 404
http://myserver:8080/ci/dashboard => 200 Jenkins is now here
Not sure where to look in config.xml, but at http://myhost/jenkins/configure, there's an option called "Jenkins URL" that you can use to set that.
Just to provide some recent confirmation of the suggested approaches, on CentOS 7, with Jenkins 1.610, I was able to achieve this by changing jenkinsUrl in jenkins.model.JenkinsLocationConfiguration.xml to the desired one (e.g. http://127.0.0.1:8080/jenkins), adding
JENKINS_ARGS="--prefix=/jenkins"
inside /etc/sysconfig/jenkins, and restarting Jenkins.
FYI the Jenkins installation was made via Puppet, using this Puppet module.
Add prefix attribute to /etc/default/jenkins file:
JENKINS_ARGS="--webroot=/var/cache/jenkins/war --prefix=/jenkins --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT
Configure your web server (e.g. - nginx) to redirect /jenkins to localhost:8080;
Put this into /etc/apache2/other/jenkins.conf:
ProxyPass /jenkins http://localhost:8009/jenkins
ProxyPassReverse /jenkins http://localhost:8009/jenkins
ProxyRequests Off
<Proxy http://localhost:8009/jenkins*>
Order deny,allow
Allow from 127.0.0.1
</Proxy>
Then execute these commands:
sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 8009
sudo defaults write /Library/Preferences/org.jenkins-ci prefix /jenkins
sudo launchctl stop org.jenkins-ci
The last command tells launchd to stop the running instance of Jenkins. And a new one will automatically be started because the launchd has been configured to always keep Jenkins running.
This is how I fixed it under Debian Wheezy running Jenkin 1.557
in /etc/default/jenkins , modify the JENKINS_ARGS line by adding "--prefix=$PREFIX"
JENKINS_ARGS=" ..... --prefix=$PREFIX"
you need to edit jenkins config file in directory
such like :
sudo vi /etc/default/jenkins and change var HTTP_PORT
next restart jenkins
sudo /etc/init.d/jenkins restart
hope this is helpful
I'm using CentOS7, add JENKINS_ARGS="--prefix=/jenkins" to /etc/sysconfig/jenkins and restart Jenkins worked. Then you can visit via ip:8080/jenkins
I'm not sure if people are still looking for this, but as I just ran across it, I figured I'd post my solution here.
By following the instructions at here, I was able to set the context located in Library/Preferences/org.jenkins-ci.plist to a more preferable address. The link has all the settings you can edit with an OS X native install.
I needed to configure Jenkins on a CentOS box via Puppet using the rtyler/jenkins module. Looking through the module code might suggest that HTTP_PORT and PREFIX should be the parameters in the config_hash but this did not work for me. What worked for me was something like the following Puppet configuration:
class { 'jenkins':
config_hash => {
'JENKINS_PORT' => { 'value' => '8085' },
'JENKINS_ARGS' => { 'value' => '--prefix=/jenkins' },
},
}
I was able to confirm that this updated the contents of "/etc/sysconfig/jenkins" (I believe this is the CentOS/RedHat file location).
For a Windows installation add the prefix within the <arguments> tag (jenkins.xml) and restart the service (Powershell Restart-Service jenkins). E.g.:
<executable>%BASE%\jre\bin\java</executable>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war" --prefix=/jenkins</arguments>

Resources