From 17c8e84498e3c8815d293a843eb553a7733e1c51 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 4 Sep 2024 16:54:47 +0200 Subject: [PATCH] proxmox: support certificate renewals with ACME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Certificates must still be requested manually, this just sets the domain and opens up port 80/tcp. Nothing listens there except for certbot during renewals so that’s OK. --- roles/proxmox/tasks/main.yml | 7 +++++++ roles/proxmox/templates/cluster.fw.j2 | 3 +++ 2 files changed, 10 insertions(+) diff --git a/roles/proxmox/tasks/main.yml b/roles/proxmox/tasks/main.yml index 84fe500..64ee9f7 100644 --- a/roles/proxmox/tasks/main.yml +++ b/roles/proxmox/tasks/main.yml @@ -50,6 +50,13 @@ dest: /etc/sysctl.d/local.conf src: sysctl.conf +- name: Set domain for ACME certificate renewals + command: + cmd: 'pvenode config set --acme domains={{ interfaces | selectattr("name", "==", "lo") + | map(attribute="ip_addresses") | flatten | map(attribute="dns_name") + | sort | unique | join(";") }}' + changed_when: false # maybe write a proper check if certificate requests are ever ansibled + - include_tasks: firewall.yml - include_tasks: user.yml diff --git a/roles/proxmox/templates/cluster.fw.j2 b/roles/proxmox/templates/cluster.fw.j2 index 41fd5ed..519d8e1 100644 --- a/roles/proxmox/templates/cluster.fw.j2 +++ b/roles/proxmox/templates/cluster.fw.j2 @@ -6,8 +6,11 @@ enable: 1 IN Ping(ACCEPT) -log nolog # don’t be rude IN SSH(ACCEPT) -i mgmt # for ansible etc. +IN HTTP(ACCEPT) # allow HTTP connections for renewing certificates with ACME + IN ACCEPT -source {{ nodes | map('device_address') | flatten | selectattr('family.value', '==', 4) | map(attribute='address') | join(',') }} # my cluster IN ACCEPT -source {{ nodes | map('device_address') | flatten | selectattr('family.value', '==', 6) | map(attribute='address') | join(',') }} # my cluster + {% for service in cluster_services %} {% set prefixes = service | allowed_prefixes %} {% set ports = service.ports | compact_numlist(range_delimiter=':') %}