1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-18 03:21:36 +02:00

change the logic as discussed

This commit is contained in:
Florent Daigniere 2023-10-07 09:35:53 +02:00
parent 3985d1d044
commit dd58d51156
5 changed files with 17 additions and 6 deletions

View File

@ -79,7 +79,6 @@ COPY --chown=root:root --from=build /app/snuffleupagus.so /usr/lib/php81/modules
ENV \
VIRTUAL_ENV=/app/venv \
PATH="/app/venv/bin:${PATH}" \
LD_PRELOAD="/usr/lib/libhardened_malloc.so" \
ADMIN_ADDRESS="admin" \
FRONT_ADDRESS="front" \
SMTP_ADDRESS="smtp" \

View File

@ -80,9 +80,8 @@ def set_env(required_secrets=[], log_filters=[], log_file=None):
sys.stderr = LogFilter(sys.stderr, log_filters, log_file)
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", 'WARNING'))
if 'LD_PRELOAD' in os.environ and not _is_compatible_with_hardened_malloc():
log.warning('Disabling hardened-malloc on this CPU: it requires Advanced Vector Extensions.')
del os.environ['LD_PRELOAD']
if not 'LD_PRELOAD' in os.environ and _is_compatible_with_hardened_malloc():
log.warning('Your CPU has Advanced Vector Extensions available, we recommend you enable hardened-malloc by adding LD_PRELOAD=/usr/lib/libhardened_malloc.so to your mailu.env')
""" This will set all the environment variables and retains only the secrets we need """
if 'SECRET_KEY_FILE' in os.environ:

View File

@ -152,3 +152,8 @@ REJECT_UNLISTED_RECIPIENT=
# Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET)
LOG_LEVEL=WARNING
# If your CPU supports Advanced Vector Extensions
# (AVX2 on x86_64, lrcpc on ARM64), you should consider enabling
# hardened-malloc by uncommenting this
# LD_PRELOAD=/usr/lib/libhardened_malloc.so

View File

@ -76,6 +76,14 @@ Review configuration variables
After downloading the files, open ``mailu.env`` and review the variable settings.
Make sure to read the comments in the file and instructions from the :ref:`common_cfg` page.
If your CPU supports Advanced Vector Extensions (AVX2 on x86_64, lrcpc on ARM64), you should
consider enabling hardened-malloc by adding the following to your mailu.env:
.. code-block:: bash
LD_PRELOAD=/usr/lib/libhardened_malloc.so
Finish setting up TLS
---------------------

View File

@ -1,2 +1,2 @@
Hardened malloc was not disabled for oletools when CPU misses required flags.
Updated hardened malloc test that AVX2 is also required now.
Update hardened malloc as the original package is not available from alpine anymore.
The newer version of hardened malloc requires AVX2: Disable it by default and hint in the logs when it should be enabled instead.