Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
admin:tasks:zertifikat [2019-01-14 13:30] mga |
admin:tasks:zertifikat [2019-03-27 11:51] (aktuell) mga |
||
---|---|---|---|
Zeile 3: | Zeile 3: | ||
Das Rechenzentrum kann Zitate ausstellen, die gegen die DFN-CA signiert sind und daher bspw. von Browsern ohne Nachfrage akzeptiert werden. Anschprechpartner ist [[schwarz@rz.uni-kiel.de|Ulrich Schwarz]]. | Das Rechenzentrum kann Zitate ausstellen, die gegen die DFN-CA signiert sind und daher bspw. von Browsern ohne Nachfrage akzeptiert werden. Anschprechpartner ist [[schwarz@rz.uni-kiel.de|Ulrich Schwarz]]. | ||
- | * Key erzeugen (http://www.openssl.org/docs/HOWTO/keys.txt) **und gut aufbewahren!!** | + | ====== Zertifikatsantrag (.csr) erstellen ====== |
- | openssl genrsa -out privkey.pem 2048 | + | Folgende OpenSSL Konfiguration erstellen (als ''openssl-web.cnf''): |
- | * Zertifikats-Request erzeugen (http://www.openssl.org/docs/HOWTO/certificates.txt) | + | <file> |
+ | # OpenSSL configuration. | ||
+ | # | ||
+ | HOME = <PUT-YOUR-LOCAL-PATH-HERE> | ||
+ | RANDFILE = <PUT-YOUR-LOCAL-PATH-HERE>/.rnd | ||
- | openssl req -new -key belair-ldap.pem -out belair-ldap.csr -subj '/C=DE/ST=Schleswig-Holstein/L=Kiel/O=Universitaet Kiel/OU=Institut fuer Informatik/CN=belair.informatik.uni-kiel.de' | + | [ ca ] |
+ | default_ca = CA_default | ||
- | * Die DN muss lauten: CN=rechnername.informatik.uni-kiel.de,OU=Institut fuer Informatik,O=Universitaet Kiel,L=Kiel,ST=Schleswig-Holstein,C=DE | + | [ CA_default ] |
- | * [[https://pki.pca.dfn.de/uni-kiel-ca/cgi-bin/pub/pki?cmd=pkcs10_req;id=1;menu_item=2&RA_ID=0|Zertifikat beantragen]] und Antrag von Herrn Hanus unterschreiben lassen | + | dir = /home/_admin_/ssl/ssl_spd.ltsh.de |
- | * Mit dem Antrag zu Klaus Nielsen und das Zertifikat beglaubigen lassen | + | serial = $dir/serial |
- | * Das per Mail zugesandte Zertifikat installieren. | + | database = $dir/index.txt |
+ | new_certs_dir = $dir/newcerts | ||
+ | certs = $dir/certs | ||
+ | certificate = $certs/cacert.pem | ||
+ | private_key = $dir/private/cakey.pem | ||
+ | default_days = 365 | ||
+ | default_md = md5 | ||
+ | preserve = no | ||
+ | email_in_dn = no | ||
+ | nameopt = default_ca | ||
+ | certopt = default_ca | ||
+ | policy = policy_match | ||
+ | copy_extensions = copy | ||
- | * Eventuell müssen die Stammzertifikate von Telekom und DFN noch installiert werden. Dafür müssen sie vom crt- ins pem-Format konvertiert werden, das kann openssl: | + | [ policy_match ] |
+ | countryName = match | ||
+ | stateOrProvinceName = match | ||
+ | organizationName = match | ||
+ | organizationalUnitName = optional | ||
+ | commonName = supplied | ||
+ | emailAddress = optional | ||
- | openssl x509 (?) -in XY.crt -inform ??? -out XY.pem -outform pem | + | [ req ] |
- | + | default_bits = 4096 # Size of keys | |
+ | default_keyfile = key.pem # name of generated keys | ||
+ | default_md = sha256 # message digest algorithm | ||
+ | string_mask = nombstr # permitted characters | ||
+ | distinguished_name = req_distinguished_name | ||
+ | req_extensions = v3_req | ||
+ | x509_extensions = v3_req | ||
- | * Dann die Stammzertifikate nach /etc/ssl/certs kopieren und wieder c_rehash aufrufen. | + | [ req_distinguished_name ] |
+ | # Variable name Prompt string | ||
+ | #---------------------- ---------------------------------- | ||
+ | 0.organizationName = Organization Name (company) | ||
+ | organizationalUnitName = Organizational Unit Name (department, division) | ||
+ | emailAddress = Email Address | ||
+ | emailAddress_max = 40 | ||
+ | localityName = Locality Name (city, district) | ||
+ | stateOrProvinceName = State or Province Name (full name) | ||
+ | countryName = Country Name (2 letter code) | ||
+ | countryName_min = 2 | ||
+ | countryName_max = 2 | ||
+ | commonName = Common Name (hostname, IP, or your name) | ||
+ | commonName_max = 64 | ||
- | ====== Erstellen eines selbstsignierten Zertifikates ====== | + | # Default values for the above, for consistency and less typing. |
- | * Gute Anleitung: http://www.tc.umn.edu/~brams006/selfsign.html | + | # Variable name Value |
- | * Auf belair ist eine testca eingerichtet (/etc/ldap/ssl/testca) | + | #------------------------------ ------------------------------ |
- | * belairs slapd läuft mit einem gegen diese CA zertifizierten Zertifikat | + | 0.organizationName_default = Christian-Albrechts-Universitaet zu Kiel |
- | * Das CA-Zertifikat muss auf die Lehrstuhlrechner nach /etc/ssl/certs kopiert werden, anschließend muss die Hashliste aktualisiert werden: | + | localityName_default = Kiel |
+ | stateOrProvinceName_default = Schleswig-Holstein | ||
+ | countryName_default = DE | ||
+ | commonName_default = <host>.informatik.uni-kiel.de | ||
+ | emailAddress_default = ps-admin@informatik.uni-kiel.de | ||
+ | organizationalUnitName_default = Computer Science Institute | ||
- | c_rehash | + | [ v3_ca ] |
+ | basicConstraints = CA:TRUE | ||
+ | subjectKeyIdentifier = hash | ||
+ | authorityKeyIdentifier = keyid:always,issuer:always | ||
- | * Damit die ldap-utils das Zertifikat auch verwenden, in /etc/ldap.conf folgende Zeilen eintragen: | + | [ v3_req ] |
+ | # Extensions to add to a certificate request | ||
+ | basicConstraints = CA:FALSE | ||
+ | keyUsage = nonRepudiation, digitalSignature, keyEncipherment, keyEncipherment, dataEncipherment, keyAgreement | ||
- | BASE dc=ps,dc=informatik,dc=uni-kiel,dc=de | + | # Some CAs do not yet support subjectAltName in CSRs. |
- | TLS_CACERTDIR /etc/ssl/certs | + | # Instead the additional names are form entries on web |
+ | # pages where one requests the certificate... | ||
+ | subjectAltName = @alt_names | ||
+ | |||
+ | |||
+ | [alt_names] | ||
+ | |||
+ | ### SARASVATI: ILEARN | ||
+ | DNS.1 = sarasvati.informatik.uni-kiel.de | ||
+ | DNS.2 = ilearn.informatik.uni-kiel.de | ||
+ | |||
+ | ### LYNCH: JENKINS | ||
+ | #DNS.1 = lynch.informatik.uni-kiel.de | ||
+ | #DNS.2 = jenkins.ps.informatik.uni-kiel.de | ||
+ | |||
+ | ### ISSAN: GIT-PS | ||
+ | #DNS.1 = issan.informatik.uni-kiel.de | ||
+ | #DNS.2 = git-ps.informatik.uni-kiel.de | ||
+ | #DNS.3 = git.ps.informatik.uni-kiel.de | ||
+ | |||
+ | ### GISCOURS: WWW-PS | ||
+ | #DNS.1 = giscours.informatik.uni-kiel.de | ||
+ | #DNS.2 = www-ps.informatik.uni-kiel.de | ||
+ | #DNS.3 = www.ps.informatik.uni-kiel.de | ||
+ | #DNS.4 = wiki.ps.informatik.uni-kiel.de | ||
+ | #DNS.5 = ilearn.ps.informatik.uni-kiel.de | ||
+ | #DNS.6 = owncloud.ps.informatik.uni-kiel.de | ||
+ | #DNS.7 = errbit.ps.informatik.uni-kiel.de | ||
+ | #DNS.8 = redmine.ps.informatik.uni-kiel.de | ||
+ | #DNS.9 = mdb.ps.informatik.uni-kiel.de | ||
+ | #DNS.10 = packages.ps.informatik.uni-kiel.de | ||
+ | |||
+ | ### MEDOC | ||
+ | #DNS.1 = medoc.informatik.uni-kiel.de | ||
+ | #DNS.2 = ldap.ps.informatik.uni-kiel.de | ||
+ | #DNS.3 = broker.ps.informatik.uni-kiel.de | ||
+ | #DNS.4 = master.ps.informatik.uni-kiel.de | ||
+ | |||
+ | ### PESSAC | ||
+ | #DNS.1 = pessac.informatik.uni-kiel.de | ||
+ | #DNS.2 = mitarbeiter.ps.informatik.uni-kiel.de | ||
+ | |||
+ | ### CHEVALBLANC | ||
+ | #DNS.1 = chevalblanc.informatik.uni-kiel.de | ||
+ | #DNS.2 = jenkins.ps.informatik.uni-kiel.de | ||
+ | |||
+ | ### HEPHEISTOS | ||
+ | #DNS.1 = hepheistos.informatik.uni-kiel.de | ||
+ | #DNS.2 = urlaub.informatik.uni-kiel.de | ||
+ | |||
+ | [ server ] | ||
+ | # Make a cert with nsCertType set to "server" | ||
+ | basicConstraints=CA:FALSE | ||
+ | nsCertType = server | ||
+ | nsComment = "OpenSSL Generated Server Certificate" | ||
+ | subjectKeyIdentifier=hash | ||
+ | authorityKeyIdentifier=keyid,issuer:always | ||
+ | |||
+ | [ client ] | ||
+ | # Make a cert with nsCertType set to "client" | ||
+ | basicConstraints=CA:FALSE | ||
+ | nsCertType = client | ||
+ | nsComment = "OpenSSL Generated Client Certificate" | ||
+ | subjectKeyIdentifier=hash | ||
+ | authorityKeyIdentifier=keyid,issuer:always | ||
+ | </file> | ||
+ | |||
+ | Im selben Ordner, das Skript ''web_reqcert.sh'' anlegen und ausführbar machen: | ||
+ | |||
+ | <file> | ||
+ | #!/bin/bash | ||
+ | |||
+ | if [ -z "$1" ]; then | ||
+ | echo "usage: $(basename $0) <fqdn>" | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | FQDN="$1" | ||
+ | FQDNunderscores=$(echo $FQDN | sed 's/\./_/g') | ||
+ | |||
+ | base="$(pwd)" | ||
+ | |||
+ | test -d "$base/private" || mkdir -p "$base/private" | ||
+ | |||
+ | if [ -f "$base/private/${FQDNunderscores}.key" ]; then | ||
+ | openssl req -config "$base/openssl-web.cnf" \ | ||
+ | -nodes -new \ | ||
+ | -key "$base/private/${FQDNunderscores}.key" \ | ||
+ | -out "$base/${FQDNunderscores}.csr" | ||
+ | else | ||
+ | openssl req -config "$base/openssl-web.cnf" \ | ||
+ | -nodes -new \ | ||
+ | -keyout "$base/private/${FQDNunderscores}.key" \ | ||
+ | -out "$base/${FQDNunderscores}.csr" | ||
+ | fi | ||
+ | </file> | ||
+ | |||
+ | Das Skript ausführen: | ||
+ | |||
+ | <file> | ||
+ | $ ./web_certreq <fqdn> | ||
+ | </file> | ||
+ | |||
+ | Die folgenden Fragen alle bestätigen. Achtung: bei "Common Name" den <fqdn> des Servers von Hand eingeben: | ||
+ | |||
+ | <file> | ||
+ | You are about to be asked to enter information that will be incorporated | ||
+ | into your certificate request. | ||
+ | What you are about to enter is what is called a Distinguished Name or a DN. | ||
+ | There are quite a few fields but you can leave some blank | ||
+ | For some fields there will be a default value, | ||
+ | If you enter '.', the field will be left blank. | ||
+ | ----- | ||
+ | Organization Name (company) [Christian-Albrechts-Universitaet zu Kiel]: | ||
+ | Organizational Unit Name (department, division) [Computer Science Institute]: | ||
+ | Email Address [ps-admin@informatik.uni-kiel.de]: | ||
+ | Locality Name (city, district) [Kiel]: | ||
+ | State or Province Name (full name) [Schleswig-Holstein]: | ||
+ | Country Name (2 letter code) [DE]: | ||
+ | Common Name (hostname, IP, or your name) [<host>.informatik.uni-kiel.de]:<fqdn> | ||
+ | </file> | ||
+ | |||
+ | Den entstehenden Key ''./private/<fqdn>.key'' gut aufbewahren (bzw. auf den Webserver kopieren). Der Key wird sich bei Verlängerungsanträgen nicht mehr ändern. Die Datei muss vorm Zugriff dritter geschützt werden. | ||
+ | |||
+ | Die entstehende ''<fqdn>.csr'' Datei (Certificate Signing Request) wird im folgenden Schritt benötigt. | ||
+ | |||
+ | ====== Zertifikatsantrag (.csr) beim DfN hochladen ====== | ||
+ | |||
+ | * Der Anleitung des CAU-RZ folgen: https://www.rz.uni-kiel.de/de/angebote/pki/serverzertifikate-erstellen-und-installieren | ||
+ | * Zertifikatsantrag (.csr) beim DFN Hochladen: https://pki.pca.dfn.de/dfn-ca-global-g2/cgi-bin/pub/pki?cmd=getStaticPage&name=index&RA_ID=4540 | ||
+ | - Klick auf Server-Zertifikat | ||
+ | - Die ''<fqdn>.csr'' Datei auswählen im Feld ''PKCS#10-Zertifikatantrag (PEM-formatierte Datei)'' | ||
+ | - Zertifikatprofil: Webserver | ||
+ | - unter "Weitere Angaben" alles ausfüllen wir im Formular beschrieben | ||
+ | - die PIN notieren in der Datei ''<fqdn>.PIN'' (im gleichen Ordner wie die ''.csr'' Datei) | ||
+ | - Klick auf Button [ Weiter ] | ||
+ | * Zertifikatsantragsformular nochmals prüfen und dann bestätigen | ||
+ | * Zertifikatsantrag anzeigen. Ein PDF öffnet sich. Speichern und drucken. | ||
+ | * Gedrucktes PDF unterschreiben und in die Hauspost an Ulrich Schwarz. | ||
+ | |||
+ | ====== Warten ====== | ||
+ | |||
+ | Nach einigen Tagen erhält man das signierte Zertifikat per e-Mail an die Dienst-Adresse, die beim Zertifikatsantrag verwendet wird. | ||
+ | |||
+ | |||
+ | ====== Zertifikat ausrollen ====== | ||
+ | |||
+ | Das Zertifikat (.crt) muss dann auf dem Ziel-Server hinterlegt werden. Handelt es sich um eine Zertifikatsverlängerung, muss nur das neue Zertifikat ausgerollt werden. Handelt es sich um einen Neuantrag, dann muss Zertifikat und Key ausgerollt werden. | ||
+ | |||
+ | Der Installationsort liegt in der Arbeitsgruppe normalerweise unter /etc/<service>/ssl/. Die Key Datei muss mit Rechten ''0600'' ausgerollt werden. Das Zertifikat darf lesbar bleiben. | ||
+ | |||
+ | Achtung: da DFN-Zertifikate nicht direkt gegen ein Stammzertifikat signiert wurden, sondern gegen Intermediärzertifikate, muss man die Zertifikatskette an das Server-Zertifikat innerhalb der .crt Datei anhängen. Vergleiche: https://pki.pca.dfn.de/dfn-ca-global-g2/cgi-bin/pub/pki?cmd=getStaticPage;name=index;id=2&RA_ID=4540 (Klick auf "Zertifikatskette anzeigen"). | ||
+ | |||
+ | |||
+ | ====== Zertifikat verlängern ====== | ||
+ | |||
+ | Das DFN erinnert per Mail an Zertifikate, die zeitnah verlängert werden müssen. |