diff --git a/salt/master.py b/salt/master.py index 2ab0a31a6c..9689a7eba7 100644 --- a/salt/master.py +++ b/salt/master.py @@ -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, diff --git a/salt/modules/mount.py b/salt/modules/mount.py index d847cae3d3..4c9fa698aa 100644 --- a/salt/modules/mount.py +++ b/salt/modules/mount.py @@ -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 diff --git a/salt/modules/pacman.py b/salt/modules/pacman.py index 65ac19f468..9fad42bb75 100644 --- a/salt/modules/pacman.py +++ b/salt/modules/pacman.py @@ -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] diff --git a/salt/states/network.py b/salt/states/network.py index e979718684..907da729c2 100644 --- a/salt/states/network.py +++ b/salt/states/network.py @@ -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: