-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_postfix
executable file
·57 lines (49 loc) · 2.21 KB
/
run_postfix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
command_directory=$(postconf -h command_directory)
config_directory=$(postconf -h config_directory)
mkdir -p /etc/ssl/server
postconf -e "inet_interfaces=all" \
"inet_protocols=ipv4" \
"mynetworks=${MY_NETWORKS}" \
"relayhost=${SMTP_SERVER}" \
"smtp_sasl_auth_enable=yes" \
"smtp_sasl_password_maps=lmdb:$config_directory/sasl_passwd" \
"smtp_sasl_mechanism_filter=AUTH LOGIN" \
"smtp_sasl_security_options=" \
"smtputf8_enable=no" \
"smtp_destination_rate_delay=1" \
"relay_domains=" \
"message_size_limit=104857600" \
"mailbox_size_limit=104857600" \
"maillog_file=/dev/stdout" \
"smtpd_tls_loglevel=1" \
"smtp_tls_loglevel=1" \
"smtpd_tls_received_header=yes" \
"smtpd_tls_ciphers=high" \
"smtpd_tls_protocols=!SSLv2,!SSLv3" \
"smtpd_tls_security_level=may" \
"smtp_tls_security_level=may" \
"smtpd_tls_session_cache_database=lmdb:\${data_directory}/smtpd_scache" \
"smtp_tls_session_cache_database=lmdb:\${data_directory}/smtp_scache" \
"smtpd_tls_cert_file=/etc/ssl/server/cert.pem" \
"smtpd_tls_key_file=/etc/ssl/server/key.pem" \
"smtp_tls_CApath=/etc/ssl/certs" \
"smtpd_tls_CApath=/etc/ssl/certs" \
"always_add_missing_headers=yes" \
"mime_header_checks=regexp:$config_directory/header_checks" \
"header_checks=regexp:$config_directory/header_checks" \
"smtpd_forbidden_commands=CONNECT,GET,POST,USER,PASS"
echo "${SMTP_SERVER} ${SMTP_USERNAME}:${SMTP_PASSWORD}" | postmap -i "lmdb:$config_directory/sasl_passwd"
if [[ -n "${ROOT_ALIAS}" ]]; then
if [[ -f /etc/postfix/aliases ]]; then
sed -i '/^root:/d' /etc/postfix/aliases
fi
echo "root: ${ROOT_ALIAS}" >> /etc/postfix/aliases
/usr/bin/newaliases
fi
mv /staging/header_checks "$config_directory/header_checks" \
&& chmod 644 "$config_directory/header_checks"
postmap "$config_directory/header_checks"
"${command_directory}/postfix" check 2>&1
exec "${command_directory}/postfix" start-fg