Problem: Provisioning Service Fails Due to Missing Subject Alternative Names in the SSL Certificate

Problem

The Nubus Provisioning Service may fail to establish a secure HTTPS connection to the UDM REST API because the SSL certificate of the UCS Primary Node does not contain the required Subject Alternative Name (SAN) extension.

In the affected environment, the components are distributed as follows:

  • UCS Primary Node: Hosts the Nubus Provisioning Service and the nubus-provisioning-udm-transformer container.

Following the upgrade, the nubus-provisioning-udm-transformer container on the Primary Node reports the following error:

univention.admin.rest.client.ConnectionError: HTTPSConnectionPool(host='hostname.univention.de', port=443): Max retries exceeded with url: /univention/udm//directory/unmap-ldap-attributes (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'hostname.univention.de'. (_ssl.c:1029)")))

The error indicates that the TLS client cannot validate the hostname against the certificate presented by the HTTPS endpoint.

An examination of the certificate using OpenSSL confirms that the certificate contains the correct Fully Qualified Domain Name (FQDN) in its Common Name (CN), but does not contain any SAN extensions.

Run the following command:

echo | openssl s_client -connect hostname.univention.de:443 -servername hostname.univention.de 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName

Output:

subject=C = DE, ST = DE, L = DE, O = univention IT, OU = Univention Corporate Server, CN = hostname.univention.de, emailAddress = ssl@univention.de
No extensions in certificate

Although the CN matches the requested hostname, modern Python-based TLS clients require the hostname to be represented in the certificate’s SAN extension. Consequently, certificate validation fails.


Root Cause

The affected HTTPS endpoint presents a certificate whose Common Name (CN) matches the requested hostname, but which does not contain a matching Subject Alternative Name (SAN). The TLS client rejects this certificate during hostname verification.

Two separate questions must be distinguished:

  1. Why does the existing certificate lack SAN entries?
  2. Why does the connection fail in the current deployment?

SAN generation is not a new UCS feature

The UCS source history shows that automatic inclusion of the FQDN in the SAN extension was implemented in September 2015:

  • Bug #38859: Always include the FQDN in the Subject Alternative Name when generating certificates.
  • Bug #38859: Add copy_extensions = copy to the CA configuration, including an upgrade adjustment for existing configurations.

The host-specific configuration is generated by mk_config, called by gencert in:
/usr/share/univention-ssl/make-certificates.sh

The standard generation path includes the FQDN, short hostname, and DNS aliases obtained from LDAP.

Existing certificate requests can preserve missing SAN entries

The distinction between certificate renewal and certificate generation is important:

  • univention-certificate renew re-signs the existing certificate signing request (req.pem). It does not regenerate the host-specific openssl.cnf or CSR.
  • univention-certificate new regenerates the configuration, private key, and CSR before signing the new certificate.

Consequently, a CSR without SAN entries can continue producing certificates without SAN entries through repeated renewals. A recent certificate issuance date does not prove that the CSR was regenerated.

Other possible contributors include externally supplied CSRs or custom certificate-extension handling through ssl/host/extensions. These possibilities require investigation on the affected system; they are not established causes for every occurrence.

Why the error may appear after an update

The TLS client verifies the certificate presented over HTTPS, not the server’s openssl.cnf.
A previously unnoticed certificate problem can become visible when a new component starts using the HTTPS endpoint, or when the client’s hostname-verification behavior changes.

The confirmed issue is the missing matching SAN in the presented certificate.
Newer containers, including affected versions of the Provisioning Service, require a matching Subject Alternative Name (SAN) in the server certificate.

On long-running UCS installations that may have been upgraded from UCS 3 through UCS 4 to UCS 5, the existing certificate request may predate automatic SAN generation. If certificates have only been renewed using univention-certificate renew, the original request continues to be reused without adding SAN entries.

Why certificates without SAN entries can persist

The current implementation distinguishes between generating a new certificate and renewing an existing one:

new
 └─ gencert
     ├─ Regenerate openssl.cnf, including SAN entries
     ├─ Generate a new private key
     ├─ Generate a new certificate request (req.pem)
     └─ Sign the request → cert.pem

renew
 └─ renew_cert
     └─ Re-sign the existing req.pem → cert.pem

Source: base/univention-ssl/make-certificates.sh:410–417,487–542

A certificate request without SAN entries can therefore remain in use for years through repeated renewals. A new expiration date does not mean that the certificate contents have been updated to reflect current certificate-generation defaults.


Investigation

1. Identifying the error

The nubus-provisioning-udm-transformer container on the UCS Primary Node encounters a connection error when accessing the UDM REST API.

The relevant error is:

SSLCertVerificationError: Hostname mismatch, certificate is not valid for 'hostname.univention.de'.

Although the issue occurs during OX Connector integration, the traceback identifies the HTTPS connection to the UDM REST API as the failing operation.

2. Analyzing the certificate configuration

The investigation revealed the following:

  • Symptom: The SSL certificate contains the correct FQDN in its Common Name but lacks the Subject Alternative Name extension.

  • Technical cause: The Python-based TLS client requires SAN entries for hostname verification. The certificate does not satisfy this requirement.

  • Background: The issue was observed after an upgrade from UCS 5.0. However, UCS already supported automatic SAN generation before that release. The upgrade timing alone does not establish why SAN entries are missing or which change exposed the certificate incompatibility.

RFC 6125 describes DNS-based service identity verification. Modern Python TLS implementations follow SAN-based hostname validation and no longer rely on CN fallback in the affected configuration.

3. Technical validation through source code analysis

An examination of the certificate generation script:

~/git/ucs/base/univention-ssl/make-certificates.sh

identified the following behavior:

  1. The file /etc/univention/ssl/<FQDN>/openssl.cnf is dynamically generated by the mk_config function.

  2. The gencert function collects the FQDN, short hostname, and DNS aliases from LDAP.

  3. These DNS identities are explicitly written into the [ v3_req ] section as subjectAltName entries.

  4. A standard certificate renewal operation can reuse the existing certificate request (req.pem ) and therefore retain missing SAN entries.

  5. Creating a new certificate using the new operation triggers certificate generation, recreates the OpenSSL configuration, and generates an updated certificate request.

Important: A simple renewal is not sufficient when the existing certificate request does not contain the required SAN entries. The certificate must be reissued using a newly generated request.

4. Validating the certificate generation process manually

For diagnostic or testing purposes, the certificate generation script can be loaded into the current shell and its functions invoked directly.

The script acts as a library of functions. Sourcing it does not automatically execute the certificate generation process.

First, load the script:

source /usr/share/univention-ssl/make-certificates.sh

Then explicitly invoke the gencert function with the certificate directory name, Common Name, and validity period:

gencert "ucs5primary.deadpool.intranet" "ucs5primary.deadpool.intranet" 1825

The following output was obtained on the test system:

root@ucs5primary:~# source /usr/share/univention-ssl/make-certificates.sh
root@ucs5primary:~# gencert "ucs5primary.deadpool.intranet" "ucs5primary.deadpool.intranet" 1825
Using configuration from /etc/univention/ssl/openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'US'
stateOrProvinceName   :PRINTABLE:'US'
localityName          :PRINTABLE:'US'
organizationName      :PRINTABLE:'deadpool'
organizationalUnitName:PRINTABLE:'Univention Corporate Server'
commonName            :PRINTABLE:'ucs5primary.deadpool.intranet'
emailAddress          :IA5STRING:'ssl@deadpool.intranet'
Certificate is to be certified until Nov  2 09:42:16 2031 GMT (1825 days)

Write out database with 1 new entries

After generating the certificate, inspect the OpenSSL configuration:

grep subjectAltName /etc/univention/ssl/ucs5primary.deadpool.intranet/openssl.cnf

Output:

root@ucs5primary:~# grep subjectAltName /etc/univention/ssl/ucs5primary.deadpool.intranet/openssl.cnf
# subjectAltName          = email:copy
subjectAltName = DNS:e715d5a1-c0c5-4754-81c3-7dfe896e95b1._msdcs.deadpool.intranet, DNS:ucs5primary.deadpool.intranet, DNS:e715d5a1-c0c5-4754-81c3-7dfe896e95b1._msdcs, DNS:ucs5primary
subjectAltName          = email:copy

The generated configuration now contains SAN entries for the Primary Node’s FQDN, short hostname, and additional DNS identities obtained from the system configuration.

This confirms that the certificate generation logic can create SAN-aware configurations.

Caution: Manually invoking gencert is an advanced diagnostic procedure that can generate and sign a new certificate. It should not be used as the standard remediation method on a production UCS Primary Node. The supported certificate management command should be preferred.


Solution

To resolve the issue, the UCS Primary Node’s host certificate must be reissued with the required SAN entries.

The certificate must be generated using the existing UCS Root Certificate Authority (CA). Replacing or regenerating the Root CA is not necessary.

Because the affected system is a UCS Primary Node, certificate replacement should be performed during a maintenance window. Services using the host certificate may require a restart, and existing TLS connections may be interrupted.

1. Generate a new host certificate

Before modifying the certificate, create a backup of the existing certificate directory and verify that the UCS Root CA is available.

Run the following command on the UCS Primary Node:

univention-certificate new -name hostname.univention.de

This operation is intended to:

  1. Regenerate the host-specific openssl.cnf configuration.

  2. Collect the configured hostnames and DNS aliases.

  3. Generate a new certificate signing request (CSR) containing the SAN entries.

  4. Sign the new host certificate using the existing UCS Root CA.

Unlike a simple certificate renewal, this process creates a new certificate request instead of reusing the legacy request.

2. Verify the Subject Alternative Name entries

After generating the new certificate, verify whether the SAN extension is present.

Execute:

echo | openssl s_client -connect hostname.univention.de:443 -servername hostname.univention.de 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName

Expected result:

X509v3 Subject Alternative Name:
    DNS:hostname.univention.de, DNS:hostname

Additional DNS aliases may also be present.

Alternatively, inspect the generated OpenSSL configuration directly:

grep subjectAltName /etc/univention/ssl/FQDN/openssl.cnf

Replace FQDN with the actual Fully Qualified Domain Name of the Primary Node.

Important: The OpenSSL configuration and the certificate served over HTTPS must be checked separately. A correctly generated openssl.cnf does not necessarily mean that Apache or another HTTPS service has already loaded the new certificate.

3. Check existing certificates and revoke the previous certificate if necessary

When generating a new certificate, the previous certificate may remain registered in the UCS certificate database.

List all certificates, including expired and revoked certificates:

univention-certificate list-all

Output from the test system:

root@ucs5primary:~# univention-certificate list-all
List all certificates (including revoked and expired certificates)
01      ucs5primary.deadpool.intranet (V)
02      ucs-sso-ng.deadpool.intranet (V)
03      ucs5backup.deadpool.intranet (V)
04      ucs5replica.deadpool.intranet (V)
05      Bremen.deadpool.intranet (V)
06      ucssc-02264754.deadpool.intranet (V)
07      ox-co-63157496.deadpool.intranet (V)
08      keycl-76654153.deadpool.intranet (R)
09      keycl-69593794.deadpool.intranet (V)
0A      e915.deadpool.intranet (V)
0B      e999.deadpool.intranet (V)
0C      e134.deadpool.intranet (V)
0D      e131.deadpool.intranet (V)
0E      e569.deadpool.intranet (V)
0F      provi-26776824.deadpool.intranet (V)
10      ucssc-28908346.deadpool.intranet (V)
11      ucssc-45566624.deadpool.intranet (V)
12      nextc-64639545.deadpool.intranet (V)
13      ucs5primary.deadpool.intranet (V)

In this example, two certificates exist for ucs5primary.deadpool.intranet :

  • Certificate 01 : The present certificate.

  • Certificate 13 : The newly generated certificate.

Inspect both certificates to determine their validity periods.

Original certificate:

univention-certificate dump -id 01 | grep -P 'Suject:|Not'

Output:

root@ucs5primary:~# univention-certificate dump -id 01 | grep -P 'Suject:|Not'
            Not Before: Jun  5 14:25:36 2026 GMT
            Not After : Jun  4 14:25:36 2031 GMT

New certificate:

univention-certificate dump -id 13 | grep -P 'Suject:|Not'

Output:

root@ucs5primary:~# univention-certificate dump -id 13 | grep -P 'Suject:|Not'
            Not Before: Nov  3 09:42:16 2026 GMT
            Not After : Nov  2 09:42:16 2031 GMT

The validity periods confirm that certificate 13 was generated after certificate 01 .

Note that the original command contains the spelling Suject instead of Subject . Therefore, the output only shows the validity fields matching Not .

The present certificate have to be revoked, because otherwise the system could get some other certificate issues.

Before revoking it, ensure that the newly generated certificate has been deployed successfully and that no services or clients still depend on the previous certificate.

Revoke the original certificate:

univention-certificate revoke -id 01

Output:

root@ucs5primary:~# univention-certificate revoke -id 01
Revoke certificates: ucs5primary.deadpool.intranet
Using configuration from /etc/univention/ssl/openssl.cnf
Revoking Certificate 01.
Database updated
Using configuration from /etc/univention/ssl/openssl.cnf

The old certificate is now marked as revoked in the UCS certificate database.

Important: Certificate IDs are specific to each UCS installation. Verify the correct certificate ID before executing the revocation command. Revoking a certificate that is still in use may cause TLS connection failures.

For additional information, see the Univention documentation:

Renewing the SSL/TLS certificates – Revoke old certificates

4. Restart the affected services

After generating and deploying the new certificate, restart the relevant services so that they use the updated certificate.

Restart the Nubus Provisioning UDM Transformer:

univention-app restart nubus-provisioning-udm-transformer

Restart the Univention Management Console server:

systemctl restart univention-management-console-server.service

Restart Apache:

systemctl restart apache2.service

The original troubleshooting instructions contained apachae2.service ; the correct systemd service name is apache2.service .

Depending on the installed Nubus Provisioning version and its deployment method, the transformer may be managed as part of a larger application stack. Verify that the application restart command is supported by the installed version.

5. Verify the resolution

After restarting the services, repeat the certificate inspection:

echo | openssl s_client -connect hostname.univention.de:443 -servername hostname.univention.de 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName

Confirm that the certificate presented over HTTPS contains the correct SAN entries.

Then inspect the logs of the nubus-provisioning-udm-transformer container.

The following error should no longer occur:

SSLCertVerificationError: Hostname mismatch, certificate is not valid for 'hostname.univention.de'.

Finally, verify that the Provisioning Service can communicate successfully with the UDM REST API and that the OX Connector on the Backup Node processes provisioning events as expected.

If the certificate error persists, verify that the HTTPS endpoint actually presents the newly generated certificate, that the requested hostname is included in its SAN extension, and that the container trusts the issuing CA.