Enable HTTPS on Jenkins

Jenkins uses HTTP by default. You can enable HTTPS by performing a couple of steps. You need to acquire an SSL certificate and corresponding key for a domain that is under your control, and tell Jenkins that it needs to use these resources.

Jenkins needs a password store to be able to use your SSL certificate. You can convert the certificate (either .crt or .pem) and key file like this:

openssl pkcs12 -inkey example.net.key -in example.net.pem -export -out keys.pkcs12
keytool -importkeystore -srckeystore keys.pkcs12 -srcstoretype pkcs12 -destkeystore /var/lib/jenkins/jenkins.jks

You will be prompted for a password when you perform these actions. Use the same password when you edit the file /etc/sysconfig/jenkins:

JENKINS_ARGS="--httpPort=-1 --httpsPort=8443 --httpsKeyStore=/var/lib/jenkins/jenkins.jks --httpsKeyStorePassword=password_you_entered"

Restart Jenkins:

service jenkins restart

Leave a Reply

Your email will not be published. Name and Email fields are required.