Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung |
easyrsa [07/08/2023 - 11:48] – thommie4 | easyrsa [05/03/2024 - 10:52] (aktuell) – Externe Bearbeitung 127.0.0.1 |
---|
Quelle: [[https://github.com/OpenVPN/easy-rsa|https://github.com/OpenVPN/easy-rsa]] | Quelle: [[https://github.com/OpenVPN/easy-rsa|https://github.com/OpenVPN/easy-rsa]] |
| |
EasyTLS Erweiterung: [[https://github.com/TinCanTech/easy-tls]] | EasyTLS Erweiterung: [[https://github.com/TinCanTech/easy-tls|https://github.com/TinCanTech/easy-tls]] |
| |
===== CA einrichten ===== | ===== CA einrichten ===== |
| |
''./easyrsa gen-req EntityName nopass '' | ''./easyrsa gen-req EntityName nopass '' |
===== Signieren (client oder server) ===== | ===== Importieren ===== |
| |
''./easyrsa sign-req client EntityName '''' '' \\ | |
''./easyrsa sign-req server EntityName '' | |
===== Zertifikats Inhalt anzeigen ===== | |
| |
''./easyrsa show-req EntityName '' | |
| |
''./easyrsa show-cert EntityName '' | |
| |
Alternativ direkt mit openssl<code> | |
# Zertifikat komplett anzeigen | |
openssl x509 -text -in <zertifikatsname.crt> | |
| |
# Komplette Anzeige ohne Zertifiaktstext anzeigen | |
openssl x509 -noout -text -in <zertifikatsname.crt> | |
| |
# den Herausgeber des Zertifikats anzeigen | |
openssl x509 -noout -issuer -in <zertifikatsname.crt> | |
| |
# Für wen wurde das Zertifikat ausgestellt? | |
openssl x509 -noout -subject -in <zertifikatsname.crt> | |
| |
# Für welchen Zeitraum ist das Zertifikat gültig? | |
openssl x509 -noout -dates -in <zertifikatsname.crt> | |
| |
# das obige kombiniert anzeigen | |
openssl x509 -noout -issuer -subject -dates -in <zertifikatsname.crt> | |
| |
# den hash anzeigen | |
openssl x509 -noout -hash -in <zertifikatsname.crt> | |
| |
# den MD5-Fingerprint anzeigen | |
openssl x509 -noout -fingerprint -in <zertifikatsname.crt> | |
</code> | |
| |
Key Passwörter ändern | |
| |
''./easyrsa set-rsa-pass EntityName '' | |
| |
''./easyrsa set-ec-pass EntityName '' | |
| |
Mit "nopass" wird ein Passwort entfernt | |
| |
**CSR** | |
| |
''openssl req -in www2.netzwissen.de.csr -text -noout '' | |
| |
**Zertifikat** | |
| |
''openssl x509 -in certificate.crt -text -noout '' | |
===== Zertifikat zurückziehen ===== | |
<code> | <code> |
./easyrsa revoke EntityName | |
</code> | |
| |
CRL erzeugen | ''./easyrsa import-req /path/to /request .req nameOfRequest'' |
| |
<code> | |
./easyrsa gen-crl | |
</code> | </code> |
| |
Achtung: Die CRL sollte **alle sechs Monate** neu erzeugt und auf den openvpn Server übertragen werden. Die genauen Daten stehen in der CRL Datei: | ===== Signieren (client oder server) ===== |
| |
<code> | ''./easyrsa sign-req client EntityName ./easyrsa sign-req server EntityName ===== Zertifikats Inhalt anzeigen ===== ''./easyrsa show-req EntityName./easyrsa show-cert EntityName Alternativ direkt mit openssl # Zertifikat komplett anzeigen openssl x509 -text -in <zertifikatsname.crt> # Komplette Anzeige ohne Zertifiaktstext anzeigen openssl x509 -noout -text -in <zertifikatsname.crt> # den Herausgeber des Zertifikats anzeigen openssl x509 -noout -issuer -in <zertifikatsname.crt> # Für wen wurde das Zertifikat ausgestellt? openssl x509 -noout -subject -in <zertifikatsname.crt> # Für welchen Zeitraum ist das Zertifikat gültig? openssl x509 -noout -dates -in <zertifikatsname.crt> # das obige kombiniert anzeigen openssl x509 -noout -issuer -subject -dates -in <zertifikatsname.crt> # den hash anzeigen openssl x509 -noout -hash -in <zertifikatsname.crt> # den MD5-Fingerprint anzeigen openssl x509 -noout -fingerprint -in <zertifikatsname.crt> Key Passwörter ändern ./easyrsa set-rsa-pass EntityName |
root@pki01:~/easyrsa/easyrsa3/pki# openssl crl -inform PEM -text -noout -in crl.pem | |
Certificate Revocation List (CRL): | |
Version 2 (0x1) | |
Signature Algorithm: sha256WithRSAEncryption | |
Issuer: CN = dvsdnet CA | |
Last Update: Jul 4 14:52:21 2023 GMT | |
Next Update: Dec 31 14:52:21 2023 GMT | |
</code> | |
====== Spezialfälle bei OpenVPN ====== | |
| |
Validierung über common name (alte Methode): Der Common Name für das Server Zertifikat muss den Präfix aus der Server Config enthalten: | ''./easyrsa set-ec-pass EntityName Mit "nopass" wird ein Passwort entfernt **CSR** openssl req -in www2.netzwissen.de.csr -text -noout **Zertifikat** openssl x509 -in certificate.crt -text -noout ===== Zertifikat zurückziehen ===== '' ./easyrsa revoke EntityName CRL erzeugen ./easyrsa gen-crl Achtung: Die CRL sollte **alle sechs Monate** neu erzeugt und auf den openvpn Server übertragen werden. Die genauen Daten stehen in der CRL Datei: '' root@pki01:~/easyrsa/easyrsa3/pki# openssl crl -inform PEM -text -noout -in crl.pem Certificate Revocation List (CRL): Version 2 (0x1) Signature Algorithm: sha256WithRSAEncryption Issuer: CN = dvsdnet CA Last Update: Jul 4 14:52:21 2023 GMT Next Update: Dec 31 14:52:21 2023 GMT ====== Spezialfälle bei OpenVPN ====== Validierung über common name (alte Methode): Der Common Name für das Server Zertifikat muss den Präfix aus der Server Config enthalten: –verify-x509-name openvpn name-prefix Mit easyrsa3: locutus:~/easy-rsa/easyrsa3 ./easyrsa sign-req server openvpn.locutus.netzwissen.loc |
| |
''–verify-x509-name openvpn name-prefix '' | |
| |
Mit easyrsa3: | |
| |
''locutus:~/easy-rsa/easyrsa3'' | |
| |
''./easyrsa sign-req server openvpn.locutus.netzwissen.loc'' | |
| |
**Neue Methode nach RFC3280: Verifikation nach Zertifikatstyp**: | **Neue Methode nach RFC3280: Verifikation nach Zertifikatstyp**: |
| |
''remote-cert-tls client '' | ''remote-cert-tls client ./easyrsa sign-req client franklin2.netzwissen.loc Im Client wird im Gegenzug geprüft, ob das vom OpenVPN Server präsentierte Zertifikat den "server" Typ hat ====== PKITOOL Befehle ====== pkitool –initca → Build root certificate\\ |
| pkitool –initca –pass → Build root certificate with password-protected key\\ |
''./easyrsa sign-req client franklin2.netzwissen.loc'' | |
| |
Im Client wird im Gegenzug geprüft, ob das vom OpenVPN Server präsentierte Zertifikat den "server" Typ hat | |
| |
====== PKITOOL Befehle ====== | |
| |
''pkitool –initca → Build root certificate\\ | |
pkitool ''''–initca –pass → Build root certificate with password-protected key\\ | |
pkitool –server server1 → Build "server1" certificate/key\\ | pkitool –server server1 → Build "server1" certificate/key\\ |
pkitool client1 → Build "client1" certificate/key\\ | pkitool client1 → Build "client1" certificate/key\\ |
pkitool –sign client4 → Sign "client4" CSR\\ | pkitool –sign client4 → Sign "client4" CSR\\ |
pkitool –inter interca → Build an intermediate key-signing certificate/key Also see ./inherit-inter script.\\ | pkitool –inter interca → Build an intermediate key-signing certificate/key Also see ./inherit-inter script.\\ |
pkitool –pkcs11 /usr/lib/pkcs11/lib1 0 010203 "client5 id" client5 → Build "client5" certificate/key in PKCS#11 token '' | pkitool –pkcs11 /usr/lib/pkcs11/lib1 0 010203 "client5 id" client5 → Build "client5" certificate/key in PKCS#11 token |
| |
Typical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys. Protect client2 key with a password. Build DH parms. Generated files in ./keys : | Typical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys. Protect client2 key with a password. Build DH parms. Generated files in ./keys : |
| |
''[edit vars with your site-specific info] '''' source ./vars ./clean-all ./build-dh → takes a long time, consider backgrounding ./pkitool –initca ./pkitool –server myserver ./pkitool client1 ./pkitool –pass client2 '' | ''[edit vars with your site-specific info] source ./vars ./clean-all ./build-dh → takes a long time, consider backgrounding ./pkitool –initca ./pkitool –server myserver ./pkitool client1 ./pkitool –pass client2 Typical usage for adding client cert to existing PKI: source ./vars ./pkitool client-new |
| |
Typical usage for adding client cert to existing PKI: | |
| |
''source ./vars ./pkitool client-new '' | |
| |