Skip to content

Commit 29b8908

Browse files
committed
security: hide content of the service account contents from the logs for GCE
When instance is waited for SSH, loop label contains all server data, returned by the driver. One of them is service_account_contents which contains a private key to a GCE service account, used to create VMs in GCE, if GCP_SERVICE_ACCOUNT_CONTENTS environment variable was used.
1 parent 980db38 commit 29b8908

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@
5656
- "Dump instance config"
5757

5858
- name: Wait for SSH
59+
no_log: "{{ molecule_no_log }}" # GCE modules leaks GCP_SERVICE_ACCOUNT_CONTENTS value in returned values from module, which contains private key
5960
ansible.builtin.wait_for:
6061
port: 22
6162
host: "{{ item.networkInterfaces.0.accessConfigs.0.natIP if molecule_yml.driver.external_access else item.networkInterfaces.0.networkIP }}"
6263
search_regex: SSH
6364
delay: 10
6465
loop: "{{ server.results }}"
66+
loop_control:
67+
label: "{{ item.name }}"
6568
register: waitfor
6669
until: waitfor.failed == false
6770
retries: 6

test/gce/scenarios/linux/tasks/create_linux_instance.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@
5050
- Dump instance config
5151

5252
- name: Wait for SSH
53+
no_log: "{{ molecule_no_log }}"
5354
ansible.builtin.wait_for:
5455
port: 22
5556
host: "{{ item.networkInterfaces.0.accessConfigs.0.natIP if molecule_yml.driver.external_access else item.networkInterfaces.0.networkIP }}"
5657
search_regex: SSH
5758
delay: 10
5859
loop: "{{ server.results }}"
60+

0 commit comments

Comments
 (0)