Commit 0351603c authored by Dashamir Hoxha's avatar Dashamir Hoxha
Browse files

Replace procmail with maildrop

parent a42a570b
......@@ -22,7 +22,7 @@ RUN apt install --yes \
# packages for WKS/WKD
RUN apt install --yes \
gpg-wks-server \
procmail \
maildrop \
sudo \
apache2
RUN systemctl disable apache2 && \
......
......@@ -32,14 +32,15 @@ _enable() {
ds exec postmap config/virtual_alias_maps.cf
# store emails to the directory Mail on the home
cat <<EOF > register/.procmailrc
LOGFILE=\$HOME/procmail.log
LOCKFILE=\$HOME/.lockmail
VERBOSE=yes
:0 c
Mail/
cat <<EOF > register/.mailfilter
logfile maildrop.log
to Mail
EOF
chmod 600 /host/register/.mailfilter
touch /host/register/maildrop.log
rm -rf /host/register/Mail
maildirmake /host/register/Mail
chown register: -R /host/register/
# install a cron job
local appdir=$(basename $(pwd))
......
......@@ -5,13 +5,15 @@ source /host/settings.sh
# make sure that the needed packages are installed
apt install --yes \
gpg-wks-server \
procmail \
maildrop \
sudo \
apache2
# create user webkey
adduser --system \
--group \
--disabled-password \
--shell /bin/bash \
--home /host/wks \
webkey
......@@ -49,56 +51,52 @@ systemctl unmask apache2
systemctl enable apache2
systemctl start apache2
# install procmail recipes for the account webkey
# install maildrop filters for the account webkey
cat <<'EOF' >> /etc/maildroprc
FROMDAEMON=0
foreach /^((Resent-)?(From|Sender)|X-Envelope-From): .*/
{
foreach ( getaddr $MATCH =~ /.+/ )
{
ADDR=$MATCH
if ( $ADDR =~ /(Post(ma(st(er)?|n)|office)|(send)?Mail(er)?|daemon|mmdf|n?uucp|ops|r(esponse|oot)|(bbs\.)?smtp(error)?|s(erv(ices?|er)|ystem)|A(dmin(istrator)?|MMGR))/ )
{
FROMDAEMON=1
}
}
}
EOF
submission_address=keys@$MAIL_DOMAIN
[[ -f /host/wks/.procmailrc ]] ||
cat <<EOF > /host/wks/.procmailrc
LOGFILE=\$HOME/procmail.log
LOCKFILE=\$HOME/.lockmail
:0
* ^FROM_DAEMON
/dev/null
:0 w
* !^From: $submission_address
* !^X-WKS-Loop: $submission_address
| gpg-wks-server \\
--directory /host/wkd \\
--receive \\
--header X-WKS-Loop=$submission_address \\
--from $submission_address \\
--send
[[ -f /host/wks/.mailfilter ]] ||
cat <<EOF > /host/wks/.mailfilter
logfile maildrop.log
:0 e
/dev/null
EOF
cat <<EOF > /host/wks/.procmailrc.debug
LOGFILE=\$HOME/procmail.log
LOCKFILE=\$HOME/.lockmail
VERBOSE=yes
:0
* ^FROM_DAEMON
from-daemon/
:0 c
archive/
:0 w
* !^From: $submission_address
* !^X-WKS-Loop: $submission_address
| gpg-wks-server -v \\
### uncomment for debugging
# cc archive/
if ( \$FROMDAEMON )
to /dev/null
if ( /^From: *$submission_address/ )
to /dev/null
if ( /^X-WKS-Loop: *$submission_address/ )
to /dev/null
# else
to "| gpg-wks-server \\
--directory /host/wkd \\
--receive \\
--header X-WKS-Loop=$submission_address \\
--from $submission_address \\
--send \\
-o \$HOME/sent
:0 e
cruft/
--send"
EOF
chmod 600 /host/wks/.mailfilter
touch /host/wks/maildrop.log
rm -rf /host/wks/archive
maildirmake /host/wks/archive
chown webkey: -R /host/wks/
### setup a cron job to expire non confirmed publication requests
cat <<EOF | sudo -H -u webkey crontab -
......@@ -116,6 +114,6 @@ if [[ -n $WEBKEY_DOMAINS ]]; then
fi
postmap $alias_file
# enable procmail processing on postfix
postconf 'mailbox_command = /usr/bin/procmail -a "$EXTENSION"'
# enable maildrop processing on postfix
postconf 'mailbox_command = /usr/bin/maildrop -d ${USER}'
postfix reload
......@@ -43,15 +43,19 @@ set -o verbose
# Store emails to the directory Mail on the home
##
:; cat <<EOF > test/test1/.procmailrc
LOGFILE=\$HOME/procmail.log
LOCKFILE=\$HOME/.lockmail
VERBOSE=yes
:0 c
Mail/
:; cat <<EOF > test/test1/.mailfilter
logfile maildrop.log
to Mail
EOF
:; ds exec chmod 600 /host/test/test1/.mailfilter
:; ds exec touch /host/test/test1/maildrop.log
:; ds exec maildirmake /host/test/test1/Mail
:; ds exec chown test1: -R /host/test/test1/
#
# Create a gpg key for test1
##
......@@ -90,7 +94,7 @@ sleep 3
:; ds exec tail /var/log/mail.log -n 15
:; tail wks/procmail.log -n 20
:; tail wks/maildrop.log
#
# Send a confirmation message
......@@ -111,7 +115,7 @@ sleep 3
:; ds exec tail /var/log/mail.log -n 15
:; tail wks/procmail.log -n 20
:; tail wks/maildrop.log
#
# Check that the key is already published
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment