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.warhowever 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?
22 Answers
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.
- Download
jenkins.warfile to any convenient destination, eg./home/jenkins_user - Create service file
/etc/systemd/system/jenkins.servicespecifying the relaxed security policy - Reload service manager:
systemctl daemon-reload - That's it! Now manage the service
Full instructions including examples are given here Installing Jenkins as a Linux Daemon
1I 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.