Setting up postfix on a Trisquel 11 ARM mail server

#!/bin/bash

# Manual steps needed

# Set Up DNS Records for Your Mail Server

# MX record @ mail.tuxmail.io

# For njalla domains login and go to domains > manage
#
# https://njal.la/
#
# Click the + add record to add an MX record

# Enter:

# Type: MX
# Name: @
# Priority: 10
# Mail server: mail.tuxmail.io
# TTL: 1m

# Click the + add record to add an A record

# Enter:

# Type: A
# Name: mail
# IPv4 Address: 94.158.244.150 (WireGuard server dedicated static IP)

# Login to the VPS provider and set a RDNS record
#
# For example login to mivocloud
# Click the active product or service for your VPS WireGuard server
# Click Reverse DNS
# For the IP associated with your mail server/WireGuard decicated static public IP enter mail.tuxmail.io
# Click the Update button

# https://clients.mivocloud.com/clientarea.php

# Information needed up front for setting up postfix

domain_name=tuxmail.io
FQDN=mail.tuxmail.io
user1_email_address=user1

# Commands to run to setup mail server postfix

apt update
apt install -y dbus dbus-user-session systemd libsystemd-dev apt-utils dialog rsyslog

# Set the FQDN (Fully Qualified Domain Name)

hostnamectl set-hostname "$FQDN"

# You can check the name was set by running hostname -f

# Lets install postfix and use debconf-set-selections to automatically answer the questions

DEBIAN_FRONTEND=noninteractive

debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
debconf-set-selections <<< "postfix postfix/mailname string $domain_name"

apt-get install --assume-yes postfix

ufw allow 25/tcp

service postfix restart

# Increase the file size attachment limit from 10MB to 50MB

postconf -e message_size_limit=52428800
systemctl restart postfix

# Add the first user, disabled password

adduser --disabled-password --gecos "" "$user1_email_address"

# Set the postmaster alias such that emails go to the first user/admin of the system

sed -i "s/root/$user1_email_address/g" /etc/aliases

newaliases

# It's better to disable IPv6 if our mail server doesn't have an IPv6 address

postconf -e "inet_protocols = ipv4"

systemctl restart postfix

# Don't let postfix upgrades negatively impact your postfix configuration

debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No configuration'"
apt update
apt upgrade