for Mattermost

Generate a self-signed x509v3 certificate for use with multiple URLs / IPs.

Generate Certificates

Default values

CRT_CN="" CRT_SAN=",,IP.1:,IP.2:"

Custom values

You may change the CRT_CN and CRT_SAN values of the above command based on your needs.

Additionally you may use any of the following environment variables :

  • CRT_C : Country value
  • CRT_L : Locality value
  • CRT_O : Organization value
  • CRT_OU : Organizational Unit value
  • CRT_CN : Common Name value
  • CRT_SAN : SubjectAltName value


The command will generate two files:

  • pkcs#8 private key : mattermost-x509.key
  • x509v3 certificate : mattermost-x509.crt

You can confirm the certificate content by using the following standard x509 command:

openssl x509 -in mattermost-x509.crt -noout -text

Secure/Unsecure Certificates

The generated private key is passwordless by default.

You can secure/unsecure the certificates using standard pkcs8 commands:

# secure
openssl pkcs8 -in mattermost-x509.key -topk8 -v2 des3 -out

# unsecure
openssl pkcs8 -in -topk8 -nocrypt -out mattermost-x509.key

Additional Reading

Below are additional guides and documentation for optional reading:

Report a Problem
Edit on GitHub