Bug 44469 - univention-certificate should allow additional/custom subjectAltName
univention-certificate should allow additional/custom subjectAltName
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: SSL
UCS 4.3
Other Linux
: P5 enhancement with 2 votes (vote)
: UCS 4.3-2-errata
Assigned To: Jannik Ahlers
Philipp Hahn
:
: 44639 44960 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-25 19:29 CEST by Michael Grandjean
Modified: 2021-10-26 12:18 CEST (History)
12 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?: Yes
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2017083021000457
Bug group (optional): External feedback
Max CVSS v3 score:
grandjean: Patch_Available+


Attachments
Patch for make-certificate.sh (1.17 KB, patch)
2017-07-12 14:21 CEST, Timo Denissen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Grandjean univentionstaff 2017-04-25 19:29:15 CEST
univention-certificate uses the FQDN and the hostname for the "Subject Alternative Name" in certificates:

# grep "$HOSTNAME" "/etc/univention/ssl/$HOSTNAME/openssl.cnf"
CN      = ucs-7125.intranet.example.org
subjectAltName = DNS:ucs-7125.intranet.example.org, DNS:ucs-7125

But there are cases, where we want or need to add other DNS names to this field, e.g. a DNS Alias or an externally available DNS name.

Scenario:

1. We have a server called 
  cloud01.intranet.example.org with a DNS alias 
    cloud.intranet.example.org
→ the certificate should be valid for both FQDNs.

2. We have an internal server called
  webmail.intranet.example.org and we have an external DNS record for
           webmail.example.org
  The latter is now redirected via NAT to the internal system.
→ the certificate should be valid for both FQDNs.
Comment 1 Michael Grandjean univentionstaff 2017-04-25 19:29:51 CEST
Requested during technical training.
Comment 2 Timo Denissen univentionstaff 2017-07-12 14:21:08 CEST
Created attachment 9021 [details]
Patch for make-certificate.sh
Comment 3 Timo Denissen univentionstaff 2017-07-12 14:22:35 CEST
Attached is a patch to get all CNAMEs for a given FQDN from the LDAP to create a certificate with all CNAMEs as subjectAlternativeName.
Comment 4 Philipp Hahn univentionstaff 2017-07-18 10:47:33 CEST
*** Bug 44960 has been marked as a duplicate of this bug. ***
Comment 5 Christina Scheinig univentionstaff 2017-08-31 10:52:14 CEST
I think in my ticket this feature would prevent a lot of additional extra effort for the customer.
Comment 6 Jannik Ahlers univentionstaff 2018-10-01 13:55:47 CEST
Successful build
Package: univention-ssl
Version: 12.0.0-13A~4.3.0.201810011332
Branch: ucs_4.3-0
Scope: errata4.3-2

univention-ssl (12.0.0-13)
9063af544ba5 | Bug #44469: Merge branch 'jahlers/44469-san-certs' into 4.3-2
6383b62efe2e | Bug #44469: enable dns aliases in certificate creation

univention-ssl.yaml
2a1b51772588 | Bug #44469: yaml

I applied Timo's patch.
Also, since Bug #41013 cert names don't have to be unique anymore. I changed that creating a new cert now does not revoke any old certs of the dn.

When creating an alias record, a new cert will not be created automatically. I created a feature request for this: Bug #47886
Comment 7 Philipp Hahn univentionstaff 2018-10-04 12:40:14 CEST
OK: univention-ssl.yaml
OK: errata-announce -V --only univention-ssl.yaml

OK: apt install univention-ssl
OK 6383b62efe2e
OK: udm computers/memberserver create --position "cn=memberserver,cn=computers,$(ucr get ldap/base)" --set name=bug44469 --set password=univention --set network="$(udm networks/network list | sed -ne 's/^DN: //p;T;q')" --set dnsEntryZoneAlias="$(ucr get domainname) $(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q') bugzilla44469"
OK: openssl x509 -noout -text -in /etc/univention/ssl/bug44469/cert.pem | grep DNS:
OK: udm computers/memberserver modify --dn "cn=bug44469,cn=memberserver,cn=computers,$(ucr get ldap/base)" --append dnsEntryZoneAlias="$(ucr get domainname) $(udm dns/forward_zone list | sed -ne 's/^DN: //p;T;q') issue44469"

FAIL:
  udm dns/forward_zone create --position "cn=dns,$(ucr get ldap/base)" --set nameserver="$(hostname -f)" --set zone='pub.lic'
  udm computers/memberserver create --position "cn=memberserver,cn=computers,$(ucr get ldap/base)" --set name=other44469 --set password=univention --set network="$(udm networks/network list | sed -ne 's/^DN: //p;T;q')" --set dnsEntryZoneAlias="$(ucr get domainname) $(udm dns/forward_zone list --filter zoneName=pub.lic | sed -ne 's/^DN: //p;T;q') www"
  dig +nocomments +nocmd +nostats www.pub.lic. cname
  # www.pub.lic.            900     IN      CNAME other44469.phahn.qa.
    ^^^^^^^^^^^^
  openssl x509 -noout -text -in /etc/univention/ssl/other44469/cert.pem | grep DNS:
  # DNS:other44469.phahn.qa, DNS:other44469, DNS:www, DNS:www.phahn.qa
                                                          ^^^^^^^^^^^^
Comment 8 Jürn Brodersen univentionstaff 2018-10-30 11:20:14 CET
[4.3-2 fcaf06d47a] Bug #44469 SSL: Fix DNS alias lookup
[4.3-2 6594def99b] Bug #44469: YAML
Comment 9 Philipp Hahn univentionstaff 2018-10-30 12:08:56 CET
Package: univention-ssl
Version: 12.0.0-15A~4.3.0.201810301104
Branch: ucs_4.3-0
Scope: errata4.3-2

OK: apt-get install univention-ssl=12.0.0-15A~4.3.0.201810301104
OK: errata-announce univention-ssl.yaml
OK: univention-ssl.yaml 
OK: cname
OK: /var/log/univention/listener.log
OK: ./debian/rules override_dh_auto_test

TODO: Add ucs-test -> Janik
Comment 10 Arvid Requate univentionstaff 2018-11-01 13:44:07 CET
<http://errata.software-univention.de/ucs/4.3/297.html>
Comment 11 Jannik Ahlers univentionstaff 2018-11-09 11:57:05 CET
i added the test 101_ssl_cname_san, which tests SAN creation for the default DNS zone and another DNS zone.

Successful build
Package: ucs-test
Version: 8.0.28-222A~4.3.0.201811091144
Branch: ucs_4.3-0
Scope: errata4.3-2

baa93918a8de2ea1dd9f927eb40dd720acaea93a Bug #44469: Merge branch 'jahlers/44469-san-certs' into 4.3-2
7f4aee85aa093623c706bf9f659ac0afe9c5575f Bug #44469: add test 101_ssl_cname_san, translate comments to english
^^^^^
Ignore the 'translate comments to english', I forgot to fix the commit message.
Comment 12 Philipp Hahn univentionstaff 2019-09-12 09:01:43 CEST
*** Bug 44639 has been marked as a duplicate of this bug. ***