Page History
...
- The connections from Controllers to Agents can be secured by HTTPS with TLS/SSL certificates.
- This article describes the steps required to set up secure HTTPS communication from a Controller to an Agent. This includes using a standalone Controller or a Controller cluster with a primary and standby instance.
- See the JS7 - System Architecture article for an overview of components products and connections.
- Follow the instructions in the JS7 - JOC Cockpit HTTPS Connections article for securing connections from clients (user browser / REST API client) to JOC Cockpit.
- See the JS7 - Controller HTTPS Connections article for information about securing the connections between JOC Cockpit and Controller instances.
...
- The following explanations assume CA-signed certificates or self-signed certificates to be usedCertificates being used.
- Private CA-signed certificates are provided from known and trusted Certificate Authorities (CA) that validates the domain owner.Self-signed certificates are created by users who operate their own CA, see the JS7 - How to create selfX.509 SSL TLS Certificates.
- Public CA-signed Certificates are provided from known and trusted Certificate Authorities (CA) that validate the domain owner.
- Use of Intermediate CA certificates Certificates is optional.
- There is no difference in using a Private CA or Public CA concerning functionality of X.509 certificates, usage for Server Authentication / Client Authentication, or security of connections. The only difference is that users trust the Private CA that they set up on their own.
- Certificate stores can be managed from Certificate stores can be managed from the command line and using tools that provide a GUI for this purpose:
- the Java
keytool
is available from the Java JRE or JDK, - the Keystore Explorer, which is an open source utility to graphically manage certificate stores.
- the Java
- Starting from Java 9 the PKCS12 keystore type is default and is not required to be specified with
keytool
. - The following sections assume a PKCS12 keystore/truststore format. For Unix OS the .p12 file extension frequently is used, for Windows OS the .pfx extension is preferably used. Both file extensions indicate the same PKCS12 format and can be used interchangeably.
Certificate Management
Private keys Keys and certificates Certificates should be distributed as follows:
...
Flowchart |
---|
Controller[label=" Controller \nStandalone / Cluster",fillcolor="lightskyblue"] Agent_A [label=" Agent ",fillcolor="lightskyblue"] Controller_Truststore [label="Controller Truststore\nhttps-truststore.p12\n\nCA certificates",fillcolor="orange"] Controller_Keystore [label="Controller Keystore\nhttps-keystore.p12\n\nCA certificates\nPrivate Key / Certificate",fillcolor="limegreen"] Agent_A_Truststore [label="Agent Truststore\nhttps-truststore.p12\n\nCA certificates",fillcolor="limegreen"] Agent_A_Keystore [label="Agent Keystore\nhttps-keystore.p12\n\nCA certificates\nPrivate Key / Certificate",fillcolor="orange"] Controller_Truststore_RootCertificate [shape="ellipse",label="CA Root\nCertificate",fillcolor="white"] #Controller_Keystore_RootCertificate [shape="ellipse",label="CA Root\nCertificate",fillcolor="white"] #Controller_Keystore_IntermediateCertificate [shape="ellipse",label="CA Intermediate\nCertificate",fillcolor="white"] Controller_Keystore_PrivateKey [shape="ellipse",label="Client Authenciation\nPrivate Key",fillcolor="white"] Controller_Keystore_Certificate [shape="ellipse",label="Client Authentication\nCertificate",fillcolor="white"] Agent_A_Truststore_RootCertificate [shape="ellipse",label="CA Root\nCertificate",fillcolor="white"] #Agent_A_Keystore_RootCertificate [shape="ellipse",label="CA Root\nCertificate",fillcolor="white"] #Agent_A_Keystore_IntermediateCertificate [shape="ellipse",label="CA Intermediate\nCertificate",fillcolor="white"] Agent_A_PrivateKey [shape="ellipse",label="Server Authenciation\nPrivate Key",fillcolor="white"] Agent_A_Keystore_Certificate [shape="ellipse",label="Server Authentication\nCertificate",fillcolor="white"] Agent_A -> Agent_A_Keystore Agent_A_Keystore -> Agent_A_PrivateKey -> Agent_A_Keystore_Certificate [label=" add to keystore "] #Agent_A_Keystore -> Agent_A_Keystore_RootCertificate -> Agent_A_Keystore_IntermediateCertificate [label=" add to keystore "] Agent_A -> Agent_A_Truststore Agent_A_Truststore -> Agent_A_Truststore_RootCertificate [label=" add to truststore "] Controller -> Agent_A [label=" establish connection "] Controller -> Controller_Truststore Controller_Truststore -> Controller_Truststore_RootCertificate [label=" add to truststore "] Controller -> Controller_Keystore #Controller_Keystore -> Controller_Keystore_RootCertificate -> Controller_Keystore_IntermediateCertificate [label=" add to keystore "] Controller_Keystore -> Controller_Keystore_PrivateKey -> Controller_Keystore_Certificate [label=" add to keystore "] |
...
- The keystore and truststore shown in orange are required for any connections of a Controller to an Agent.
- The Agent's private key Private Key and certificate Certificate for Server Authentication are added to the Agent's keystore.
- The Root CA certificate Certificate is added to the Agent's truststore.
- The keystore and truststore shown in green are required if mutual authentication is in place for certificate based Client Authentication (default).
...
In the following the JS7_CONTROLLER_CONFIG_DIR
placeholder specifies placeholder specifies the configuration directory of the Controller. The
The JS7_AGENT_HOME
, JS7_AGENT_CONFIG_DIR
placeholders specify placeholder specifies the directories where the Agent is installed and configuredholds configuration files.
- JS7_CONTROLLER_CONFIG_DIR is the Controller's configuration directory that is specified during installation:
<extraction-directory/controller/var/config
(default on Unix/Windows for JS7 - Controller - Headless Installation on Linux and Windows)C:\ProgramData\sos-berlin.com\js7\controller\config
(default on Windows for JS7 - Controller - Installation Using the Windows Graphical Installer)
JS7_AGENT_HOME
is the installation path directory that is specified during the JobScheduler Agent installation:<extraction-directory>/agent
(default on Unix/Windows for JS7 - Agent - Headless Installation on Unix and Windows)C:\Program Files\sos-berlin.com\js7\agent
(default on Windows for JS7 - Agent - Installation Using the Windows Graphical Installer)
JS7_AGENT_CONFIG_DIR
is the Agent's configuration directory that is specified during Agent installation:<extraction-directory>/agent/var_<port>/config
(default on Unix/Windows for JS7 - Agent - Headless Installation on Unix and Windows)C:\ProgramData\sos-berlin.com\js7\agent\config
(default on Windows for JS7 - Agent - Installation Using the Windows Graphical Installer)
...
Step 1: Creating the Agent Keystore
- On the Agent server create the keystore using
openssl
and thekeytool
from your Java JRE or JDK. Alternatively import a private key Private Key and certificate Certificate that you received from your certificate authorityCertificate Authority:- For use with a third 3rd-party utility create a keystore, e.g.
https-keystore.p12
, in PKCS12 format and import:- the Agent private key Private Key and certificate Certificate for Server Authentication
- The examples below show a possible approach for certificate management. However, there are other ways to achieve similar results.
Example for importing a private key Private Key and CA-signed certificate Certificate to a PKCS12 keystore:
Code Block language bash title Example how to import a private key Private Key and CA-signed certificate Certificate to a PKCS12 keystore # Assume the fully qualified domain name (FQDN) of the Agent server to be "agent.example.com" # If the Agent's CA-signed certificateCertificate is provided from a pkcs12 keystore (certificate.p12), extract the certificate to a .crt file in PEM format (agent.example.com.crt) # openssl pkcs12 -in certificate.p12 -nokeys -out agent.example.com.crt # Import the Agent's privatePrivate keyKey (agent.example.com.key) and certificateCertificate (agent.example.com.crt) from PEM format to a new keystore (agent.example.com.https-keystore.p12) openssl pkcs12 -export -in agent.example.com.crt -inkey agent.example.com.key --name agent.example.com -out "JS7_AGENT_CONFIG_DIR/private/https-keystore.p12"
Example for creating a private key Private Key and selfCA-signed certificate Certificate and importing import to a keystore
Refer to examples available from JS7 - How to create self-signed X.509 SSL TLS Certificates, chapter Creating a Server Certificate.
Code Block language bash title Example how to create a private key Private Key and selfCA-signed certificateCertificate # Creating the privatePrivate keyKey and selfCA-signed certificate for the given validity period ./create_server_certificate.sh --dns=agent.example.com --days=365
Refer to examples available from JS7 - How to add SSL TLS Certificates to Keystore and Truststore.
Code Block title Example how to add a private key and certificate Private Key and CA-signed Certificate to a PKCS12 keystore # Adding the privatePrivate keyKey and certificateCertificate to a keystore ./js7_create_certificate_store.sh \ --keystore=JS7_AGENT_CONFIG_DIR/private/https-keystore.p12 \ --key=agent.example.com.key \ --cert=agent.example.com.crt \ --alias=agent.example.com \ --password="jobscheduler"
When using additional arguments a truststore will be immediately created:Code Block title Example how to add a private key and certificate Private Key and CA-signed Certificate to a PKCS12 keystore and the Root CA Certificate to a truststore # Adding the privatePrivate keyKey and certificateCertificate to a keystore and Root CA Certificate to a truststore ./js7_create_certificate_store.sh \ --keystore=JS7_AGENT_CONFIG_DIR/private/https-keystore.p12 \ --truststore=JS7_AGENT_CONFIG_DIR/private/https-truststore.p12 \ --key=controlleragent.example.com.key \ --cert=controlleragent.example.com.crt \ --alias=controlleragent.example.com \ --password="jobscheduler" \ --ca-root=root-ca.crt
- With the keystore being set up specify the relevant properties with the
JS7_AGENT_CONFIG_DIR
/private/private.conf
configuration file:Example
Code Block language text title Example for private.conf file specifying the Agent keystore js7 { web { # keystore and truststore locations for https connections https { keystore { # Default: ${js7.config-directory}"/private/https-keystore.p12" file=${js7.config-directory}"/private/https-keystore.p12" key-password="jobscheduler" store-password="jobscheduler" } } } }
Explanation:js7.web.https.keystore.file
is used for the path to the keystore.js7.web.https.keystore.key-password
is is used for access to the private keyPrivate Key.js7.web.https.keystore.store-password
is is used for access to the keystore. Passwords for key access and keystore access have to match if a PKCS12 keystore type is used.
- For use with a third 3rd-party utility create a keystore, e.g.
- On the Agent instance's server create the keystore using the
keytool
from your Java JRE or JDK or a third 3rd-party utility.- For use with a third 3rd-party utility create a truststore, e.g.
https-truststore.p12
, in PKCS12 format and import:- Root CA Certificate
- The examples below show a possible approach for certificate management - however, there are other ways of achieving similar results.
Example for importing a Root CA Certificate to a PKCS12 keystoretruststore:
Code Block language bash title Example how to import a Root CA Certificate to a PKCS12 keystoretruststore # Import Root CA Certificate in PEM format to a PKCS12 truststore (https-truststore.p12) keytool -importcert -alias "root-ca" -file "root-ca.crt" -keystore "JS7_AGENT_CONFIG_DIR/private/https-truststore.p12" -storetype PKCS12
- For use with a third 3rd-party utility create a truststore, e.g.
...
- By default mutual authentication is in place.
- The Controller verifies the Agent's Server Authentication certificate.
- The Controller is challenged by the Agent to present its Client Authentication certificate which is then verified by the Agent.
- If a Controller Cluster is used then connections from both Controller instances are authenticated by the Distinguished Name of the Controller instance's Client Authentication certificate.
The
JS7_AGENT_CONFIG_DIR
/private/private.conf
configuration file should include authentication details like this:Code Block title Example for private.conf file specifying Controller authentication js7 { auth { users { # Controller ID for connections by primary/secondary Controller instance jobscheduler { distinguished-names=[ "DNQ=SOS CA, CN=primary_controller_client, OU=IT, O=SOS, L=Berlin, ST=Berlin, C=DE", "DNQ=SOS CA, CN=secondary_controller_client, OU=IT, O=SOS, L=Berlin, ST=Berlin, C=DE" ] } } } }
Explanation:- The
jobscheduler
user account is an example of a Controller ID that is specified during Controller installation. - The
distinguished-names
property allows the addition of a number of Distinguished Names as available from the subject of Client Authentication certificates that are used by Controller instances when connecting to the Agent.- Except for whitespace between attributes the precise sequence and values as available from the certificate's subject has to match this property valueand values as available from the certificate's subject has to match this property value.
- Distinguished Names can be displayed in different flavors. JS7 makes use of RFC2253 compliant Distinguished Names. The following command can be executed to verify the Distinguished Name from a given certificate file:
openssl x509 -in <controller-cert.pem> -noout -nameopt RFC2253 -subject
- The output that you receive - except for a
subject:
orsubject=
prefix - should be used as the Controller's Distinguished Name
- Sample Output:
subject= ST=Berlin,OU=JS7,O=SOS,L=Berlin,C=DE,CN=centostest-primary
- The prefix
subject=
has to be omitted from the Distinguished Name.
- The
Step 3: Setting up the Agent Instance Start Script for HTTPS
...
- On the Controller server create the truststore using the
keytool
from your Java JRE or JDK or a third 3rd-party utility.- For use with a third 3rd-party utility create a truststore, e.g.
https-truststore.p12,
in PKCS12 format and import:- the Root CA Certificate
- The examples below show one a possible approach for certificate management. However, there are other ways to achieve similar results.
Example for importing a Root CA Certificate to a PKCS12 truststore:
Code Block language bash title Example how to import a Root CA Certificate into a PKCS12 Truststore # import Root CA certificateCertificate in PEM format to a PKCS12 truststore (https-truststore.p12) keytool -importcert -alias "root-ca" -file "root-ca.crt" -keystore "JS7_CONTROLLER_CONFIG_DIR/private/https-truststore.p12" -storetype PKCS12
- For use with a third 3rd-party utility create a truststore, e.g.
- On the Controller server specify the location of the truststore with the
JS7_CONTROLLER_CONFIG_DIR
/private/private.conf
configuration file:Example
Code Block language text title Example for private.conf file specifying the Controller truststore js7 { web { # keystore and truststore locations for https connections https { truststores=[ { # Default: ${js7.config-directory}"/private/https-truststore.p12" file=${js7.config-directory}"/private/https-truststore.p12" store-password="jobscheduler" } ] } } }
Explanation:js7.web.https.truststores.file
is used for the path to the truststore.js7.web.https.truststores.store-password
is used for access to the truststore.
...
For mutual authentication the Controller has to hold a Client Authentication private key Private Key and certificate Certificate in its keystore.
- This can be simplified by using a private keyPrivate Key/certificate Certificate pair that is created for both extended key uses Server Authentication and Client Authentication. In this case a single private key Private Key and certificate Certificate is stored with the Controller's keystore as indicated in the the JS7 - Controller HTTPS Connections article.
- If separate private keyPrivate Key/certificate Certificate pairs for Server Authentication and Client Authentication are used then the use of separate certificate stores for the Controller is recommended:
- The keystore holds the private keyPrivate Key/certificate Certificate for Server Authentication.
- The client keystore holds the private key/certificate holds the Private Key/Certificate for Client Authentication.
...
- On the Controller server create the client keystore using the
keytool
from your Java JRE or JDK or a third 3rd-party utility.- For use with a third 3rd-party utility create a client keystore, e.g.
https-client-keystore.p12,
in PKCS12 format and import:- the Controller private key and certificate for Client Private Key and Certificate for Client Authentication
- For use with
keytool
create the client keystore in PKCS12 or JKS format according to the steps indicated in the JS7 - Controller HTTPS Connections: Step 1: Creating the Controller Keystore article.- Apply the steps described to the client keystore and use the private keyPrivate Key/certificate Certificate pair for Client Authentication.
- For use with a third 3rd-party utility create a client keystore, e.g.
The location of the client keystore is added to the
JS7_CONTROLLER_CONFIG_DIR/private/private.conf
configuration file as shown:Example for PKCS12 client keystore:
Code Block language text title Example how to specify the client keystore location with private.conf file js7 { web { # keystore and truststore location for https connections https { client-keystore { # Default: ${js7.config-directory}"/private/https-client-keystore.p12" file=${js7.config-directory}"/private/https-client-keystore.p12" key-password="jobscheduler" store-password="jobscheduler" } } } }
Show If | ||||
---|---|---|---|---|
| ||||
Risk MitigationThe explanations above describe use of a Root CA certificate Certificate for verification of Client Authentication certificates when it comes to mutual authentication.
|
Notes
- A restart of the relevant components is products is required to apply modifications to the Agent's
JS7_AGENT_CONFIG_DIR/private/private.conf
file and the Controller'sJS7_CONTROLLER_CONFIG_DIR/private/private.conf
file.
...
Resources
- JS7 - JOC Cockpit HTTPS Connections
- JS7 - Controller HTTPS Connections
- JS7 - Configuration Templates
- JS7 - How to create self-signed X.509 SSL TLS Certificates
- JS7 - How to add SSL TLS Certificates to Keystore and Truststore
...