mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
At -vvv Ansible prints each module argument and result, so a password in a command line, a request body, a header or a fact lands in the deploy log. Nothing enforced masking outside the MCP task files, and no check looked at parents at all. A new lint, test_credential_tasks_are_masked, finds tasks whose printed parts (module arguments, environment, loop) reference an identifier ending in password, secret, token, api_key or private_key, or secrets.credentials. A task passes when it or an enclosing block sets no_log, when every file that pulls it in does so through include_tasks with apply.no_log or import_tasks with no_log (transitively), when the secret only reaches a parameter the module masks itself, or when the module masks its values. no_log on an include_tasks task itself does not count, because it does not reach the included tasks. The rule can be suppressed per task with `# nocheck: credential-masking`, now listed in the suppression catalog, and the lint tests its parent and suppression logic on synthetic cases. It found 39 unmasked tasks in 19 roles, all real: join tokens, client secrets, API tokens in Cloudflare headers, database passwords in command lines, the ChatGPT bot login body and more. Each now sets no_log from MASK_CREDENTIALS_IN_LOGS. The sys-dns-hetzner-rdns alias hetzner_no_log, which only restated that switch, is gone. Not covered yet: template and copy tasks whose rendered file carries a secret print it as a diff under --diff. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
68 lines
2.8 KiB
YAML
68 lines
2.8 KiB
YAML
---
|
|
- name: "📌 apply Social Login Key for Keycloak"
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
ansible.builtin.shell:
|
|
cmd: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec -i
|
|
-e SITE_NAME -e PROVIDER_NAME -e BUTTON_TEXT
|
|
-e CLIENT_ID -e CLIENT_SECRET -e ISSUER_URL
|
|
-e GROUP_ROLE_MAP_JSON
|
|
{{ ERPNEXT_BACKEND_LOCAL_CID | quote }}
|
|
{{ ERPNEXT_BENCH_PYTHON }}
|
|
stdin: "{{ lookup('ansible.builtin.file', role_path ~ '/files/python/apply/oidc_settings.py') }}"
|
|
delegate_to: "{{ ERPNEXT_BACKEND_HOST_NODE }}"
|
|
environment:
|
|
SITE_NAME: "{{ ERPNEXT_SITE_NAME }}"
|
|
PROVIDER_NAME: "keycloak"
|
|
BUTTON_TEXT: "{{ OIDC.BUTTON_TEXT }}"
|
|
CLIENT_ID: "{{ OIDC.CLIENT.ID }}"
|
|
CLIENT_SECRET: "{{ OIDC.CLIENT.SECRET }}"
|
|
ISSUER_URL: "{{ OIDC.CLIENT.ISSUER_URL }}"
|
|
GROUP_ROLE_MAP_JSON: "{{ ERPNEXT_OIDC_GROUP_ROLE_MAP | to_json }}"
|
|
register: erpnext_oidc_apply
|
|
changed_when: "'OIDC_SLK_CHANGED' in erpnext_oidc_apply.stdout"
|
|
timeout: "{{ lookup('timeout', 60) | int }}"
|
|
|
|
- name: "🔄 Restart Frappe on Social Login Key change (compose)"
|
|
ansible.builtin.shell: |
|
|
set -euo pipefail
|
|
container restart {{ ERPNEXT_BACKEND_CONTAINER }}
|
|
changed_when: true
|
|
when:
|
|
- "'OIDC_SLK_CHANGED' in erpnext_oidc_apply.stdout"
|
|
- DEPLOYMENT_MODE == 'compose'
|
|
timeout: "{{ lookup('timeout', 120) | int }}"
|
|
|
|
- name: "🔄 Restart Frappe on Social Login Key change (swarm)"
|
|
ansible.builtin.command: >-
|
|
container service update --force {{ entity_name }}_backend
|
|
changed_when: true
|
|
when:
|
|
- "'OIDC_SLK_CHANGED' in erpnext_oidc_apply.stdout"
|
|
- DEPLOYMENT_MODE == 'swarm'
|
|
timeout: "{{ lookup('timeout', 600) | int }}"
|
|
|
|
- name: "🔍 Re-resolve ERPNext backend node + CID after OIDC restart"
|
|
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}"
|
|
vars:
|
|
resolve_service_key: backend
|
|
resolve_output_prefix: ERPNEXT_BACKEND
|
|
resolve_compose_cid: "{{ ERPNEXT_BACKEND_CONTAINER }}"
|
|
resolve_converge_retries: 60
|
|
resolve_converge_delay: 5
|
|
when: "'OIDC_SLK_CHANGED' in erpnext_oidc_apply.stdout"
|
|
|
|
- name: "⏳ wait for {{ ERPNEXT_BACKEND_CONTAINER }} gunicorn TCP port after OIDC restart"
|
|
ansible.builtin.shell: |
|
|
set -eo pipefail
|
|
# nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec {{ ERPNEXT_BACKEND_LOCAL_CID | quote }} \
|
|
bash -c 'exec 3<>/dev/tcp/localhost/{{ ERPNEXT_BACKEND_PORT }} && exec 3<&- 3>&-'
|
|
delegate_to: "{{ ERPNEXT_BACKEND_HOST_NODE }}"
|
|
register: erpnext_backend_ready_post_oidc
|
|
changed_when: false
|
|
retries: 60
|
|
delay: 5
|
|
until: erpnext_backend_ready_post_oidc.rc == 0
|
|
when: "'OIDC_SLK_CHANGED' in erpnext_oidc_apply.stdout"
|