You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
969 B
31 lines
969 B
#!/bin/sh
|
|
|
|
# fail immediately if any command fails
|
|
set -e
|
|
|
|
### Users ###
|
|
|
|
# copy users db to dovecot config
|
|
cp /vol/db/users /etc/dovecot/users
|
|
chown dovecot:dovecot /etc/dovecot/users
|
|
|
|
# copy users db to postfix config, but without passwords
|
|
cat /vol/db/users | cut -d':' -f1 | perl -pe 's/(.*)/\1 ./' > /etc/postfix/users
|
|
postmap /etc/postfix/users
|
|
|
|
### Aliases ###
|
|
|
|
# make self-referential users list
|
|
# this is needed for the reject_sender_login_mismatch restriction to work,
|
|
# otherwise users cannot send emails as their own address
|
|
mkdir -p /vol/db/aliases_out.d
|
|
cd /vol/db/aliases_out.d
|
|
echo "# This file is autogenerated by mkvirt. Don't edit it manually." > self.list
|
|
cat /vol/db/users | cut -d':' -f1 | perl -pe 's/(.*)/\1\@brbytes.org \1\n\1\@mail.brbytes.org \1/' >> self.list
|
|
|
|
# copy aliases to postifx config
|
|
cd /etc/postfix
|
|
cat /vol/db/aliases_out.d/*.list > aliases_out
|
|
postmap aliases_out
|
|
cat /vol/db/aliases_in.d/*.list > aliases_in
|
|
postmap aliases_in
|
|
|