mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Allow admin to specify an smtp relay
This commit is contained in:
parent
42bc8c354a
commit
64066f85b0
3 changed files with 35 additions and 1 deletions
|
@ -23,7 +23,17 @@ do_pre_regen() {
|
|||
|
||||
# Support different strategy for security configurations
|
||||
export compatibility="$(yunohost settings get 'security.postfix.compatibility')"
|
||||
|
||||
|
||||
# Add possibility to specify a relay
|
||||
# Could be useful with some isp with no 25 port open or more complex setup
|
||||
export relay_host="$(yunohost settings get 'smtp.relay.host')"
|
||||
if [ ! -z "${relay_host}" ]; then
|
||||
export relay_port="$(yunohost settings get 'smtp.relay.port')"
|
||||
export relay_user="$(yunohost settings get 'smtp.relay.user')"
|
||||
relay_password="$(yunohost settings get 'smtp.relay.password')"
|
||||
echo "[${relay_host}]:${relay_port} ${relay_user}:${relay_password}" > /etc/postfix/sasl_passwd
|
||||
postmap /etc/postfix/sasl_passwd
|
||||
fi
|
||||
export main_domain
|
||||
export domain_list="$YNH_DOMAINS"
|
||||
ynh_render_template "main.cf" "${postfix_dir}/main.cf"
|
||||
|
|
|
@ -72,7 +72,11 @@ alias_maps = hash:/etc/aliases
|
|||
alias_database = hash:/etc/aliases
|
||||
mydomain = {{ main_domain }}
|
||||
mydestination = localhost
|
||||
{% if relay_host == "" %}
|
||||
relayhost =
|
||||
{% else %}
|
||||
relayhost = [{{ relay_host }}]:{{ relay_port }}
|
||||
{% endif %}
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_command = procmail -a "$EXTENSION"
|
||||
mailbox_size_limit = 0
|
||||
|
@ -178,3 +182,19 @@ default_destination_rate_delay = 5s
|
|||
# So it's easly possible to scan a server to know which email adress is valid
|
||||
# and after to send spam
|
||||
disable_vrfy_command = yes
|
||||
|
||||
{% if relay_user != "" %}
|
||||
# Relay email through an other smtp account
|
||||
# enable SASL authentication
|
||||
smtp_sasl_auth_enable = yes
|
||||
# disallow methods that allow anonymous authentication.
|
||||
smtp_sasl_security_options = noanonymous
|
||||
# where to find sasl_passwd
|
||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||
{% if relay_port == "587" %}
|
||||
# Enable STARTTLS encryption
|
||||
smtp_use_tls = yes
|
||||
{% endif %}
|
||||
# where to find CA certificates
|
||||
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
|
||||
{% endif %}
|
||||
|
|
|
@ -71,6 +71,10 @@ DEFAULTS = OrderedDict([
|
|||
"choices": ["intermediate", "modern"]}),
|
||||
("pop3.enabled", {"type": "bool", "default": False}),
|
||||
("smtp.allow_ipv6", {"type": "bool", "default": True}),
|
||||
("smtp.relay.host", {"type": "string", "default": ""}),
|
||||
("smtp.relay.port", {"type": "int", "default": 587}),
|
||||
("smtp.relay.user", {"type": "string", "default": ""}),
|
||||
("smtp.relay.password", {"type": "string", "default": ""}),
|
||||
])
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue