mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2016.11' of https://github.com/saltstack/salt into lover_typo
This commit is contained in:
commit
385980c21a
10 changed files with 75 additions and 14 deletions
6
doc/topics/releases/2016.11.9.rst
Normal file
6
doc/topics/releases/2016.11.9.rst
Normal file
|
@ -0,0 +1,6 @@
|
|||
============================
|
||||
Salt 2016.11.9 Release Notes
|
||||
============================
|
||||
|
||||
Version 2016.11.9 is a bugfix release for :ref:`2016.11.0 <release-2016-11-0>`.]
|
||||
|
|
@ -33,3 +33,5 @@ Tutorials Index
|
|||
* :ref:`The macOS (Maverick) Developer Step By Step Guide To Salt Installation <tutorial-macos-walk-through>`
|
||||
* :ref:`SaltStack Walk-through <tutorial-salt-walk-through>`
|
||||
* :ref:`Writing Salt Tests <tutorial-salt-testing>`
|
||||
* :ref:`Running Salt States and Commands in Docker Containers <docker-sls>`
|
||||
* :ref:`Preseed Minion with Accepted Key <tutorial-preseed-key>`
|
||||
|
|
|
@ -23,7 +23,7 @@ Supported Operating Systems
|
|||
.. note::
|
||||
|
||||
In the event you do not see your distribution or version available please
|
||||
review the develop branch on GitHub as it main contain updates that are
|
||||
review the develop branch on GitHub as it may contain updates that are
|
||||
not present in the stable release:
|
||||
https://github.com/saltstack/salt-bootstrap/tree/develop
|
||||
|
||||
|
|
|
@ -606,6 +606,9 @@ class AsyncAuth(object):
|
|||
raise tornado.gen.Return('retry')
|
||||
else:
|
||||
raise SaltClientError('Attempt to authenticate with the salt master failed with timeout error')
|
||||
if not isinstance(payload, dict):
|
||||
log.error('Sign-in attempt failed: %s', payload)
|
||||
raise tornado.gen.Return(False)
|
||||
if 'load' in payload:
|
||||
if 'ret' in payload['load']:
|
||||
if not payload['load']['ret']:
|
||||
|
|
|
@ -123,7 +123,16 @@ def available():
|
|||
salt '*' kmod.available
|
||||
'''
|
||||
ret = []
|
||||
|
||||
mod_dir = os.path.join('/lib/modules/', os.uname()[2])
|
||||
|
||||
built_in_file = os.path.join(mod_dir, 'modules.builtin')
|
||||
if os.path.exists(built_in_file):
|
||||
with salt.utils.fopen(built_in_file, 'r') as f:
|
||||
for line in f:
|
||||
# Strip .ko from the basename
|
||||
ret.append(os.path.basename(line)[:-4])
|
||||
|
||||
for root, dirs, files in os.walk(mod_dir):
|
||||
for fn_ in files:
|
||||
if '.ko' in fn_:
|
||||
|
|
|
@ -623,6 +623,17 @@ class TCPReqServerChannel(salt.transport.mixins.auth.AESReqServerMixin, salt.tra
|
|||
'payload and load must be a dict', header=header))
|
||||
raise tornado.gen.Return()
|
||||
|
||||
try:
|
||||
id_ = payload['load'].get('id', '')
|
||||
if '\0' in id_:
|
||||
log.error('Payload contains an id with a null byte: %s', payload)
|
||||
stream.send(self.serial.dumps('bad load: id contains a null byte'))
|
||||
raise tornado.gen.Return()
|
||||
except TypeError:
|
||||
log.error('Payload contains non-string id: %s', payload)
|
||||
stream.send(self.serial.dumps('bad load: id {0} is not a string'.format(id_)))
|
||||
raise tornado.gen.Return()
|
||||
|
||||
# intercept the "_auth" commands, since the main daemon shouldn't know
|
||||
# anything about our key auth
|
||||
if payload['enc'] == 'clear' and payload.get('load', {}).get('cmd') == '_auth':
|
||||
|
|
|
@ -596,6 +596,17 @@ class ZeroMQReqServerChannel(salt.transport.mixins.auth.AESReqServerMixin, salt.
|
|||
stream.send(self.serial.dumps('payload and load must be a dict'))
|
||||
raise tornado.gen.Return()
|
||||
|
||||
try:
|
||||
id_ = payload['load'].get('id', '')
|
||||
if '\0' in id_:
|
||||
log.error('Payload contains an id with a null byte: %s', payload)
|
||||
stream.send(self.serial.dumps('bad load: id contains a null byte'))
|
||||
raise tornado.gen.Return()
|
||||
except TypeError:
|
||||
log.error('Payload contains non-string id: %s', payload)
|
||||
stream.send(self.serial.dumps('bad load: id {0} is not a string'.format(id_)))
|
||||
raise tornado.gen.Return()
|
||||
|
||||
# intercept the "_auth" commands, since the main daemon shouldn't know
|
||||
# anything about our key auth
|
||||
if payload['enc'] == 'clear' and payload.get('load', {}).get('cmd') == '_auth':
|
||||
|
|
|
@ -481,22 +481,15 @@ def clean_path(root, path, subdir=False):
|
|||
return ''
|
||||
|
||||
|
||||
def clean_id(id_):
|
||||
'''
|
||||
Returns if the passed id is clean.
|
||||
'''
|
||||
if re.search(r'\.\.{sep}'.format(sep=os.sep), id_):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def valid_id(opts, id_):
|
||||
'''
|
||||
Returns if the passed id is valid
|
||||
'''
|
||||
try:
|
||||
return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)
|
||||
except (AttributeError, KeyError) as e:
|
||||
if any(x in id_ for x in ('/', '\\', '\0')):
|
||||
return False
|
||||
return bool(clean_path(opts['pki_dir'], id_))
|
||||
except (AttributeError, KeyError, TypeError):
|
||||
return False
|
||||
|
||||
|
||||
|
|
20
setup.py
20
setup.py
|
@ -178,17 +178,22 @@ class WriteSaltVersion(Command):
|
|||
'''
|
||||
|
||||
def run(self):
|
||||
if not os.path.exists(SALT_VERSION_HARDCODED):
|
||||
if not os.path.exists(SALT_VERSION_HARDCODED) or self.distribution.with_salt_version:
|
||||
# Write the version file
|
||||
if getattr(self.distribution, 'salt_version_hardcoded_path', None) is None:
|
||||
print('This command is not meant to be called on it\'s own')
|
||||
exit(1)
|
||||
|
||||
if not self.distribution.with_salt_version:
|
||||
salt_version = __saltstack_version__
|
||||
else:
|
||||
salt_version = SaltStackVersion.parse(self.distribution.with_salt_version)
|
||||
|
||||
# pylint: disable=E0602
|
||||
open(self.distribution.salt_version_hardcoded_path, 'w').write(
|
||||
INSTALL_VERSION_TEMPLATE.format(
|
||||
date=DATE,
|
||||
full_version_info=__saltstack_version__.full_info
|
||||
full_version_info=salt_version.full_info
|
||||
)
|
||||
)
|
||||
# pylint: enable=E0602
|
||||
|
@ -701,6 +706,13 @@ class Build(build):
|
|||
def run(self):
|
||||
# Run build.run function
|
||||
build.run(self)
|
||||
if getattr(self.distribution, 'with_salt_version', False):
|
||||
# Write the hardcoded salt version module salt/_version.py
|
||||
self.distribution.salt_version_hardcoded_path = os.path.join(
|
||||
self.build_lib, 'salt', '_version.py'
|
||||
)
|
||||
self.run_command('write_salt_version')
|
||||
|
||||
if getattr(self.distribution, 'running_salt_install', False):
|
||||
# If our install attribute is present and set to True, we'll go
|
||||
# ahead and write our install time python modules.
|
||||
|
@ -805,6 +817,7 @@ class SaltDistribution(distutils.dist.Distribution):
|
|||
('ssh-packaging', None, 'Run in SSH packaging mode'),
|
||||
('salt-transport=', None, 'The transport to prepare salt for. Choices are \'zeromq\' '
|
||||
'\'raet\' or \'both\'. Defaults to \'zeromq\'', 'zeromq')] + [
|
||||
('with-salt-version=', None, 'Set a fixed version for Salt instead calculating it'),
|
||||
# Salt's Paths Configuration Settings
|
||||
('salt-root-dir=', None,
|
||||
'Salt\'s pre-configured root directory'),
|
||||
|
@ -856,6 +869,9 @@ class SaltDistribution(distutils.dist.Distribution):
|
|||
self.salt_spm_pillar_dir = None
|
||||
self.salt_spm_reactor_dir = None
|
||||
|
||||
# Salt version
|
||||
self.with_salt_version = None
|
||||
|
||||
self.name = 'salt-ssh' if PACKAGED_FOR_SALT_SSH else 'salt'
|
||||
self.salt_version = __version__ # pylint: disable=undefined-variable
|
||||
self.description = 'Portable, distributed, remote execution and configuration management system'
|
||||
|
|
|
@ -60,6 +60,16 @@ class TestVerify(TestCase):
|
|||
opts = {'pki_dir': '/tmp/whatever'}
|
||||
self.assertFalse(valid_id(opts, None))
|
||||
|
||||
def test_valid_id_pathsep(self):
|
||||
'''
|
||||
Path separators in id should make it invalid
|
||||
'''
|
||||
opts = {'pki_dir': '/tmp/whatever'}
|
||||
# We have to test both path separators because os.path.normpath will
|
||||
# convert forward slashes to backslashes on Windows.
|
||||
for pathsep in ('/', '\\'):
|
||||
self.assertFalse(valid_id(opts, pathsep.join(('..', 'foobar'))))
|
||||
|
||||
def test_zmq_verify(self):
|
||||
self.assertTrue(zmq_version())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue