This repository has been archived on 2021-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
mail/postfix/postfix.sh

45 lines
1.2 KiB
Bash
Raw Normal View History

2018-03-08 15:45:31 +01:00
#!/bin/sh
2018-03-15 16:32:17 +01:00
[ -e /etc/postfix/dh-params/512.pem ] || openssl gendh -out /etc/postfix/dh-params/512.pem -2 512
[ -e /etc/postfix/dh-params/2048.pem ] || openssl gendh -out /etc/postfix/dh-params/2048.pem -2 2048
2018-03-08 15:45:31 +01:00
2018-03-15 16:32:17 +01:00
postconf -e myhostname="$MYHOSTNAME"
postconf -e mydomain="$MYDOMAIN"
postconf -e mail_name="$MAIL_NAME"
2018-03-08 15:45:31 +01:00
2018-03-15 16:32:17 +01:00
postconf -e message_size_limit="$MESSAGE_SIZE_LIMIT"
2018-03-08 15:45:31 +01:00
2018-03-15 16:32:17 +01:00
postconf -e smtpd_tls_key_file="$TLS_KEY"
postconf -e smtpd_tls_cert_file="$TLS_FULLCHAIN"
2018-03-08 15:45:31 +01:00
2018-03-24 18:52:46 +01:00
postconf -e virtual_mailbox_domains="$DOMAINS"
for hash in access_recipient access_sender access_helo;do #virtual;do
touch /etc/postfix/$hash
postmap /etc/postfix/$hash
done
# set ldap search base
sed -i \
-e "s/@@SEARCH_BASE@@/${LDAP_BASE}/g" \
-e "s/@@SERVER_HOST@@/${LDAP_SERVER}/g" \
/etc/postfix/ldap/virtual_mailbox_maps.cf
# is cidr, so not included in the hash section
touch /etc/postfix/access_client
echo "MAILER-DAEMON: postmaster\npostmaster: $POSTMASTER" > /etc/postfix/aliases
newaliases
2018-03-15 16:32:17 +01:00
# is mounted, so no default structure
(
cd /var/spool/postfix
chown postfix:postfix .
2018-03-24 18:52:46 +01:00
for dir in active bounce corrupt defer deferred flush hold incoming maildrop pid private public saved trace; do
2018-03-15 16:32:17 +01:00
mkdir -p $dir
chown postfix:postfix $dir
done
)
exec /usr/lib/postfix/master -c /etc/postfix -d