Added an option to limit max size in files_recv

The default is set to 100MB, which means pushing
larger files will stop when reaches this limit.
This limit can be adjusted by file_recv_max_size
option in the master's config file.
This commit is contained in:
Amir Pakdel 2013-12-08 15:01:20 -05:00
parent 92b37c37d6
commit c934a9bd36
2 changed files with 12 additions and 0 deletions

View file

@ -188,6 +188,10 @@
# security purposes.
#file_recv: False
# Set a hard-limit on the size of the files that can be pushed to the master.
# Default: 100MB
#file_recv_max_size: 1024*1024*100
##### Master Module Management #####
##########################################
# Manage how master side modules are loaded

View file

@ -1154,6 +1154,14 @@ class AESFuncs(object):
return False
if not salt.utils.verify.valid_id(self.opts, load['id']):
return False
file_recv_max_size = self.opts.get('file_recv_max_size', 1024*1024*100)
if len(load['data']) + load.get('loc', 0) > file_recv_max_size:
log.error(
'Exceeding file_recv_max_size limit: {0}'.format(
file_recv_max_size
)
)
return False
if 'tok' not in load:
log.error(
'Received incomplete call from {0} for {1!r}, missing {2!r}'