-
Notifications
You must be signed in to change notification settings - Fork 23.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix vault temp file handling (#68433)
* fix vault tmpe file handling * use local temp dir instead of system temp * ensure each worker clears dataloader temp files * added test for dangling temp files * added notes to data loader CVE-2020-10685 (cherry picked from commit 6452a82)
- Loading branch information
Showing
8 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- Ensure DataLoader temp files are removed at appropriate times and that we observe the LOCAL_TMP setting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/integration/targets/vault/files/test_assemble/nonsecret.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
THIS IS OK |
7 changes: 7 additions & 0 deletions
7
test/integration/targets/vault/files/test_assemble/secret.vault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$ANSIBLE_VAULT;1.1;AES256 | ||
37626439373465656332623633333336353334326531333666363766303339336134313136616165 | ||
6561333963343739386334653636393363396366396338660a663537666561643862343233393265 | ||
33336436633864323935356337623861663631316530336532633932623635346364363338363437 | ||
3365313831366365350a613934313862313538626130653539303834656634353132343065633162 | ||
34316135313837623735653932663139353164643834303534346238386435373832366564646236 | ||
3461333465343434666639373432366139363566303564643066 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
- hosts: localhost | ||
gather_facts: False | ||
vars: | ||
od: "{{output_dir|default('/tmp')}}/test_vault_assemble" | ||
tasks: | ||
- name: create target directory | ||
file: | ||
path: "{{od}}" | ||
state: directory | ||
|
||
- name: assemble_file file with secret | ||
assemble: | ||
src: files/test_assemble | ||
dest: "{{od}}/dest_file" | ||
remote_src: no | ||
mode: 0600 | ||
|
||
- name: remove assembled file with secret (so nothing should have unencrypted secret) | ||
file: path="{{od}}/dest_file" state=absent | ||
|
||
- name: find temp files with secrets | ||
find: | ||
paths: '{{temp_paths}}' | ||
contains: 'VAULT TEST IN WHICH BAD THING HAPPENED' | ||
recurse: yes | ||
register: badthings | ||
vars: | ||
temp_paths: "{{[lookup('env', 'TMP'), lookup('env', 'TEMP'), hardcoded]|flatten(1)|unique|list}}" | ||
hardcoded: ['/tmp', '/var/tmp'] | ||
|
||
- name: ensure we failed to find any | ||
assert: | ||
that: | ||
- badthings['matched'] == 0 |