SMTP Flashcards
1
Q
Configure a mail transfer agent (MTA) to accept inbound email from other systems
A
Configure a mail transfer agent (MTA) to accept inbound email from other systems.
In order to test a mail server, you will need to set up a DNS server.
1. Remove the sendmail package (sendmail is more complicated to configure): # yum erase sendmail
2. Install the postfix package: # yum install -y postfix
3. Add a new rule to the firewall: # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
4. Save the firewall configuration: # service iptables save
5. Activate the postfix service at boot: # chkconfig postfix on
6. Start the postfix service: # service postfix start
- Let’s assume that your server is called mail.example.com on the 192.168.1.0/24 network.
Edit the /etc/postfix/main.cf file and change the following directives:
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.1.0/24, 127.0.0.0/8
8. Check the syntax: # postfix check
9. Check the non-default configuration: # postconf -n
10. Reload the postfix configuration: # service postfix reload
11. Set the ‘allow_postfix_local_write_mail_spool‘ SElinux boolean to ‘on’: # setsebool -P allow_postfix_local_write_mail_spool on
12. Test from a client (it should display: 25/tcp open smtp): # yum install -y nmap # nmap mail.example.com
Alternatively, test from a client: # yum install -y telnet # telnet mail.example.com 25
2
Q
Configure an MTA to forward (relay) email through a smart host
A
Configure an MTA to forward (relay) email through a smart host.
In order to test this configuration, you will need to set up a DNS server and configure a central mail server (here at 192.168.1.1) to receive mails.
1. Remove the sendmail package (sendmail is more complicated to configure): # yum erase sendmail
2. Install the postfix package: # yum install -y postfix
3. Activate the postfix service at boot: # chkconfig postfix on
4. Start the postfix service: # service postfix start
- Let’s assume that your local server is called server.example.com on the 192.168.1.0/24 network and your smart host (outgoing mail gateway) is at 192.168.1.1.
Edit the /etc/postfix/main.cf file and change the following directives:
myhostname = server.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.1.0/24, 127.0.0.0/8
relayhost = 192.168.1.1
6. Check the syntax: # postfix check
7. Check the non-default configuration: # postconf -n
8. Reload the postfix configuration: # service postfix reload