[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Erzeugung eines Zertifikats mit openssl: SubjectAltName erscheint nicht



Hi,
Waldemar Brodkorb wrote,

> Hallo Andre,
> Andre Tann wrote,
> 
> > Hallo zusammen,
> > 
> > für meinen Apache habe ich mir einen certificate request erzeugt,
> > welcher mehrere SubjectAltName enthält:
> > 
> > 
> > # openssl req -text -noout -in server-req.pem
> > […]
> >         Requested Extensions:
> >             X509v3 Basic Constraints: 
> >                 CA:FALSE
> >             X509v3 Key Usage: 
> >                 Digital Signature, Non Repudiation, Key Encipherment
> >             X509v3 Subject Alternative Name: 
> >                 DNS:example1.com, DNS:example2.com
> > […]
> > 
> > 
> > 
> > Nun habe ich das Problem, daß beim Erzeugen des Zertifikates die
> > SubjectAltNames nicht übernommen werden:
> > 
> > 
> > # openssl ca -out server-cert.pem -infiles server-req.pem
> > […]
> > Check that the request matches the signature
> > Signature ok
> > The subjectAltName field needed to be supplied and was missing
> > […]
> > 
> > 
> > 
> > Trotz längerer Googelei konnte ich keine Lösung dafür finden. Wie
> > kriege ich es also hin, daß im Zertifikat alle Werte übernommen werden,
> > die im Request in SubjectAltName notiert waren?
> > 
> > Danke für einen Tip!
> 
> Das Dokument ist zwar schon was älter, aber dort wurde eine Methode beschrieben:
> http://digilib.happy-security.de/files/ipsec_mit_openbsd_als_sichere_alternative.pdf
> 
> Für zwei oder mehr SubjectAltNames muss die x509v3.cnf im Anhang
> entsprechend editiert werden.
> 
> Aber die openssl Kommandos mit -extensions und so, sollten weiterhin
> gültig sein.

Beispiel:
$ cat x509v3.cnf 
CERTFQDN1 = nohost1.nodomain
CERTFQDN2 = nohost2.nodomain
[x509v3_FQDN2]
subjectAltName=DNS:$ENV::CERTFQDN1,DNS:$ENV::CERTFQDN2
$ openssl ca -extfile x509v3.cnf -extensions x509v3_FQDN2 -out server.crt -infiles server.csr 
Using configuration from /usr/lib/ssl/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 3 (0x3)
        Validity
            Not Before: Feb 22 14:35:06 2012 GMT
            Not After : Feb 21 14:35:06 2013 GMT
        Subject:
            countryName               = AU
            stateOrProvinceName       = Some-State
            organizationName          = Internet Widgits Pty Ltd
            commonName                = foo3.bar
        X509v3 extensions:
            X509v3 Subject Alternative Name: 
                DNS:nohost1.nodomain, DNS:nohost2.nodomain
Certificate is to be certified until Feb 21 14:35:06 2013 GMT (365
days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

$ openssl x509 -text -noout -in server.crt 
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 3 (0x3)
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
        Validity
            Not Before: Feb 22 14:35:06 2012 GMT
            Not After : Feb 21 14:35:06 2013 GMT
        Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd,
CN=foo3.bar
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (512 bit)
                Modulus (512 bit):
                    00:ca:8a:5a:b9:fd:d8:a6:7b:58:61:a4:94:3c:02:
                    e3:01:b2:08:1a:43:cb:15:05:1f:a0:a6:55:a7:33:
                    a8:46:cc:2f:d3:33:3e:43:f6:88:c3:c9:16:fa:bd:
                    02:b4:3d:4e:f5:1f:97:8d:84:42:cd:44:9a:d8:d8:
                    eb:bb:2a:63:cd
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Alternative Name: 
                DNS:nohost1.nodomain, DNS:nohost2.nodomain
    Signature Algorithm: sha1WithRSAEncryption
        3c:e2:95:26:fc:ef:2a:30:d7:5f:20:54:23:dd:b9:4e:5d:12:
        c6:2c:71:a5:e2:f9:74:7a:ef:14:68:cf:e5:f9:3d:36:4a:0e:
        54:bb:7b:67:f4:7c:e8:4d:9f:5f:14:1e:85:a4:dc:a0:8d:e3:
        a7:0c:e4:c4:d2:70:8b:0c:00:aa


Just for completeness.

have fun
        Waldemar

-- 
Linux Service & Support (Notdienst - Reparatur - Wartung)
Sie brauchen Hilfe bei Ihrem Linux-System? 
Besuchen Sie doch meine Webseite unter http://www.lss-nrw.de/

Attachment: signature.asc
Description: Digital signature


Reply to: