Skip to content

Commit a79c9ce

Browse files
dguidoclaude
andcommitted
Add keys_clean_all support to WireGuard (parity with IPsec)
Previously, WireGuard had no option to force credential regeneration for existing users. The keys_clean_all option only affected IPsec certificates. Now WireGuard respects keys_clean_all the same way IPsec does: - keys_clean_all: false (default) - preserve existing keys, only generate for new users - keys_clean_all: true - delete all keys and regenerate for all users Also improved the config.cfg documentation to clarify this option affects both WireGuard and IPsec credentials. Fixes #14610 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6a6faeb commit a79c9ce

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

config.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ dns_servers:
8888
# Store PKI in RAM disk when not retaining (MacOS/Linux only)
8989
pki_in_tmpfs: true
9090

91-
# Regenerate ALL user certs on update-users (not just new users)
91+
# Regenerate ALL user credentials on update-users (not just new users)
92+
# When false: existing WireGuard keys and IPsec certs are preserved
93+
# When true: all credentials are deleted and regenerated for all users
9294
keys_clean_all: false
9395

9496
### VPN Network Configuration ###

roles/wireguard/tasks/keys.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
---
2+
- name: Ensure the WireGuard pki directory does not exist
3+
file:
4+
dest: "{{ wireguard_pki_path }}"
5+
state: absent
6+
when: keys_clean_all | bool
7+
8+
- name: Ensure the WireGuard pki directories exist
9+
file:
10+
dest: "{{ wireguard_pki_path }}/{{ item }}"
11+
state: directory
12+
recurse: true
13+
mode: "0700"
14+
with_items:
15+
- preshared
16+
- private
17+
- public
18+
219
- name: Generate raw private keys
320
community.crypto.openssl_privatekey:
421
type: X25519

0 commit comments

Comments
 (0)