Files
kumomta/assets/install.sh
T
Wez Furlong 48e89105a7 fix provider rule matching with MXSuffix
Given a provider with the following config:

```json
      "match": [
        {
          "MXSuffix": "mta5.am0.yahoodns.net"
        },
        {
          "MXSuffix": "mta6.am0.yahoodns.net"
        },
        {
          "MXSuffix": "mta7.am0.yahoodns.net"
        }
      ]
```

(Note that this configuration is not ideal because someone with
`notreallymta5.am0.yahoodns.net` in their MX records will match
this.  If you were using SMTP auth for such a site, then you risk
leaking your credentials to it! We should consider adding an exact
match option for this case)

we could never match this because the logic had the inner and outer
loops swapped.

For a provider to match, all of the resolved host names must match
at least one of the MXSuffixes defined in the rule.

The flipped logic prevented that from matching.

Most of this commit is adding stuff to help trace this down
and debug it.

In particular, `resolve-queue-config` will tell you what the
effective value of the get-queue-config event is for a given
queue name, and `resolve-shaping-domain` will show you the shaping
configuration for a (bogus) source.
2024-12-16 12:46:31 -07:00

44 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# This script is an implementation detail of the package builder automatioon.
# It is not intended to be run directly by humans.
# It may change its behavior in unpredictable ways and should not be relied
# upon by anyone or anything other than build-deb.sh and build-rpm.sh
set -ex
PREFIX="${1:-/opt/kumomta}"
CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-${PWD}/target}
# If KEEP_DEBUG==yes, we preserve debug info for kumod and tsa-daemon only.
# The other binaries we always strip to balance overall package size.
STRIP=
[[ "${KEEP_DEBUG}" == "yes" ]] || STRIP="-s"
mkdir -p ${PREFIX}/sbin ${PREFIX}/share/bounce_classifier ${PREFIX}/share/policy-extras ${PREFIX}/share/community
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/validate-shaping -t ${PREFIX}/sbin
install -Dm755 ${STRIP} ${CARGO_TARGET_DIR}/${TRIPLE}release/tsa-daemon -t ${PREFIX}/sbin
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/proxy-server -t ${PREFIX}/sbin
install -Dm755 ${STRIP} ${CARGO_TARGET_DIR}/${TRIPLE}release/kumod -t ${PREFIX}/sbin
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/kcli -t ${PREFIX}/sbin
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/traffic-gen -t ${PREFIX}/sbin
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/tailer -t ${PREFIX}/sbin
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/toml2jsonc -t ${PREFIX}/sbin
install -Dsm755 ${CARGO_TARGET_DIR}/${TRIPLE}release/tls-probe -t ${PREFIX}/sbin
install -Dm755 assets/accounting.sh -t ${PREFIX}/sbin
install -Dm755 assets/resolve-site-name -t ${PREFIX}/sbin
install -Dm755 assets/resolve-queue-config -t ${PREFIX}/sbin
install -Dm755 assets/resolve-shaping-domain -t ${PREFIX}/sbin
install -Dm644 assets/bounce_classifier/* -t ${PREFIX}/share/bounce_classifier
install -Dm644 assets/init.lua -T ${PREFIX}/share/minimal-init.lua
install -Dm644 assets/tsa_init.lua -T ${PREFIX}/share/minimal-tsa_init.lua
install -Dm644 assets/policy-extras/*.lua -t ${PREFIX}/share/policy-extras
install -Dm644 assets/policy-extras/*.toml -t ${PREFIX}/share/policy-extras
install -Dm644 assets/community/*.toml -t ${PREFIX}/share/community
if test "$EUID" -eq 0 && getent passwd kumod >/dev/null && getent group kumod >/dev/null ; then
for dir in /opt/kumomta/etc /opt/kumomta/etc/policy ; do
[ -d "$dir" ] || install -d --mode 755 --owner kumod --group kumod $dir
done
for dir in /var/spool/kumomta /var/log/kumomta /opt/kumomta/etc/dkim ; do
[ -d "$dir" ] || install -d --mode 2770 --owner kumod --group kumod $dir
done
fi