How-To
Services
Internal
Historical
External Tools
Certificates can be automatically generated with the ACME-CA using acme.sh or lego or Caddy. More information can be found on https://burble.dn42/services/acme/
This client is used for automating the process of requesting TLS certificates. (Available via: dn42, iana, git)
The process validates ownership by verifying control of both a users MNT object in the registry and the authoritative DNS server. The following steps take place in creating a signed certificate.
User Flow
Server Flow
User Renewals
User certificates are signed for 180 days. To renew follow the steps above starting from number 3.
Server renewals
Server certificates are signed for 45 days. To renew follow the steps above starting from number 3.
Certificate Revocations
get the script here:
curl https://ca.dn42/ca.dn42 > ca.dn42; chmod +x ca.dn42
available via git: anon@git.dn42:dn42/ca-client
The way openssl validated name constraints prevented it from accepting dns names that started with a dot. Because the name constraint is "DNS:.dn42" it fails to validate.
Read more on this mailing list thread
Browsers and clients that rely on Apple's Secure Transport library does not support X.509's nameConstraints.
Read more on this stack exchange post
Usage: # OWNER is your MNT handle.
./ca.dn42 user-gen OWNER EMAIL # Output to OWNER.csr and OWNER.key
./ca.dn42 user-sig OWNER # Output to OWNER.crt and OWNER.p12
./ca.dn42 tls-gen DNS OWNER EMAIL [SAN] # Output to OWNER_DNS.csr and OWNER.key
./ca.dn42 tls-sig DNS OWNER # Output to OWNER_DNS.crt and OWNER_DNS.p12
./ca.dn42 revoke OWNER CERTFILE [REASON]
Revoke Reasons: unspecified, keyCompromise, affiliationChanged,
superseded, cessationOfOperation, certificateHold, removeFromCRL
Environtment Options:
DN42CA_PKCS12 = 1 # Generate pkcs12 file for certificate.
Generate the user key
$ ./ca.dn42 user-gen XUU-MNT xuu@sour.is
Generating a 2048 bit RSA private key
...............................+++
.........................+++
writing new private key to 'XUU-MNT.key'
-----
=
= You need to have this pin added to your mnt object before proceeding to the next step.
=
|MNT Key Pin| remarks: pin-sha256:HdqCid0sedWXX3Q0uG98rYjJyTNOzaT13WfWpr1GvIw=
$ ./ca.dn42 user-sign XUU-MNT xuu@sour.is
== USER CERT ==
C:XD
O:dn42
OU:dn42 Certificate Authority
CN:XUU-MNT
emailAddress:xuu@sour.is
owner:XUU-MNT
pin-sha256:HdqCid0sedWXX3Q0uG98rYjJyTNOzaT13WfWpr1GvIw=
OK https://ca.dn42/crt/XUU-MNT.crt
Enter Export Password:
Verifying - Enter Export Password:
$ ./ca.dn42 tls-gen ca.dn42 XUU-MNT xuu@sour.is DNS:ca.dn42
Generating a 2048 bit RSA private key
...........................................+++
.......................+++
writing new private key to 'XUU-MNT_ca.dn42.key'
-----
writing RSA key
=
= |DNS Key Pin| You need to have this pin added to your dns records before proceeding to the next step.
=
_dn42_tlsverify.ca.dn42. IN TXT XUU-MNT:pin-sha256:Qu/X5GNqOo05TdL7oexkamE34OUuDE60T+f0xc60UPQ=
After you set this TXT-Record for your domain, you can verify it with the following command (by replacing the domain with your own):
$ dig +short TXT _dn42_tlsverify.ca.dn42.
"XUU-MNT:pin-sha256:Qu/X5GNqOo05TdL7oexkamE34OUuDE60T+f0xc60UPQ="
$ ./ca.dn42 tls-sign ca.dn42 XUU-MNT
== USER CERT ==
C:XD
O:dn42
OU:dn42 Certificate Authority
CN:XUU-MNT
emailAddress:xuu@sour.is
owner:XUU-MNT
pin-sha256:HdqCid0sedWXX3Q0uG98rYjJyTNOzaT13WfWpr1GvIw=
== DNS CSR ==
C:XD
O:dn42
OU:dn42 Certificate Authority
CN:ca.dn42
emailAddress:xuu@sour.is
owner:XUU-MNT
pin-sha256:Qu/X5GNqOo05TdL7oexkamE34OUuDE60T+f0xc60UPQ=
== DNS Tests ==
CN Record: ca.dn42 PASSED
SAN Record: ca.dn42 PASSED
OK https://ca.dn42/crt/XUU-MNT_ca.dn42.crt
Enter Export Password: ****
Verifying - Enter Export Password: ****
The generated certificate will be valid for 3 months, to renew it simply run ./ca.dn42 tls-sign ca.dn42 XUU-MNT
again. This could be also automated in cron:
0 0 1 * * /etc/ssl/dn42/ca.dn42 tls-sign wiki.dn42 MIC92-MNT
or with a systemd timer:
# update-dn42-ca.timer
[Timer]
OnBootSec=1h
OnUnitActiveSec=1w
Persistent=yes
[Install]
WantedBy=timers.target
[Service]
Type=oneshot
WorkingDirectory=/etc/ssl/dn42
ExecStart=/etc/ssl/dn42/ca.dn42 tls-sign wiki.dn42 MIC92-MNT
# accept multiple ExecStart lines for other certificates
# ExecStart=/etc/ssl/dn42/ca.dn42 tls-sign foobar.dn42 MIC92-MNT
ExecStart=/usr/bin/nginx -s reload
$ ./ca.dn42 revoke XUU-MNT XUU-MNT.crt
== USER CERT ==
C:XD
O:dn42
OU:dn42 Certificate Authority
CN:XUU-MNT
emailAddress:xuu@sour.is
owner:XUU-MNT
pin-sha256:HdqCid0sedWXX3Q0uG98rYjJyTNOzaT13WfWpr1GvIw=
== REVOKE CERT ==
OK
All issued certificates will be logged to xuu's mattermost instance.
Hosted by: BURBLE-MNT, GRMML-MNT, XUU-MNT, JAN-MNT, LARE-MNT, SARU-MNT, ANDROW-MNT, MARK22K-MNT | Accessible via: dn42, dn42.dev, dn42.eu, wiki.dn42.us, dn42.de (IPv6-only), dn42.cc (wiki-ng), dn42.wiki, dn42.pp.ua, dn42.obl.ong
Last edited by burble.dn42 wiki mirror (us-nyc1), 2023-12-18 23:34:23