fix: Add no_log to tasks handling sensitive information

- Add no_log: true to OpenSSL commands that contain passwords/passphrases
- Add no_log: true to WireGuard key generation commands
- Add no_log: true to password/CA password generation tasks
- Add no_log: true to AWS credential handling tasks
- Add no_log: true to QR code generation that contains full configs

This prevents sensitive information like passwords, private keys, and
WireGuard configurations from being logged to syslog/journald.

Fixes #1617
This commit is contained in:
Dan Guido 2025-08-03 03:11:10 -04:00
parent 671135a6f4
commit ac0c4512ed
5 changed files with 15 additions and 0 deletions

View file

@ -21,6 +21,7 @@
- set_fact: - set_fact:
access_key: "{{ aws_access_key | default(_aws_access_key.user_input|default(None)) | default(lookup('env','AWS_ACCESS_KEY_ID'), true) }}" access_key: "{{ aws_access_key | default(_aws_access_key.user_input|default(None)) | default(lookup('env','AWS_ACCESS_KEY_ID'), true) }}"
secret_key: "{{ aws_secret_key | default(_aws_secret_key.user_input|default(None)) | default(lookup('env','AWS_SECRET_ACCESS_KEY'), true) }}" secret_key: "{{ aws_secret_key | default(_aws_secret_key.user_input|default(None)) | default(lookup('env','AWS_SECRET_ACCESS_KEY'), true) }}"
no_log: true
- block: - block:
- name: Get regions - name: Get regions

View file

@ -3,11 +3,13 @@
set_fact: set_fact:
p12_export_password: "{{ p12_password|default(lookup('password', '/dev/null length=9 chars=ascii_letters,digits,_,@')) }}" p12_export_password: "{{ p12_password|default(lookup('password', '/dev/null length=9 chars=ascii_letters,digits,_,@')) }}"
tags: update-users tags: update-users
no_log: true
- name: Set facts - name: Set facts
set_fact: set_fact:
CA_password: "{{ ca_password|default(lookup('password', '/dev/null length=16 chars=ascii_letters,digits,_,@')) }}" CA_password: "{{ ca_password|default(lookup('password', '/dev/null length=16 chars=ascii_letters,digits,_,@')) }}"
IP_subject_alt_name: "{{ IP_subject_alt_name }}" IP_subject_alt_name: "{{ IP_subject_alt_name }}"
no_log: true
- name: Set IPv6 support as a fact - name: Set IPv6 support as a fact
set_fact: set_fact:

View file

@ -65,6 +65,7 @@
chdir: "{{ ipsec_pki_path }}" chdir: "{{ ipsec_pki_path }}"
creates: "{{ IP_subject_alt_name }}_ca_generated" creates: "{{ IP_subject_alt_name }}_ca_generated"
executable: bash executable: bash
no_log: true
- name: Copy the CA certificate - name: Copy the CA certificate
copy: copy:
@ -99,6 +100,7 @@
chdir: "{{ ipsec_pki_path }}" chdir: "{{ ipsec_pki_path }}"
creates: certs/{{ IP_subject_alt_name }}_crt_generated creates: certs/{{ IP_subject_alt_name }}_crt_generated
executable: bash executable: bash
no_log: true
- name: Build the client's pair - name: Build the client's pair
shell: > shell: >
@ -123,6 +125,7 @@
creates: certs/{{ item }}_crt_generated creates: certs/{{ item }}_crt_generated
executable: bash executable: bash
with_items: "{{ users }}" with_items: "{{ users }}"
no_log: true
- name: Build the tests pair - name: Build the tests pair
shell: > shell: >
@ -147,6 +150,7 @@
creates: certs/google-algo-test-pair.com_crt_generated creates: certs/google-algo-test-pair.com_crt_generated
executable: bash executable: bash
when: tests|default(false)|bool when: tests|default(false)|bool
no_log: true
- name: Build openssh public keys - name: Build openssh public keys
openssl_publickey: openssl_publickey:
@ -185,6 +189,7 @@
executable: bash executable: bash
with_items: "{{ users }}" with_items: "{{ users }}"
register: p12 register: p12
no_log: true
- name: Build the client's p12 with the CA cert included - name: Build the client's p12 with the CA cert included
shell: > shell: >
@ -203,6 +208,7 @@
executable: bash executable: bash
with_items: "{{ users }}" with_items: "{{ users }}"
register: p12 register: p12
no_log: true
- name: Copy the p12 certificates - name: Copy the p12 certificates
copy: copy:
@ -235,6 +241,7 @@
executable: bash executable: bash
when: item.split('@')[0] not in users when: item.split('@')[0] not in users
with_items: "{{ valid_certs.stdout_lines }}" with_items: "{{ valid_certs.stdout_lines }}"
no_log: true
- name: Generate new CRL file - name: Generate new CRL file
shell: > shell: >
@ -248,6 +255,7 @@
args: args:
chdir: "{{ ipsec_pki_path }}" chdir: "{{ ipsec_pki_path }}"
executable: bash executable: bash
no_log: true
delegate_to: localhost delegate_to: localhost
become: false become: false
vars: vars:

View file

@ -16,6 +16,7 @@
with_items: with_items:
- "{{ users }}" - "{{ users }}"
- "{{ IP_subject_alt_name }}" - "{{ IP_subject_alt_name }}"
no_log: true
- block: - block:
- name: Save private keys - name: Save private keys
@ -55,6 +56,7 @@
with_items: with_items:
- "{{ users }}" - "{{ users }}"
- "{{ IP_subject_alt_name }}" - "{{ IP_subject_alt_name }}"
no_log: true
- block: - block:
- name: Save preshared keys - name: Save preshared keys
@ -89,6 +91,7 @@
with_items: with_items:
- "{{ users }}" - "{{ users }}"
- "{{ IP_subject_alt_name }}" - "{{ IP_subject_alt_name }}"
no_log: true
- name: Save public keys - name: Save public keys
copy: copy:

View file

@ -74,6 +74,7 @@
args: args:
chdir: "{{ wireguard_config_path }}" chdir: "{{ wireguard_config_path }}"
executable: bash executable: bash
no_log: true
become: false become: false
delegate_to: localhost delegate_to: localhost