5 Enhancing Security using HTTPS
With the introduction of this feature, HTTPS adds a layer of encryption that helps the user to secure connection between server and clients.
When accessing a website enabled with HTTPS, users can trust that their connection is secure, ensuring the confidentiality of their data. For Jenkins to operate over HTTPS, it requires SSL certificate.
This certificate is converted into Public-Key Cryptography Standards (PKCS)
12 industry standard format and then to JKS
format, which Jenkins
readily accepts. The JKS
format certificate is then stored in the
Jenkins path, enabling the certificate to operate over HTTPS.
Prerequisites
The user needs to obtain an SSL certificate and a key from a certificate authority.
Uploading SSL Certificate
- Upload SSL certificate in DSR NOAM
- Upload SSL certificate in ATS
- Log in to the DSR NOAM GUI.
- Navigate to Administration, then Access Control and Certificate Management.
- Upload the SSL certificate and key.
Configuring JKS.YAML Properties
Configure the following properties as listed below:
Certificate_uploaded_DSR
: To select the model, enter either 1 or 0 for yes or no.Certificate_uploaded_ATS
: To select the model, enter either 1 or 0 for yes or no.Dsrcertfilename
: Provide the certificate file name located in theDSR NOAM /usr/TKLC/appworks/etc/ssl/ path
. Mandatory if Certificate_uploaded_DSR is selected.Dsrkeyfilename
: Provide the key file name located inDSR NOAM /usr/TKLC/appworks/etc/ssl/
path. Mandatory if Certificate_uploaded_DSR is selected.Atscertfilename
: Provide the file name of the ATS certificate that has been uploaded. Mandatory if Certificate_uploaded_ATS is selectedAtskeyfilename
: Provide the file name of the ATS key that has been uploaded. Mandatory if Certificate_uploaded_ATS is selectedAtscertstorepath
: Provide the folder path where the SSL certificate and private key has been uploaded in ATS.Dsrnoip
: Provide the DSR NOAM IP address (if the certificate has been uploaded in DSR). Mandatory if Certificate_uploaded_DSR is selected.Dsrusername
: Provide the DSR NOAM CLI username (Default is "admusr"). Mandatory if Certificate_uploaded_DSR is selected.Dsrpassword
: Provide the DSR NOAM CLI password (Default is "Dukw1@m?") User can change the password, after which it will be encrypted again. Mandatory if Certificate_uploaded_DSR is selected.httpsKeyStorePassword
: Provide the password required for the certificate file (Default is "Welcome@123"). It will be stored in the encrypted form.
Figure 5-1 jks.yaml file

Running the JKS.PY File
jks.py
file by using the following
command:python jks.py
Note:
The user cannot select yes for both Certificate_uploaded_DSR and Certificate_uploaded_ATS at the same time.Figure 5-2 python jks.py

Configuring HTTPS File
The files https_config
, jks.yaml
and
jks.py
are required for running Jenkins and must not be
deleted under any circumstances.
httpPort
: The current value of this parameter is-1
, which should not be altered to run Jenkins through HTTPS.httpsPort
: The current value of this parameter is 8443, which should not be altered to run Jenkins through HTTPS.httpsKeyStore
: The current default value of this parameter is/var/lib/jenkins/jenkinsserver.jks
and is advised not to be changed unless the.jks
certificate file is relocated.httpsKeyStorePassword
: This parameter should remain the same as the password injks.yaml
file and it needs to be modified only in thejks.yaml
.
Results after Running JKS.PY File
- Prevalidation checks
- Checking the availability of ATS certificate and key files
- Checking the availability of
Jenkinsserver.jks
file - Conversion to JKS format
- Warning for PKCS 12 format
- Restart of Jenkins
Prevalidation Checks
The console displays PRE-VALIDATION CHECK
SUCCESSFUL!!! when the parameters in the model selection within the
jks.yaml
are in the correct format.
Figure 5-3 Prevalidation

Checking the availability of ATS certificate and key files
The result specifically focuses on the certificate uploaded in the ATS
model. The script checks whether the ATS uploaded certificate and key files exist in
the ATS uploaded folder path provided in the jks.yaml
file.
Figure 5-4 ATS certificate

Checking the availability of Jenkinsserver.jks
file
The script confirms the availability of the jenkinsserver.jks
file
and removes it from the Jenkins home path to place the newly
created jks file
.
Figure 5-5 Jenkinsserver.jks

Conversion to JKS format
The script generates a confirmation message indicating the creation of
the jks
format file:
Figure 5-6 JKS format conversion

Note:
The console displays a warning message during the conversion tojks
format, as PKCS 12 is the
recommended industry standard. It can be ignored, as jks
format is
required for Jenkins to run over HTTPS.
Figure 5-7 Warning

Restart of Jenkins
Restarting Jenkins results in displaying the Jenkins home path.
Figure 5-8 Restart of jenkins

Conclusion
By configuring SSL certification, Jenkins can operate over HTTPS,
ensuring secure communication between client and the Jenkins web interface. The
Jenkins server is securely accessible through HTTPS port using the following URL:
https://<ATS IP>:8443
.
Figure 5-9 HTTPS Enabled Log in Screen
