Code signing
Jenkins Code Signing
Configure KMES Series 3
17min
this section shows you how to configure tls communication between the {{k3}} and the jenkins instance and then covers general {{k}} configurations for the {{k}} to provide jenkins code signing functionality configure tls communication perform the following tasks to configure tls communication between the {{k3}} and the jenkins instance create a certificate authority (ca) generate a csr for the system/host api connection pair sign the system/host api csr export the root ca and signed system/host api tls certificate load the exported certificates into the system/host api connection pair generate a signed client certificate for the jenkins instance allow export of certificates by using passwords export the signed jenkins certificate as a pkcs #12 file the following sections describe how to perform these tasks create a ca perform the following steps to create a ca log in to the {{k3}} application interface with the default admin identities go to pki > certificate authorities , and select \[ add ca ] at the bottom of the page in the certificate authority window, enter a name for the certificate container, leave all other fields set to the default values, and select \[ ok ] the certificate container that you created now displays in the certificate authorities menu right click the certificate container and select add certificate > new certificate on the subject dn tab, set a common name for the certificate, such as system tls ca root on the basic info tab, leave the settings set to the default values on the v3 extensions tab, select the certificate authority profile and select \[ ok ] the root ca certificate now displays under the previously created certificate container generate a csr perform the following steps to generate a csr for the system/host api connection pair go to administration > configuration > network options in the network options window, go to the tls/ssl settings tab under the system/host api connection pair, uncheck the use futurex certificates checkbox and select \[ edit ] next to pki keys in the user certificates section in the application public keys window, select \[ generate ] when warned that ssl will not be functional until new certificates are imported , select \[ yes ] to continue in the pki parameters window, leave all fields set to the default values and select \[ ok ] you see that a pki key pair is loaded in the application public keys window select \[ request ] on the subject dn tab, you can leave the default system/host api value set in the common name field, or you can change it to a different value on the v3 extensions tab, select the tls server certificate profile on the pkcs #10 info tab, select a save location for the csr and select \[ ok ] when prompted that the certificate signing request was successfully written to the file location that was selected , select \[ ok ] select \[ ok ] again to save the application public keys settings the main network options menu under the system/host api connection pair now shows loaded next to pki keys sign the csr perform the following steps to sign the system/host api csr go to pki > certificate authorities right click the root ca certificate you created and select add certificate > from request in the file browser, find and select the csr that you generated for the system/host api connection pair after it loads, you don't need to modify any settings for the certificate select \[ ok ] the signed system/host api certificate now displays under the root ca certificate on the certificate authorities page export the root ca and certificates perform the following steps to export the root ca and signed system/host api certificates right click the root ca certificate and select export > certificate(s) change the encoding to pem and select \[ browse ] specify a location and name for the export file when prompted that the file was successfully written to the location that was selected , select \[ ok ] right click the signed system/host api certificate and select export > certificate(s) change the encoding to pem and select \[ browse ] specify a location and name for the export file when prompted that the file was successfully written to the location that was selected , select \[ ok ] load the certificates perform the following steps to load the exported certificates into the system/host api connection pair go to administration > configuration > network options in the network options window, go to the tls/ssl settings tab under the system/host api connection pair, select \[ edit ] next to certificates in the user certificates section right click the system/host api ssl ca x 509 certificate container and select \[ import ] select \[ add ] at the bottom of the import certificates window in the file browser, select both the root ca certificate and the signed system/host api certificate and select \[ open ] the certificate chain appears in the window select \[ ok ] to save the changes in the network options window, the system/host api connection pair shows signed loaded next to certificates in the user certificates section generate a certificate perform the following steps to generate a signed certificate for the jenkins instance go to pki > certificate authorities right click the root ca certificate and select add certificate > new certificate on the subject dn tab, set a common name for the certificate, such as jenkins leave all fields on the basic info tab set to the default values on the v3 extensions tab, select the tls client certificate profile and select \[ ok ] the signed jenkins certificate now displays under the root ca certificate allow export of certificates perform the following steps to configure the allow export of certificates by using passwords function go to administration > configuration > options select the checkbox next to the menu option allow export of certificates using passwords select \[ save ] export the certificate perform the following steps to export the signed jenkins certificate as a pkcs #12 file go to pki > certificate authorities right click the signed jenkins certificate and select export > pkcs12 select \[ set password ] , enter a password for the pkcs #12 file, and select \[ save ] in the export certificates window, select export selected certificate with parents under export options , and select \[ next ] specify a name for the pkcs #12 export file and select \[ open ] a message box states that the pkcs #12 certificate export was successful configure general kmes settings perform the following tasks to configure the {{k3}} for communication with jenkins enable host api commands create a jenkins role with the required permissions create a jenkins identity with the correct assigned roles create a signing approval group and give it appropriate permissions create a jenkins code signing certificate apply an issuance policy to the jenkins code signing certificate the following sections show you how to complete these tasks enable the api commands perform the following steps to enable the required host api commands go to administration > configuration > host api options and enable the following commands command description rafa enumerate issuance policies raga retrieve issuance policy details ragz retrieve request (authenticode) rauz upload request (authenticode) ragj retrieve request (jar) rauj upload request (jar) rklo login user rago retrieve request (hash signing) rauo upload request (hash signing) select \[ save ] create a jenkins role perform the following steps to create a jenkins role with the required permissions go to identity management > roles , then select \[ add ] at the bottom of the page on the info tab, specify a name for the role, such as jenkins set the type to application , the role class to principal , and logins required to 1 on the permissions tab, select the following permissions permission subpermission certificate authority export clear key, upload on the advanced tab, select only host api for allowed ports select \[ ok ] to save and finish create a jenkins identity perform the following steps to create a jenkins identity with the correct assigned roles go to identity management > identities , right click the background, and select add > client application on the info tab, select application for the storage type and specify a name for the identity on the assigned roles tab, select the role you created in the previous section on the authentication tab, remove the api key mechanism, add the password mechanism, and set your password select \[ ok ] to finish creating the identity create a signing approval group perform the following steps to create a signing approval group and give it appropriate permissions go to pki > signing workflow and select \[ add approval group ] at the bottom of the page set a name for the approval group, such as jenkins , and select \[ ok ] to save right click the jenkins approval group you just created and select \[ permission ] select the show all roles and permissions checkbox, grant the jenkins role the use permission, and select \[ ok ] create a jenkins code signing certificate perform the following steps to create a jenkins code signing certificate go to pki > certificate authorities and select \[ add ca ] at the bottom of the page in the certificate authority window, enter a name for the certificate container , such as jenkins code signing ca set the owner of the ca to the jenkins role and select \[ ok ] the certificate container you just created now displays in the certificate authorities menu right click the jenkins certificate container and select add certificate > new certificate on the subject dn tab, set a common name for the certificate, such as root on the basic info tab, leave all fields set to the default values on the v3 extensions tab, select the code signing certificate profile and select \[ ok ] the root jenkins code signing certificate displays under the jenkins certificate container apply an issuance policy perform the following steps to apply an issuance policy to the jenkins code signing certificate go to pki > certificate authorities right click the root certificate within the jenkins certificate container and select issuance policy > add on the basic info tab, make the following changes (optional) specify an alias set approvals to 1 setting approvals to 0 allows anonymous signing select any hashes that you want to allow on the x 509 tab, set the default approval group to jenkins on the object signing tab, select the allow object signing checkbox select \[ ok ] to apply the issuance policy to the root jenkins code signing certificate