You want to make changes to the /etc/postfix/main.cf
file using the vi
editor. Here's a step-by-step guide on how to do this:
Open the File:
sudo vi /etc/postfix/main.cf
Edit the mynetworks
Line:
If the line mynetworks =
exists, modify it. If it doesn't, add a new line.
Change or add:
mynetworks = 144.76.72.163, 144.76.72.170, 144.76.72.179, 104.30.0.0/19
Comment Lines:
Find the section that starts with smtpd_sender_restrictions =
. Comment out the specified lines by adding a #
at the beginning of each line. It should look like this:
# Sender restrictions
smtpd_sender_restrictions =
reject_unknown_sender_domain
#reject_non_fqdn_sender
#reject_unlisted_sender
permit_mynetworks
permit_sasl_authenticated
check_sender_access pcre:/etc/postfix/sender_access.pcre
Save and Exit:
Esc
to switch to command mode in vi
.:wq
and press Enter
to save and exit.Restart Postfix:
sudo systemctl restart postfix
This will apply the changes you made to the Postfix configuration. Make sure to test your mail server after making these changes to ensure everything is working as expected.
Amasvid Service - DKIM for Each domain
vi /etc/amavisd/amavisd.conf
dkim_key('example.net', 'dkim', '/var/lib/dkim/example.net.pem');
@dkim_signature_options_bysender_maps = ({
# 'd' defaults to a domain of an author/sender address,
# 's' defaults to whatever selector is offered by a matching key
# Per-domain dkim key
#"domain.com" => { d => "domain.com", a => 'rsa-sha256', ttl => 10*24*3600 },
# catch-all (one dkim key for all domains)
'.' => {d => 'example.net',
a => 'rsa-sha256',
c => 'relaxed/simple',
ttl => 30*24*3600 },
});
# Creates dkim with 4096 bit.
openssl genrsa -out dkim_private.pem 4096
# Create dkim with 2048 bit.
openssl genrsa -out dkim_private.pem 2048
openssl rsa -in dkim_private.pem -pubout -outform der 2>/dev/null | openssl base64 -A
Example:
type: TXT
selector:
dkim._domainkey
value:
v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA26+O/A0Z+qlQD8DDrToH1eiUS0qB3rT3F7ZHgeVHCRaTXOYQxG9oyOTMdzj/yhOEqvq/Z2otupsp6iNwr/XvxkD/cTIbo9jw3V5WlG+QaCrwgvEvXRL6nUd2TdElrjOn/9k7rvb7V664KvpWoKMU7GT1DVIp0qZBoJPFL3h5NWaEAdYqQP6b4/n0o/X+XbpEkSLR+P3tKXPYth4Gmacev6VI21TauXwNpl03bBRO4Grb/eOjKeKft+h058F7aMQsm590BRUyr0ocBNOsF3o+mdzv7Ij/Rd1Qcb2fZpmEc2np/Isn6+yORiIqSyDGinKFneAkUPMoHxXEB0//YnSXFQIDAQAB
# Restart the service for changed to take affect.
systemctl restart amavisd.service
# Check if the service running.
systemctl status amavisd.service
Debug Errors:
postfix/smtpd[26840]: NOQUEUE: reject: RCPT from mta119b.pmx1.epsl1.com[142.54.244.119]: 450 4.7.1 <[email protected]>: Recipient address rejected: Internal error occurred. Refer to server log for more information.
Fix:
Go to this link: https://docs.iredmail.org/upgrade.iredmail.0.9.9-1.0.html#optional-enable-mailbox-quota-status-check-in-dovecot-and-postfix_1
Backup vmail database
mariadb-dump vmail > vmail.sql
Download the SQL file for adding the missing colums
1. Downloading iredmail.mysql for adding the missing colums.
wget -O /tmp/iredmail.mysql https://github.com/iredmail/iRedMail/raw/1.0/update/1.0/iredmail.mysql
2. import the sql file.
mysql vmail < /tmp/iredmail.mysql
3. remove it from tmp folder.
rm -f /tmp/iredmail.mysql
4. Restart postfix and dovecot services
systemctl restart postfix dovecot