Skip to content

Commit 9cdbb7d

Browse files
ManjotScursoragent
andcommitted
scylla-manager: harden alternator creds task (no_log, best-effort, TLS)
Address review on #537: - Add no_log: true to the salted-hash fetch and both sctool add/update tasks so the alternator secret (and username/password) no longer leak into Ansible logs, -vvv output, or callback plugins. - Make the cqlsh salted-hash lookup best-effort with failed_when: false so TLS-only clusters or transient auth/network failures skip the optional --alternator-* flags instead of aborting the whole add/update. - Support client encryption via optional item.ssl (--ssl) for the lookup. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9b24a6a commit 9cdbb7d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ansible-scylla-manager/tasks/add_cluster.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@
1111
- name: Fetch alternator salted hash for "{{ item.username }}"
1212
shell: |
1313
cqlsh {{ item.host }} -u '{{ item.username }}' -p '{{ item.password }}' \
14+
{% if item.ssl is defined and item.ssl|bool %}--ssl{% endif %} \
1415
-e "SELECT salted_hash FROM system.roles WHERE role = '{{ item.username }}';" \
1516
| grep -E '^\s+\$' | tr -d ' '
1617
register: alternator_salted_hash
18+
# Alternator creds are best-effort: TLS-only clusters, transient network/auth
19+
# failures, or missing SELECT on system.roles must not abort the cluster add/update.
20+
failed_when: false
21+
# stdout is a credential-equivalent secret; keep it out of Ansible logs/-vvv output.
22+
no_log: true
1723
when:
1824
- item.username is defined
1925
- item.password is defined
@@ -36,6 +42,8 @@
3642
--alternator-access-key-id {{ item.username }} \
3743
--alternator-secret-access-key '{{ alternator_salted_hash.stdout }}' \
3844
{% endif %}
45+
# Command line embeds username/password and the alternator secret; suppress logging.
46+
no_log: true
3947
when: cluster_already_added is not defined or cluster_already_added.stdout != "present"
4048

4149
- name: Enforce configuration for existing cluster "{{ item.cluster_name }}"
@@ -55,5 +63,7 @@
5563
--alternator-access-key-id {{ item.username }} \
5664
--alternator-secret-access-key '{{ alternator_salted_hash.stdout }}' \
5765
{% endif %}
66+
# Command line embeds username/password and the alternator secret; suppress logging.
67+
no_log: true
5868
when: cluster_already_added is defined and cluster_already_added.stdout == "present"
5969

0 commit comments

Comments
 (0)