mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
settings: use email.smtp.smtp_relay_enabled
This commit is contained in:
parent
eb747cc15e
commit
f0bf8dd1fd
3 changed files with 15 additions and 11 deletions
|
@ -81,7 +81,7 @@ alias_maps = hash:/etc/aliases
|
||||||
alias_database = hash:/etc/aliases
|
alias_database = hash:/etc/aliases
|
||||||
mydomain = {{ main_domain }}
|
mydomain = {{ main_domain }}
|
||||||
mydestination = localhost
|
mydestination = localhost
|
||||||
{% if relay_host == "" %}
|
{% if relay_enabled != "True" %}
|
||||||
relayhost =
|
relayhost =
|
||||||
{% else %}
|
{% else %}
|
||||||
relayhost = [{{ relay_host }}]:{{ relay_port }}
|
relayhost = [{{ relay_host }}]:{{ relay_port }}
|
||||||
|
@ -198,7 +198,7 @@ smtpd_client_recipient_rate_limit=150
|
||||||
# and after to send spam
|
# and after to send spam
|
||||||
disable_vrfy_command = yes
|
disable_vrfy_command = yes
|
||||||
|
|
||||||
{% if relay_user != "" %}
|
{% if relay_enabled == "True" %}
|
||||||
# Relay email through an other smtp account
|
# Relay email through an other smtp account
|
||||||
# enable SASL authentication
|
# enable SASL authentication
|
||||||
smtp_sasl_auth_enable = yes
|
smtp_sasl_auth_enable = yes
|
||||||
|
|
|
@ -22,17 +22,19 @@ do_pre_regen() {
|
||||||
main_domain=$(cat /etc/yunohost/current_host)
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
|
|
||||||
# Support different strategy for security configurations
|
# Support different strategy for security configurations
|
||||||
export compatibility="$(yunohost settings get 'security.postfix.compatibility')"
|
export compatibility="$(yunohost settings get 'security.postfix.postfix_compatibility')"
|
||||||
|
|
||||||
# Add possibility to specify a relay
|
# Add possibility to specify a relay
|
||||||
# Could be useful with some isp with no 25 port open or more complex setup
|
# Could be useful with some isp with no 25 port open or more complex setup
|
||||||
export relay_port=""
|
export relay_port=""
|
||||||
export relay_user=""
|
export relay_user=""
|
||||||
export relay_host="$(yunohost settings get 'smtp.relay.host')"
|
export relay_host=""
|
||||||
if [ -n "${relay_host}" ]; then
|
export relay_enabled="$(yunohost settings get 'email.smtp.smtp_relay_enabled')"
|
||||||
relay_port="$(yunohost settings get 'smtp.relay.port')"
|
if [ "${relay_enabled}" == "True" ]; then
|
||||||
relay_user="$(yunohost settings get 'smtp.relay.user')"
|
relay_host="$(yunohost settings get 'email.smtp.smtp_relay_host')"
|
||||||
relay_password="$(yunohost settings get 'smtp.relay.password')"
|
relay_port="$(yunohost settings get 'email.smtp.smtp_relay_port')"
|
||||||
|
relay_user="$(yunohost settings get 'email.smtp.smtp_relay_user')"
|
||||||
|
relay_password="$(yunohost settings get 'email.smtp.smtp_relay_password')"
|
||||||
|
|
||||||
# Avoid to display "Relay account paswword" to other users
|
# Avoid to display "Relay account paswword" to other users
|
||||||
touch ${postfix_dir}/sasl_passwd
|
touch ${postfix_dir}/sasl_passwd
|
||||||
|
@ -54,7 +56,7 @@ do_pre_regen() {
|
||||||
>"${default_dir}/postsrsd"
|
>"${default_dir}/postsrsd"
|
||||||
|
|
||||||
# adapt it for IPv4-only hosts
|
# adapt it for IPv4-only hosts
|
||||||
ipv6="$(yunohost settings get 'smtp.allow_ipv6')"
|
ipv6="$(yunohost settings get 'email.smtp.smtp_allow_ipv6')"
|
||||||
if [ "$ipv6" == "False" ] || [ ! -f /proc/net/if_inet6 ]; then
|
if [ "$ipv6" == "False" ] || [ ! -f /proc/net/if_inet6 ]; then
|
||||||
sed -i \
|
sed -i \
|
||||||
's/ \[::ffff:127.0.0.0\]\/104 \[::1\]\/128//g' \
|
's/ \[::ffff:127.0.0.0\]\/104 \[::1\]\/128//g' \
|
||||||
|
|
|
@ -28,7 +28,9 @@ class MyMigration(Migration):
|
||||||
raise YunohostError("global_settings_cant_open_settings", reason=e)
|
raise YunohostError("global_settings_cant_open_settings", reason=e)
|
||||||
|
|
||||||
settings = { k: v['values'] for k,v in old_settings.items() }
|
settings = { k: v['values'] for k,v in old_settings.items() }
|
||||||
|
|
||||||
|
if settings.get('smtp.relay.host') != "":
|
||||||
|
settings['email.smtp.smtp_relay_enabled'] == "True"
|
||||||
|
|
||||||
args = urllib.parse.urlencode(settings)
|
args = urllib.parse.urlencode(settings)
|
||||||
settings_set(args=args)
|
settings_set(args=args)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue