Benutzer-Werkzeuge

Webseiten-Werkzeuge


lx:ucs:ca

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
lx:ucs:ca [02.04.2025 17:14] – [CodeSigning] Andy Haubenschmidlx:ucs:ca [25.07.2026 22:13] (aktuell) – berechnung der Tage in eine Variable schreiben Andy Haubenschmid
Zeile 10: Zeile 10:
  
 ===== neues Server Zertifikat erstellen ===== ===== neues Server Zertifikat erstellen =====
 +Ausrechnen wie lange das Zertifikat laufen darf, am besten das Ablaufdatum der CA verwenden.
 <code> <code>
 echo \(`date -d 18-Oct-2027 +'%s'` - `date +'%s'`\) /86400 |bc echo \(`date -d 18-Oct-2027 +'%s'` - `date +'%s'`\) /86400 |bc
-. /usr/share/univention-ssl/make-certificates.sh+
 declare -x ServerName=FQHN declare -x ServerName=FQHN
-univention-certificate new -name "${ServerName}" -days 1825+declare -x days=$(echo \(`date -d 18-Oct-2027 +'%s'` - `date +'%s'`\) /86400 |bc) 
 +</code> 
 +Somit sind die Anzahl Tage und der Servername in Variablen gespeichert und können im folgenden benutzt werden. 
 +<code> 
 +. /usr/share/univention-ssl/make-certificates.sh 
 +univention-certificate new -name "${ServerName}" -days $days
 cd /etc/univention/ssl/${ServerName} cd /etc/univention/ssl/${ServerName}
 nano openssl.cnf nano openssl.cnf
Zeile 25: Zeile 31:
 openssl req -new -key private.key -config openssl.cnf -out req.pem openssl req -new -key private.key -config openssl.cnf -out req.pem
 openssl req -in req.pem -noout -text | grep -E "(Subject Alternative Name|DNS)" openssl req -in req.pem -noout -text | grep -E "(Subject Alternative Name|DNS)"
-univention-certificate renew -name ${ServerName} -days 1825+univention-certificate renew -name ${ServerName} -days $days
 </code> </code>
 +
 +das ganze kann dann in eine pkcs12 Datei verpackt werden, damit sie z.B. unter Windows importiert werden kann:
 +<code>
 +openssl pkcs12 -export -out /root/${ServerName}.p12 \
 +-in /etc/univention/ssl/${ServerName}/cert.pem \
 +-inkey /etc/univention/ssl/${ServerName}/private.key \
 +-passout pass:EinSehrSicheresPasswort
 +</code>
 +
 Zertifikatsfingerabdruck auslesen und auf dem Terminalserver via  Zertifikatsfingerabdruck auslesen und auf dem Terminalserver via 
 ''wmic /namespace:rootcimv2TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="Fingerabdruck"'' das Zertifikat für RDP verwenden. ''wmic /namespace:rootcimv2TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="Fingerabdruck"'' das Zertifikat für RDP verwenden.
Zeile 72: Zeile 87:
  
 To generate a CodeSigning Cert with the Univention CA, follow these steps: To generate a CodeSigning Cert with the Univention CA, follow these steps:
-  - create a new cert by +  - create a new cert by using univention-certificate new, use a name you recognize as CS Cert 
 +  - create a special extension file 
 +  - generate the cert again manually by the CA with the extension 
 +  - use this cert for signing 
 + 
 +<code> 
 +declare -x CertName=CodeSign-YourName 
 +declare -x ExportPassword=SuperSecurePasswordForP12File 
 +declare -x days=$(echo \(`date -d 18-Oct-2027 +'%s'` - `date +'%s'`\) /86400 |bc) 
 + 
 +. /usr/share/univention-ssl/make-certificates.sh 
 +univention-certificate new -name "${CertName}" -days ${days} 
 +cd /etc/univention/ssl/${CertName} 
 + 
 +echo " 
 +authorityKeyIdentifier = keyid,issuer 
 +basicConstraints       = CA:FALSE 
 +subjectAltName         = @alt_names 
 +extendedKeyUsage       = codeSigning 
 +[alt_names] 
 +DNS.1 = ${CertName} 
 +" > code_sign_cert.conf 
 + 
 +grep output_password /etc/univention/ssl/openssl.cnf 
 +openssl x509 -req -CA ../ucsCA/CAcert.pem -CAkey ../ucsCA/private/CAkey.pem -in req.pem -out cert.pem -days ${days} -CAcreateserial -extfile code_sign_cert.conf  
 + 
 +openssl pkcs12 -export -out /root/${CertName}.p12 -in cert.pem -inkey private.key -passout pass:${ExportPassword} 
 +</code> 
 + 
 +created with thanks to the infos found here: [[https://stackoverflow.com/questions/72207572/how-to-create-a-self-signed-code-signing-certificate-from-a-csr]]
lx/ucs/ca.1743614090.txt.gz · Zuletzt geändert: von Andy Haubenschmid