Generating web SSL certificates
- Domain Validated
-
Fully automated process solely based on DNS / infrastructure challenges.
- Organization Validated
-
Checking organization in question.
- Extended Validation
-
Additional checks i.e. telephone based verification.
provider "acme" {
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}
resource "tls_private_key" "private_key" { algorithm = "RSA" }
resource "acme_registration" "reg" {
account_key_pem = tls_private_key.private_key.private_key_pem
email_address = "nobody@example.com"
}
resource "acme_certificate" "certificate" {
...
dns_challenge { ... }
}
|
acme DNS provider list:
|
dns_challenge {
provider = "rfc2136"
config = {
RFC2136_NAMESERVER = "ns1.sdi.hdm-stuttgart.cloud"
RFC2136_TSIG_ALGORITHM = "hmac-sha512"
RFC2136_TSIG_KEY = "goik.key."
RFC2136_TSIG_SECRET = file("../dnsupdatetoken.key")
}
}
... updating zone 'goik.sdi.hdm-stuttgart.cloud/IN': deleting rrset at '_acme-challenge.goik.sdi.hdm-stuttgart.cloud' TXT ... updating zone 'goik.sdi.hdm-stuttgart.cloud/IN': adding an RR at '_acme-challenge.goik.sdi.hdm-stuttgart.cloud' TXT "GtJZJZjCZLWoGsQDODCFnY37TmMjRiy8Hw9M1eDGhkQ" ... deleting rrset at ... TXT ... adding an RR ... TXT "eJckWl2F43nsf27bzVOjcrTGp_VFeCj2qTVM5Uodg-4" ... deleting an RR at _acme-challenge.goik.sdi.hdm-stuttgart.cloud TXT ... updating zone ... deleting an RR ... TXT
No. 14
Creating a web certificate
Q: |
CautionDuring configuration always use the
staging URL
As an example we assume your group has write privileges to a
zone
The
Use CautionDue to a DNS provider related issue you must use at least acme provider version v2.23.2. You are best off not specifying any version at all receiving the latest release automatically:
|
No. 15
Testing your web certificate
Q: |
Create a host among with three corresponding DNS entries:
Your Terraform setup shall
contain the following
Install the Nginx web server. Modify the Nginx configuration to accept https requests using the certificate being generated in Creating a web certificate . TipThe Nginx default configuration
already contains a self signed certificate being referred to by
# SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; ... # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; After modifying the above configuration check for correctness: root@www:~# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful Correct any misconfiguration issues before restarting Nginx: systemctl restart nginx Your current staging certificate will cause warnings. Point
your browser to If your certificate is basically alright re-generate it this
time using the production setting
Copy the generated certificate to your server again. This time your browser should present a flawless view with respect to the underlying certificate for all three URLs. |
No. 16
Combining certificate generation and server creation
Q: |
Combine Creating a web certificate and Testing your web certificate into one Terraform configuration. |