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
65cb79a5
Commit
65cb79a5
authored
Feb 10, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel' of
https://github.com/xyrix/ansible
into xyrix-devel
parents
36250c6b
20d97416
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
lib/ansible/constants.py
+3
-0
lib/ansible/utils/__init__.py
+13
-3
No files found.
lib/ansible/constants.py
View file @
65cb79a5
...
...
@@ -157,6 +157,9 @@ ZEROMQ_PORT = get_config(p, 'fireball_connection', 'zeromq_po
ACCELERATE_PORT
=
get_config
(
p
,
'accelerate'
,
'accelerate_port'
,
'ACCELERATE_PORT'
,
5099
,
integer
=
True
)
ACCELERATE_TIMEOUT
=
get_config
(
p
,
'accelerate'
,
'accelerate_timeout'
,
'ACCELERATE_TIMEOUT'
,
30
,
integer
=
True
)
ACCELERATE_CONNECT_TIMEOUT
=
get_config
(
p
,
'accelerate'
,
'accelerate_connect_timeout'
,
'ACCELERATE_CONNECT_TIMEOUT'
,
1.0
,
floating
=
True
)
ACCELERATE_KEYS_DIR
=
get_config
(
p
,
'accelerate'
,
'accelerate_keys_dir'
,
'ACCELERATE_KEYS_DIR'
,
'~/.fireball.keys'
)
ACCELERATE_KEYS_DIR_PERMS
=
get_config
(
p
,
'accelerate'
,
'accelerate_keys_dir_perms'
,
'ACCELERATE_KEYS_DIR_PERMS'
,
'700'
)
ACCELERATE_KEYS_FILE_PERMS
=
get_config
(
p
,
'accelerate'
,
'accelerate_keys_file_perms'
,
'ACCELERATE_KEYS_FILE_PERMS'
,
'600'
)
PARAMIKO_PTY
=
get_config
(
p
,
'paramiko_connection'
,
'pty'
,
'ANSIBLE_PARAMIKO_PTY'
,
True
,
boolean
=
True
)
# characters included in auto-generated passwords
...
...
lib/ansible/utils/__init__.py
View file @
65cb79a5
...
...
@@ -87,19 +87,29 @@ def key_for_hostname(hostname):
if
not
KEYCZAR_AVAILABLE
:
raise
errors
.
AnsibleError
(
"python-keyczar must be installed on the control machine to use accelerated modes"
)
key_path
=
os
.
path
.
expanduser
(
"~/.fireball.keys"
)
key_path
=
os
.
path
.
expanduser
(
C
.
ACCELERATE_KEYS_DIR
)
if
not
os
.
path
.
exists
(
key_path
):
os
.
makedirs
(
key_path
)
key_path
=
os
.
path
.
expanduser
(
"~/.fireball.keys/
%
s"
%
hostname
)
os
.
chmod
(
key_path
,
int
(
C
.
ACCELERATE_KEYS_DIR_PERMS
,
8
))
elif
not
os
.
path
.
isdir
(
key_path
):
raise
errors
.
AnsibleError
(
'ACCELERATE_KEYS_DIR is not a directory.'
)
if
stat
.
S_IMODE
(
os
.
stat
(
key_path
)
.
st_mode
)
!=
int
(
C
.
ACCELERATE_KEYS_DIR_PERMS
,
8
):
raise
errors
.
AnsibleError
(
'Incorrect permissions on ACCELERATE_KEYS_DIR (
%
s)'
%
(
C
.
ACCELERATE_KEYS_DIR
,))
key_path
=
os
.
path
.
join
(
key_path
,
hostname
)
# use new AES keys every 2 hours, which means fireball must not allow running for longer either
if
not
os
.
path
.
exists
(
key_path
)
or
(
time
.
time
()
-
os
.
path
.
getmtime
(
key_path
)
>
60
*
60
*
2
):
key
=
AesKey
.
Generate
()
fh
=
open
(
key_path
,
"w"
)
fd
=
os
.
open
(
key_path
,
os
.
O_WRONLY
|
os
.
O_CREAT
,
int
(
C
.
ACCELERATE_KEYS_FILE_PERMS
,
8
))
fh
=
os
.
fdopen
(
fd
,
'w'
)
fh
.
write
(
str
(
key
))
fh
.
close
()
return
key
else
:
if
stat
.
S_IMODE
(
os
.
stat
(
key_path
)
.
st_mode
)
!=
int
(
C
.
ACCELERATE_KEYS_FILE_PERMS
,
8
):
raise
errors
.
AnsibleError
(
'Incorrect permissions on ACCELERATE_KEYS_FILE (
%
s)'
%
(
key_path
,))
fh
=
open
(
key_path
)
key
=
AesKey
.
Read
(
fh
.
read
())
fh
.
close
()
...
...
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