Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
75e0b7a5
Commit
75e0b7a5
authored
Apr 18, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure umask is set restrictively before creating any vault files
parent
632eb183
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
lib/ansible/utils/vault.py
+8
-0
No files found.
lib/ansible/utils/vault.py
View file @
75e0b7a5
...
...
@@ -191,12 +191,14 @@ class VaultEditor(object):
raise
errors
.
AnsibleError
(
"
%
s exists, please use 'edit' instead"
%
self
.
filename
)
# drop the user into vim on file
old_umask
=
os
.
umask
(
0077
)
call
(
self
.
_editor_shell_command
(
self
.
filename
))
tmpdata
=
self
.
read_data
(
self
.
filename
)
this_vault
=
VaultLib
(
self
.
password
)
this_vault
.
cipher_name
=
self
.
cipher_name
enc_data
=
this_vault
.
encrypt
(
tmpdata
)
self
.
write_data
(
enc_data
,
self
.
filename
)
os
.
umask
(
old_umask
)
def
decrypt_file
(
self
):
...
...
@@ -222,6 +224,9 @@ class VaultEditor(object):
if
not
HAS_AES
or
not
HAS_COUNTER
or
not
HAS_PBKDF2
or
not
HAS_HASH
:
raise
errors
.
AnsibleError
(
CRYPTO_UPGRADE
)
# make sure the umask is set to a sane value
old_mask
=
os
.
umask
(
0077
)
# decrypt to tmpfile
tmpdata
=
self
.
read_data
(
self
.
filename
)
this_vault
=
VaultLib
(
self
.
password
)
...
...
@@ -246,6 +251,9 @@ class VaultEditor(object):
# shuffle tmp file into place
self
.
shuffle_files
(
tmp_path
,
self
.
filename
)
# and restore the old umask
os
.
umask
(
old_mask
)
def
encrypt_file
(
self
):
if
not
HAS_AES
or
not
HAS_COUNTER
or
not
HAS_PBKDF2
or
not
HAS_HASH
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment