Fedora 25
Sponsored Link

Install Postfix
2016/12/12
 
Install Postfix to configure SMTP server.
[1] Install Postfix.
[root@mail ~]#
dnf -y install postfix
[2] This example shows to configure SMTP-Auth to use Dovecot's SASL function.
[root@mail ~]#
vi /etc/postfix/main.cf
# line 95: uncomment and specify hostname

myhostname =
mail.srv.world
# line 102: uncomment and specify domain name

mydomain =
srv.world
# line 118: uncomment

myorigin = $mydomain
# line 135: change

inet_interfaces =
all
# line 138: change it if use only IPv4

inet_protocols =
ipv4
# line 183: add

mydestination = $myhostname, localhost.$mydomain, localhost
, $mydomain
# line 283: uncomment and specify your local network

mynetworks = 127.0.0.0/8,
10.0.0.0/24
# line 438: uncomment (use Maildir)

home_mailbox = Maildir/
# line 593: add

smtpd_banner = $myhostname ESMTP
# add follows to the end

# limit an email size for 10M

message_size_limit = 10485760

# limit a mailbox for 1G

mailbox_size_limit = 1073741824
# SMTP-Auth settings

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
[root@mail ~]#
systemctl start postfix

[root@mail ~]#
systemctl enable postfix

[3] If SELinux is enabled, change policy like follows.
[root@mail ~]#
vi postfix-local.te
# create new

module postfix-local 1.0;

require {
        type tmpfs_t;
        type sendmail_t;
        type postfix_local_t;
        type postfix_cleanup_t;
        type postfix_smtp_t;
        type postfix_smtpd_t;
        type postfix_qmgr_t;
        type postfix_master_t;
        type postfix_pickup_t;
        class lnk_file read;
}

allow sendmail_t tmpfs_t:lnk_file read;
allow postfix_local_t tmpfs_t:lnk_file read;
allow postfix_cleanup_t tmpfs_t:lnk_file read;
allow postfix_smtp_t tmpfs_t:lnk_file read;
allow postfix_smtpd_t tmpfs_t:lnk_file read;
allow postfix_pickup_t tmpfs_t:lnk_file read;
allow postfix_master_t tmpfs_t:lnk_file read;
allow postfix_qmgr_t tmpfs_t:lnk_file read;

[root@mail ~]#
checkmodule -m -M -o postfix-local.mod postfix-local.te

checkmodule: loading policy configuration from postfix-local.te
checkmodule: policy configuration loaded
checkmodule: writing binary representation (version 17) to postfix-local.mod
[root@mail ~]#
semodule_package --outfile postfix-local.pp --module postfix-local.mod

[root@mail ~]#
semodule -i postfix-local.pp

[4] If Firewalld is running, allow SMTP service. SMTP uses 25/TCP.
[root@mail ~]#
firewall-cmd --add-service=smtp --permanent

success
[root@mail ~]#
firewall-cmd --reload

success
Matched Content