Secure Jenkins with self-signed SSL certificate

So that Jenkins can only be reached via HTTPS on Linux, first you have to create an SSL certificate in the folder:

mkdir /var/lib/jenkins/ssl_cert/
cd /var/lib/jenkins/ssl_cert/

openssl req -newkey rsa:2048 -x509 -keyout cakey.pem -out cacert.pem -days 3650

Then you can convert this certificate for the Java Key Store:

openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out identity.p12 -name jenkins
keytool -importkeystore -destkeystore identity.jks  -srckeystore identity.p12 -srcstoretype PKCS12

and import into the Java Key Store:

keytool -import -file cacert.pem -keystore trust.jks

In the end, only the Config has to be adjusted:

sudo vi /etc/sysconfig/jenkins

with the values:

JENKINS_PORT="-1"

JENKINS_HTTPS_PORT="8443"

JENKINS_HTTPS_KEYSTORE="/var/lib/jenkins/ssl_cert/identity.jks"

JENKINS_HTTPS_KEYSTORE_PASSWORD="YOUR_PASSWORD_HERE"

JENKINS_HTTPS_LISTEN_ADDRESS="0.0.0.0"

And the service will be restarted:

chown -R jenkins: /var/lib/jenkins/ssl_cert/*
chmod 600 /var/lib/jenkins/ssl_cert/*

sudo systemctl restart jenkins

Tutorial Jenkins on Windows set up

Server is a great asset for any major IT project a Jenkins.

In the following I will describe the Setup on Windows.

Installation

A Installer can be used comfortably under Windows, with the Jenkins then just about a Tomcat Web server is running and in the browser http://localhost:8080 is accessible. It automatically starts the installation routine, the rudimentary establishes the Jenkins:

jenkins_installation

Automatic installation routine set up by Jenkins

more…