Skip to content

Commit

Permalink
Fix: Make sure to use the proper name for pluginviewer based on distro
Browse files Browse the repository at this point in the history
Debian/Ubuntu use 'saslpluginviewer`, so we should check for that.
  • Loading branch information
bokysan committed Oct 27, 2023
1 parent 945add7 commit e8c6cd5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build-scripts/postfix-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fi

do_alpine() {
apk update
apk add --upgrade cyrus-sasl cyrus-sasl-static cyrus-sasl-digestmd5 cyrus-sasl-crammd5 cyrus-sasl-login cyrus-sasl-ntlm
apk add --upgrade cyrus-sasl cyrus-sasl-static cyrus-sasl-digestmd5 cyrus-sasl-crammd5 cyrus-sasl-login cyrus-sasl-ntlm libsasl
apk add postfix
apk add opendkim
apk add --upgrade ca-certificates tzdata supervisor rsyslog musl musl-utils bash opendkim-utils libcurl jsoncpp lmdb logrotate netcat-openbsd
Expand All @@ -21,7 +21,7 @@ do_ubuntu() {
export DEBIAN_FRONTEND=noninteractive
echo "Europe/Berlin" > /etc/timezone
apt-get update -y -q
apt-get install -y libsasl2-modules
apt-get install -y libsasl2-modules sasl2-bin
apt-get install -y postfix
apt-get install -y opendkim
apt-get install -y ca-certificates tzdata supervisor rsyslog bash opendkim-tools curl libcurl4 libjsoncpp25 sasl2-bin postfix-lmdb logrotate cron net-tools ${RELEASE_SPECIFIC_PACKAGES}
Expand Down
5 changes: 5 additions & 0 deletions integration-tests/external-tools-test/tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ fi
if ! hash nc; then
echo "netcat not found!" >2
exit 1
fi

if ! hash pluginviewer && ! hash saslpluginviewer; then
echo "pluginviewer not found!" >2
exit 1
fi
8 changes: 7 additions & 1 deletion scripts/common-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ EOF

postfix_setup_xoauth2_post_setup() {
local other_plugins
local plugin_viewer="pluginviewer"
if [ -n "$XOAUTH2_CLIENT_ID" ] || [ -n "$XOAUTH2_SECRET" ]; then
do_postconf -e 'smtp_sasl_security_options='
do_postconf -e 'smtp_sasl_mechanism_filter=xoauth2'
Expand All @@ -338,7 +339,12 @@ postfix_setup_xoauth2_post_setup() {
#
# The fix is therefore simple: If we're not using OAuth2, we remove the plugin from the list and
# keep all the plugins installed.
other_plugins="$(pluginviewer -c | grep Plugin | cut -d\ -f2 | cut -c2- | rev | cut -c2- | rev | grep -v EXTERNAL | grep -v sasl-xoauth2 | tr '\n' ',' | rev | cut -c2- | rev)"

if hash saslpluginviewer > /dev/null 2>&1; then
# Ubuntu/Debian have renamed pluginviewer to saslpluginviewer so this fails with those distros.
plugin_viewer="saslpluginviewer"
fi
other_plugins="$(${plugin_viewer} -c | grep Plugin | cut -d\ -f2 | cut -c2- | rev | cut -c2- | rev | grep -v EXTERNAL | grep -v sasl-xoauth2 | tr '\n' ',' | rev | cut -c2- | rev)"
do_postconf -e "smtp_sasl_mechanism_filter=${other_plugins}"
fi
}
Expand Down

0 comments on commit e8c6cd5

Please sign in to comment.