Skip to content
Snippets Groups Projects
Commit 2c156397 authored by Florent Thiery's avatar Florent Thiery
Browse files

fix mailname at install, refs #20849

parent e496ffb6
No related branches found
No related tags found
No related merge requests found
...@@ -12,15 +12,21 @@ def setup(interactive=True): ...@@ -12,15 +12,21 @@ def setup(interactive=True):
else: else:
raise Exception('Failed to get hostname.') raise Exception('Failed to get hostname.')
# Install and configure postfix # Install and configure postfix
server = utils.get_conf('EMAIL_SMTP_SERVER', '')
if not server:
# with relayless cases emails are not always delivered to google mailing lists unless mailname is ubicast.eu and DNS spf records are set
mailname = 'ubicast.eu'
else:
mailname = utils.get_conf('MS_SERVER_NAME', hostname)
dir_path = utils.get_dir(__file__) dir_path = utils.get_dir(__file__)
cmds = [ cmds = [
'DEBIAN_FRONTEND=noninteractive apt-get install -y postfix mailutils', 'DEBIAN_FRONTEND=noninteractive apt-get install -y postfix mailutils',
'echo "Replacing /etc/postfix/main.cf"', 'echo "Replacing /etc/postfix/main.cf"',
dict(line='write', template='%s/main.cf' % dir_path, target='/etc/postfix/main.cf', params=( dict(line='write', template='%s/main.cf' % dir_path, target='/etc/postfix/main.cf', params=(
('{{ hostname }}', hostname), ('{{ hostname }}', hostname),
('{{ smtp }}', utils.get_conf('EMAIL_SMTP_SERVER', '')), ('{{ smtp }}', server),
)), )),
'echo "%s" > /etc/mailname' % hostname, 'echo "%s" > /etc/mailname' % mailname,
'rgrep root /etc/aliases || echo "root: sysadmin@ubicast.eu" >> /etc/aliases', 'rgrep root /etc/aliases || echo "root: sysadmin@ubicast.eu" >> /etc/aliases',
'service postfix restart', 'service postfix restart',
'newaliases', 'newaliases',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment