1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-30 04:30:49 +02:00
This commit is contained in:
Florent Daigniere 2023-04-14 10:09:51 +02:00
parent 7b08232049
commit b6ed4fd83e
2 changed files with 14 additions and 1 deletions

View File

@ -61,12 +61,24 @@ class LogFilter(object):
def flush(self):
self.stream.flush()
def _is_compatible_with_hardened_malloc():
with open('/proc/cpuinfo', 'r') as f:
lines = f.readlines()
for line in lines:
# See #2764, we need vmovdqu
if line.startswith('flags') and ' avx ' not in line:
return False
return True
def set_env(required_secrets=[], log_filters=[], log_file=None):
if log_filters:
sys.stdout = LogFilter(sys.stdout, log_filters, log_file)
sys.stderr = LogFilter(sys.stderr, log_filters, log_file)
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", 'WARNING'))
if not _is_compatible_with_hardened_malloc():
del os.environ['LD_PRELOAD']
""" This will set all the environment variables and retains only the secrets we need """
if 'SECRET_KEY_FILE' in os.environ:
try:

View File

@ -1 +1,2 @@
Filter unwanted logs.
Filter unwanted logs out.
Disable hardened-malloc if we detect a processor not supporting the AVX extension set