mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Merge branch 'develop' of github.com:saltstack/salt into develop
This commit is contained in:
commit
ff7a4393bf
@ -461,10 +461,20 @@ class AESFuncs(object):
|
||||
os.close(fd_)
|
||||
with open(tmp_pub, 'w+') as fp_:
|
||||
fp_.write(minion_pub)
|
||||
pub = RSA.load_pub_key(tmp_pub)
|
||||
os.remove(tmp_pub)
|
||||
if pub.public_decrypt(token, 5) == 'salt':
|
||||
return True
|
||||
|
||||
pub = None
|
||||
try:
|
||||
pub = RSA.load_pub_key(tmp_pub)
|
||||
except RSA.RSAError, e:
|
||||
log.error('Unable to load temporary public key "{0}": {1}'
|
||||
.format(tmp_pub, e))
|
||||
try:
|
||||
os.remove(tmp_pub)
|
||||
if pub.public_decrypt(token, 5) == 'salt':
|
||||
return True
|
||||
except RSA.RSAError, e:
|
||||
log.error('Unable to decrypt token: {0}'.format(e))
|
||||
|
||||
log.error('Salt minion claiming to be {0} has attempted to'
|
||||
'communicate with the master and could not be verified'
|
||||
.format(id_))
|
||||
@ -1066,7 +1076,17 @@ class ClearFuncs(object):
|
||||
log.info('Authentication accepted from %(id)s', load)
|
||||
with open(pubfn, 'w+') as fp_:
|
||||
fp_.write(load['pub'])
|
||||
pub = RSA.load_pub_key(pubfn)
|
||||
pub = None
|
||||
|
||||
# The key payload may sometimes be corrupt when using auto-accept
|
||||
# and an empty request comes in
|
||||
try:
|
||||
pub = RSA.load_pub_key(pubfn)
|
||||
except RSA.RSAError, e:
|
||||
log.error('Corrupt public key "{0}": {1}'.format(pubfn, e))
|
||||
return {'enc': 'clear',
|
||||
'load': {'ret': False}}
|
||||
|
||||
ret = {'enc': 'pub',
|
||||
'pub_key': self.master_key.get_pub_str(),
|
||||
'token': self.master_key.token,
|
||||
|
@ -12,15 +12,7 @@ from salt._compat import string_types
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def active():
|
||||
'''
|
||||
List the active mounts.
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' mount.active
|
||||
'''
|
||||
ret = {}
|
||||
def _active_mountinfo(ret):
|
||||
with open('/proc/self/mountinfo') as fh:
|
||||
for line in fh:
|
||||
comps = line.split()
|
||||
@ -37,6 +29,32 @@ def active():
|
||||
return ret
|
||||
|
||||
|
||||
def _active_mounts(ret):
|
||||
with open('/proc/self/mounts') as fh:
|
||||
for line in fh:
|
||||
comps.split()
|
||||
ret[comps[1]] = {'device': comps[0],
|
||||
'fstype': comps[2],
|
||||
'opts': comps[3].split(',')}
|
||||
return ret
|
||||
|
||||
|
||||
def active():
|
||||
'''
|
||||
List the active mounts.
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' mount.active
|
||||
'''
|
||||
ret = {}
|
||||
try:
|
||||
_active_mountinfo(ret)
|
||||
except IOError:
|
||||
_active_mounts(ret)
|
||||
return ret
|
||||
|
||||
|
||||
def fstab(config='/etc/fstab'):
|
||||
'''
|
||||
List the contents of the fstab
|
||||
|
@ -58,7 +58,7 @@ def list_upgrades():
|
||||
'pacman -Sypu --print-format "%n %v" | egrep -v "^\s|^:"'
|
||||
).split('\n')
|
||||
for line in lines:
|
||||
comps = lines.split(' ')
|
||||
comps = line.split(' ')
|
||||
if len(comps) < 2:
|
||||
continue
|
||||
upgrades[comps[0]] = comps[1]
|
||||
|
@ -6,6 +6,9 @@ The network module is used to create and manage network settings,
|
||||
interfaces can be set as either managed or ignored. By default
|
||||
all interfaces are ignored unless specified.
|
||||
|
||||
Please note that only Redhat-style networking is currently
|
||||
supported. This module will therefore only work on RH/CentOS/Fedora.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
eth0:
|
||||
|
Loading…
Reference in New Issue
Block a user