mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-04 05:25:54 +08:00
Fix #227: Add msal library to installation
This commit is contained in:
parent
4f058d420b
commit
b96f9e0cc0
3 changed files with 18 additions and 12 deletions
|
@ -26,12 +26,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache-
|
||||||
--mount=type=tmpfs,target=/tmp \
|
--mount=type=tmpfs,target=/tmp \
|
||||||
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
|
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
|
||||||
sh /build-scripts/postfix-install.sh
|
sh /build-scripts/postfix-install.sh
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache-apt-$TARGETPLATFORM \
|
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=var-lib-apt-$TARGETPLATFORM \
|
|
||||||
--mount=type=tmpfs,target=/var/cache/apk \
|
|
||||||
--mount=type=tmpfs,target=/tmp \
|
|
||||||
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
|
|
||||||
python3 -m pip3 install msal
|
|
||||||
|
|
||||||
# ============================ BUILD SASL XOAUTH2 ============================
|
# ============================ BUILD SASL XOAUTH2 ============================
|
||||||
FROM base AS sasl
|
FROM base AS sasl
|
||||||
|
|
|
@ -34,6 +34,8 @@ do_alpine() {
|
||||||
musl-utils \
|
musl-utils \
|
||||||
netcat-openbsd \
|
netcat-openbsd \
|
||||||
opendkim-utils \
|
opendkim-utils \
|
||||||
|
python3 \
|
||||||
|
py3-pip
|
||||||
rsyslog \
|
rsyslog \
|
||||||
supervisor \
|
supervisor \
|
||||||
tzdata
|
tzdata
|
||||||
|
@ -80,12 +82,15 @@ do_ubuntu() {
|
||||||
opendkim-tools \
|
opendkim-tools \
|
||||||
postfix-lmdb \
|
postfix-lmdb \
|
||||||
procps \
|
procps \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
rsyslog \
|
rsyslog \
|
||||||
sasl2-bin \
|
sasl2-bin \
|
||||||
supervisor \
|
supervisor \
|
||||||
tzdata
|
tzdata
|
||||||
apt-get clean
|
apt-get clean
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f /etc/alpine-release ]; then
|
if [ -f /etc/alpine-release ]; then
|
||||||
|
@ -94,6 +99,13 @@ else
|
||||||
do_ubuntu
|
do_ubuntu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# masl is needed for the sasl-xoauth2-tool.
|
||||||
|
PIP=pip
|
||||||
|
if command -v pip3 > /dev/null 2>&1; then
|
||||||
|
PIP=pip3
|
||||||
|
fi
|
||||||
|
$PIP install --break-system-packages msal
|
||||||
|
|
||||||
# Some services (eg. cron) will complain if this file does not exists, even if it's empty.
|
# Some services (eg. cron) will complain if this file does not exists, even if it's empty.
|
||||||
# The file is usually generated by update-locales, which is ran automatically when you do
|
# The file is usually generated by update-locales, which is ran automatically when you do
|
||||||
# `apt-get install locales`. So instead of adding another package, which at the moment we
|
# `apt-get install locales`. So instead of adding another package, which at the moment we
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Filter to anonyimize email addresses. It reads input line by line,
|
Filter to anonymize email addresses. It reads input line by line,
|
||||||
finds all emails in the input and masks them using given filter.
|
finds all emails in the input and masks them using given filter.
|
||||||
|
|
||||||
Big thanks to [Sergio Del Río Mayoral](https://github.com/sdelrio)
|
Big thanks to [Sergio Del Río Mayoral](https://github.com/sdelrio)
|
||||||
|
@ -26,8 +26,8 @@ logger = logging.getLogger(__name__)
|
||||||
# BIG FAT NOTICE on emails and regular expressions:
|
# BIG FAT NOTICE on emails and regular expressions:
|
||||||
# If you're planning on using a regular expression to validate an email: don't. Emails
|
# If you're planning on using a regular expression to validate an email: don't. Emails
|
||||||
# are much more complex than you would imagine and most regular expressions will not
|
# are much more complex than you would imagine and most regular expressions will not
|
||||||
# cover all usecases. Newer RFCs even allow for international (read: UTF-8) email addresses.
|
# cover all use cases. Newer RFCs even allow for international (read: UTF-8) email addresses.
|
||||||
# Most of your favourite programming languages will have a dedicated library for validating
|
# Most of your favorite programming languages will have a dedicated library for validating
|
||||||
# addresses.
|
# addresses.
|
||||||
#
|
#
|
||||||
# This pattern below, should, however match anything that remotely looks like an email.
|
# This pattern below, should, however match anything that remotely looks like an email.
|
||||||
|
@ -85,7 +85,7 @@ class Filter():
|
||||||
start = match.start()
|
start = match.start()
|
||||||
email = match.group()
|
email = match.group()
|
||||||
|
|
||||||
# Note that our regex will match thigs like "message-id=Issue1649523226559@postfix-mail.mail-system.svc.cluster.local"
|
# Note that our regex will match things like "message-id=Issue1649523226559@postfix-mail.mail-system.svc.cluster.local"
|
||||||
# so we need to filter / check for these first
|
# so we need to filter / check for these first
|
||||||
|
|
||||||
if email.startswith(self.MESSAGE_ID_LINE):
|
if email.startswith(self.MESSAGE_ID_LINE):
|
||||||
|
@ -123,9 +123,9 @@ class Filter():
|
||||||
"""
|
"""
|
||||||
This filter will take an educated guess at how to best mask the emails, specifically:
|
This filter will take an educated guess at how to best mask the emails, specifically:
|
||||||
|
|
||||||
* It will leave the first and the last letter of the local part (if it's oly one letter, it will get repated)
|
* It will leave the first and the last letter of the local part (if it's oly one letter, it will get repeated)
|
||||||
* If the local part is in quotes, it will remove the quotes (Warning: if the email starts with a space, this might look weird in logs)
|
* If the local part is in quotes, it will remove the quotes (Warning: if the email starts with a space, this might look weird in logs)
|
||||||
* It will replace all the letters inbetween with **ONE** asterisk
|
* It will replace all the letters in between with **ONE** asterisk
|
||||||
* It will replace everything but a TLD with a star
|
* It will replace everything but a TLD with a star
|
||||||
* Address-style domains will see the number replaced with stars
|
* Address-style domains will see the number replaced with stars
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue