Skip to content

Instantly share code, notes, and snippets.

@alexh-name
Last active June 12, 2016 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexh-name/80197620dfe2068a3c4ce5f892bad7ba to your computer and use it in GitHub Desktop.
Save alexh-name/80197620dfe2068a3c4ce5f892bad7ba to your computer and use it in GitHub Desktop.
#!/bin/sh
# Copy from http://www.lifewithqmail.org/ by Dave Sill, 30 November 2007
# License: "Life with qmail is covered by the OpenContent License, version 1.0. See http://www.opencontent.org/opl.shtml for the full license. Basically, you can copy, redistribute, or modify Life with qmail provided that modified versions, if redistributed, are also covered by the OpenContent License."
# https://web.archive.org/web/19981206111937/http://www.opencontent.org/opl.shtml
# or https://gist.github.com/alexh-name/ee2a9003039a284766f9ddd43a26e91b
# I slightly changed it. Alex H., 2016.
QMAILDUID="$(id -u qmaild)"
NOFILESGID="$(id -g qmaild)"
MAXSMTPD="$(cat /var/qmail/control/concurrencyincoming)"
LOCAL="$(head -1 /var/qmail/control/me)"
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 64000000 \
/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment