Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Run the following commands from a bash shell and replace the value of the SERVER server variable with the hostname or FQDN for which the certificate should be created:

Code Block
languagebash
titleCreate Server Certificate
linenumberstrue
# Specify server for which the certificate should be created
SERVERserver=somehost

# Step 1 - Generate Private Key and Certificate Signing Request
openssl req -new -config openssl-cert.config -extensions 'standard exts' -nodes \
    -days 7300 -newkey rsa:4096 -keyout ${SERVERserver}.key -out ${SERVERserver}.csr

# Step 2 - Generate and Sign the Server Certificate
openssl x509 -req \
    -in ${SERVERserver}.csr \
    -CA root-ca.crt \
    -CAkey root-ca.key \
    -CAcreateserial \
    -out ${SERVERserver}.crt -days 7300 \
    -extfile <(printf 'subjectAltName=DNS:%s\nnsCertType = client, server\nkeyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment\nextendedKeyUsage = serverAuth, clientAuth\n' "${SERVERserver}")


Explanation:

  • The following files will be created for the given server:
    • <SERVER><server>.key: the Private Key
    • <SERVER><server>.csr: the Certificate Signing Request
    • <SERVER><server>.crt: the Server Certificate
  • For operation with JS7 JOC Cockpit, Controller and Agents users can add
    • the Private Key and Server Certificate to a keystore.
    • the Root CA Certificate to a truststore.
  • For details see JS7 - How to add SSL TLS Certificates to Keystore and Truststore

In order to run the script successfully the following openssl-cert.config file has to be present. To create a server certificate Server Certificate the CommonName attribute has to be adjusted.

  • Download: openssl-cert.config
  • Replace the value of the commonName attribute with the hostname of the server for which the certificate should be created.
  • Adjust other attributes in the [ standard_dn ] section to your needs.

...

  • --dns
    • The DNS hostname of the server that should be assigned the certificate. A server can be assigned more than one DNS hostname, for example the FQDN can extend the hostname. Only DNS hostnames that are added to the certificate can be used later on to establish secure HTTPS connections.
  • --days
    • The lifetime of the certificate is specified by the number of days.

...