docker-smtp-relay/rootfs/app/entrypoint.sh
paspo 5e3362c3e8
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Vulnerability Scan / Daily Vulnerability Scan (push) Failing after 16s
initial import
2024-05-20 21:35:34 +02:00

61 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
mkdir -p /config
touch /config/virtual /config/sender_access /config/relay_by_sender /config/relay_recipients /config/bcc
postmap /config/virtual
postmap /config/sender_access
postmap /config/relay_by_sender
postmap /config/relay_recipients
postmap /config/bcc
# set postfix config
postconf myhostname="${MYHOSTNAME:-$(hostname || true)}"
postconf mailbox_size_limit=0
postconf virtual_alias_maps=lmdb:/config/virtual
postconf sender_bcc_maps=lmdb:/config/bcc
postconf append_dot_mydomain=no
postconf allow_percent_hack=no
postconf readme_directory=no
postconf sender_dependent_relayhost_maps=lmdb:/config/relay_by_sender
postconf message_size_limit=50480000
postconf smtpd_sender_restrictions="reject_non_fqdn_sender reject_unknown_sender_domain reject_unlisted_sender reject_unverified_sender"
postconf relay_recipient_maps=lmdb:/config/relay_recipients
postconf relay_domains=lmdb:/config/sender_access
# TODO verificare che questo funzioni, di solito è su due linee
# TODO e serve???
postconf smtpd_relay_restrictions="check_sender_access lmdb:/config/sender_access, defer_unauth_destination"
### this is a relay
### there are no mailboxes
### so local delivery is disabled
postconf mydestination=
postconf local_recipient_maps=
postconf local_transport="error: local main delivery disabled"
### destination relay authentication
# smtp_sasl_auth_enable = yes
# smtp_sasl_password_maps = lmdb:/config/sasl_passwd
# smtp_sasl_security_options = noanonymous
# smtp_tls_security_level = may
# header_size_limit = 4096000
### TLS
# smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
# smtpd_use_tls=yes
# smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
# smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# smtpd_sasl_auth_enable = yes
# smtpd_sasl_security_options = noanonymous
# broken_sasl_auth_clients = yes
# smtp_tls_security_level = may
# tls_server_sni_maps = lmdb:/config/sni_map
postconf maillog_file=/dev/stdout
### app start
postfix -c /etc/postfix start-fg