46 lines
1.3 KiB
Bash
Executable file
46 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
[ -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
|
|
|
|
postconf -e myhostname="$MYHOSTNAME"
|
|
postconf -e mydomain="$MYDOMAIN"
|
|
postconf -e mail_name="$MAIL_NAME"
|
|
|
|
postconf -e message_size_limit="$MESSAGE_SIZE_LIMIT"
|
|
|
|
postconf -e smtpd_tls_key_file="$TLS_KEY"
|
|
postconf -e smtpd_tls_cert_file="$TLS_FULLCHAIN"
|
|
|
|
postconf -e virtual_mailbox_domains="$DOMAINS"
|
|
|
|
for hash in access_recipient access_sender access_helo virtual;do
|
|
touch /etc/postfix/$hash
|
|
chown root:root /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
|
|
|
|
# is mounted, so no default structure
|
|
(
|
|
cd /var/spool/postfix
|
|
chown postfix:postfix .
|
|
for dir in active bounce corrupt defer deferred flush hold incoming maildrop pid private public saved trace; do
|
|
mkdir -p $dir
|
|
chown postfix:postfix $dir
|
|
done
|
|
)
|
|
|
|
exec /usr/lib/postfix/master -c /etc/postfix -d
|