๐Ÿ”’ Certificates

Web certificates are managed using Certbot, a widely used tool for obtaining trusted SSL/TLS certificates from Letโ€™s Encrypt.
Certificates are staged inside the reverse proxy server under /data/certs, with a dedicated folder for each host.
Automation is handled via Ansible playbooks, ensuring consistency and repeatability across environments.


โš™๏ธ Certificate Generation

Certificates are generated using the Ansible playbook:

playbooks/certs/generate_certs.yml

Example Configuration

rproxy_setup_sites:
  - server_name: homelab.refol.us
    port: 80
    proxy_pass: "http://{{ global_ip_addresses['redmine-0'] }}"
    allow_list:
      - 192.168.0.0/24
      - 192.168.2.0/24
      - 24.105.250.200
      - 70.107.117.124
    restricted: false

๐Ÿ’ก This configuration allows Certbot to generate certificates for homelab.refol.us while enforcing access controls via the allow_list.


๐Ÿ“‚ Certificate Staging

Once generated, certificates are staged using:

playbooks/certs/stage_certs.yml

This playbook copies the following files from the Letโ€™s Encrypt folder into the appropriate host folder under /data/certs:

These files are then referenced in the NGINX site configuration:

ssl_certificate     /data/certs/homelab.refol.us/fullchain.pem;
ssl_certificate_key /data/certs/homelab.refol.us/privkey.pem;

โœ… Staging ensures certificates are consistently deployed and referenced by reverse proxy configurations.


๐Ÿงช Example Workflow

To generate and stage certificates for homelab.refol.us:

INV=inventory/redmine/inventory.ini
ansible-playbook -i $INV playbooks/certs/generate_certs.yml -k
ansible-playbook -i $INV playbooks/certs/stage_certs.yml -k

๐Ÿ› ๏ธ Debugging Certificate Request Errors

If errors occur during certificate generation or renewal:


โœ… Summary

This workflow provides a fully automated certificate lifecycle:

Together, these practices ensure secure, maintainable, and repeatable certificate management across the homelab environment.