mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-12-25 07:47:05 +00:00
Move settings away from mailinabox.conf
This commit is contained in:
parent
5e080bedb6
commit
9b6781685a
@ -523,11 +523,12 @@ def privacy_status_set():
|
|||||||
@app.route('/system/smtp/relay', methods=["GET"])
|
@app.route('/system/smtp/relay', methods=["GET"])
|
||||||
@authorized_personnel_only
|
@authorized_personnel_only
|
||||||
def smtp_relay_get():
|
def smtp_relay_get():
|
||||||
|
config = utils.load_settings(env)
|
||||||
return {
|
return {
|
||||||
"enabled": (env["SMTP_RELAY_ENABLED"] == "true"),
|
"enabled": (config.get("SMTP_RELAY_ENABLED", "true") == "true"),
|
||||||
"host": env["SMTP_RELAY_HOST"],
|
"host": config.get("SMTP_RELAY_HOST", ""),
|
||||||
"auth_enabled": (env["SMTP_RELAY_AUTH"] == "true"),
|
"auth_enabled": (config.get("SMTP_RELAY_AUTH", "false") == "true"),
|
||||||
"user": env["SMTP_RELAY_USER"]
|
"user": config.get("SMTP_RELAY_USER", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
@app.route('/system/smtp/relay', methods=["POST"])
|
@app.route('/system/smtp/relay', methods=["POST"])
|
||||||
@ -544,7 +545,7 @@ def smtp_relay_set():
|
|||||||
config["SMTP_RELAY_USER"] = newconf.get("user")
|
config["SMTP_RELAY_USER"] = newconf.get("user")
|
||||||
utils.write_settings(config, env)
|
utils.write_settings(config, env)
|
||||||
# Restart Postfix
|
# Restart Postfix
|
||||||
return "OK"
|
return utils.shell("check_output", ["/usr/bin/systemctl", "restart", "postfix"], capture_stderr=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return (str(e), 500)
|
return (str(e), 500)
|
||||||
|
|
||||||
|
@ -273,13 +273,6 @@ touch /etc/postfix/sasl_passwd
|
|||||||
chmod 600 /etc/postfix/sasl_passwd
|
chmod 600 /etc/postfix/sasl_passwd
|
||||||
postmap /etc/postfix/sasl_passwd
|
postmap /etc/postfix/sasl_passwd
|
||||||
|
|
||||||
# Store those configurations in the mailinabox.conf file
|
|
||||||
tools/editconf.py /etc/mailinabox.conf \
|
|
||||||
SMTP_RELAY_ENABLED=false \
|
|
||||||
SMTP_RELAY_HOST="" \
|
|
||||||
SMTP_RELAY_AUTH=false \
|
|
||||||
SMTP_RELAY_USER=""
|
|
||||||
|
|
||||||
# Allow the two SMTP ports in the firewall.
|
# Allow the two SMTP ports in the firewall.
|
||||||
|
|
||||||
ufw_allow smtp
|
ufw_allow smtp
|
||||||
|
Loading…
Reference in New Issue
Block a user