0

I upgraded to v2.2 of Jenkins on my server and I want to relax the new Content Security Policy configuration. I can successfully run

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

which temporarily sets the value and make the HTML output display properly. However when I restart Jenkins the value needs to be changed again. The web page says to run

java -Dhudson.model.DirectoryBrowserSupport.CSP= -jar jenkins.war

however the only file is located at /usr/share/jenkins/jenkins.war and when I run the command on that file it tries to setup a new Jenkins instance.

Is there a different file or way to run this command for an Ubuntu service?

  • Creating a new instance is the behaviour I would expect. Usually the server on which Jenkins is running is never switched off so you only need to enter the command once. Are you looking to run multiple instances of Jenkins and only set this property once or do you want a way to start Jenkins with a relaxed CSP every time you turn on the server? – Steve Roome May 20 '16 at 19:34
  • Everytime I turn on the server. There have been a few versions released of jenkins recently. Everytime I upgrade it restarts the jenkins service and I have to enter the command again. – Timothy Ruhle May 23 '16 at 2:53
1

To run Jenkins every time you restart the server with the option to relax the content security policy, run it as a service with the options you require.

  1. Download jenkins.war file to any convenient destination, eg. /home/jenkins_user
  2. Create service file /etc/systemd/system/jenkins.service specifying the relaxed security policy
  3. Reload service manager: systemctl daemon-reload
  4. That's it! Now manage the service

Full instructions including examples are given here Installing Jenkins as a Linux Daemon

| improve this answer | |
  • Thanks for your help. It ended up getting me to the right place. – Timothy Ruhle May 23 '16 at 22:41
0

I ended up modifying /etc/default/jenkins. There should be a line that sets a JAVA_ARGS variable. I copied -Dhudson.model.DirectoryBrowserSupport.CSP= a described on the jenkins website into that variable.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.