Notification emails sent by GitLab can be signed with S/MIME for improved security.
This setting must be explicitly enabled and a single pair of key and certificate files must be provided:
- Both files must be PEM-encoded.
- The key file must be unencrypted so that GitLab can read it without user intervention.
- Only RSA keys are supported.
Optionally, you can also provide a bundle of CA certs (PEM-encoded) to be included on each signature. This will typically be an intermediate CA.
For Omnibus installations:
/etc/gitlab/gitlab.rband adapt the file paths:
gitlab_rails['gitlab_email_smime_enabled'] = true gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key' gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt' # Optional gitlab_rails['gitlab_email_smime_ca_certs_file'] = '/etc/gitlab/ssl/gitlab_smime_cas.crt'
Save the file and reconfigure GitLab for the changes to take effect.
For installations from source:
email_smime: # Uncomment and set to true if you need to enable email S/MIME signing (default: false) enabled: true # S/MIME private key file in PEM format, unencrypted # Default is '.gitlab_smime_key' relative to Rails.root (i.e. root of the GitLab app). key_file: /etc/pki/smime/private/gitlab.key # S/MIME public certificate key in PEM format, will be attached to signed messages # Default is '.gitlab_smime_cert' relative to Rails.root (i.e. root of the GitLab app). cert_file: /etc/pki/smime/certs/gitlab.crt # S/MIME extra CA public certificates in PEM format, will be attached to signed messages # Optional ca_certs_file: /etc/pki/smime/certs/gitlab_cas.crt
Save the file and restart GitLab for the changes to take effect.
Typically S/MIME certificates are handled in binary PKCS#12 format (
extensions), which contain the following in a single encrypted file:
- Public certificate
- Intermediate certificates (if any)
- Private key
In order to export the required files in PEM encoding from the PKCS#12 file,
openssl command can be used:
#-- Extract private key in PEM encoding (no password, unencrypted) $ openssl pkcs12 -in gitlab.p12 -nocerts -nodes -out gitlab.key #-- Extract certificates in PEM encoding (full certs chain including CA) $ openssl pkcs12 -in gitlab.p12 -nokeys -out gitlab.crt