Based on the Linux Master 1 exam syllabusReport an error
/etc/mail/sendmail.cf) and Postfix (modular, secure, /etc/postfix/main.cf). Opening mynetworks too wide creates an open relay.| Component | Full name | Role | Typical programs |
|---|---|---|---|
| MUA | Mail User Agent | Client where the user writes and reads mail | Outlook, Thunderbird, mutt, mail |
| MTA | Mail Transfer Agent | Core engine that transfers (routes) mail between servers | Sendmail, Postfix, Exim |
| MDA | Mail Delivery Agent | Makes the final delivery of mail received by the MTA to the user's mailbox | Procmail, Dovecot's LDA, mail.local |
[Sender MUA] --SMTP--> [Sending MTA] --SMTP--> [Receiving MTA] --MDA--> [Mailbox]
↑
[Recipient MUA] <--POP3/IMAP-- [Mailbox]The MTA is "the truck hauling between post offices," the MDA is "the mail carrier dropping letters into the mailbox," and the MUA is "a person writing and reading letters." MTAs talk to each other over SMTP, the MDA drops the mail into the mailbox, and then the MUA looks into that mailbox over POP3/IMAP. This division of labor is the backbone of the mail architecture.
Key distinction: MTA and MDA are different stages. The MTA is the transfer stage that moves mail from server to server, while the MDA is the final delivery stage that drops that mail into the local user's mailbox. SMTP is the language of the MTA; POP3/IMAP are the language of the MUA that reads the mailbox.
| Protocol | Direction | Plaintext port | Encrypted (SSL/TLS) port |
|---|---|---|---|
| SMTP | Sending (MUA→MTA, MTA→MTA) | 25 | 465 (SMTPS), 587 (STARTTLS submission) |
| POP3 | Receiving (server→MUA, download) | 110 | 995 (POP3S) |
| IMAP | Receiving (server→MUA, kept on server) | 143 | 993 (IMAPS) |
Points to lock into memory:
⚠️ Trap: Some questions mix up 465 and 587. 465 is SMTPS, which wraps the connection in SSL from the start; 587 is the mail submission port that starts in plaintext and is encrypted via STARTTLS. Also, a choice that flips the direction to "receiving = 110/143, sending = 25" is wrong. A choice that attaches 25 to POP3 is wrong as well.
Key distinction: POP3 vs IMAP — POP3 downloads mail to the client and deletes it from the server (by default), so it suits use on a single device. IMAP leaves mail on the server and syncs, so it suits viewing the same mailbox from multiple devices. "Syncing across multiple devices = IMAP" is the signal for the correct answer.
# Check whether the mail-related ports are LISTENing
ss -tlnp | grep -E ':(25|110|143|465|587|993|995)'
# Check the standard port definitions in /etc/services
grep -E '^(smtp|pop3|imap|submission|imaps|pop3s)\b' /etc/services
# Local mail delivery test (SMTP conversation via telnet)
telnet localhost 25
# Response: 220 mail.example.com ESMTP PostfixSMTP uses port 25 because it is a historical number assigned back in 1982 in RFC 821. Later, as ISPs blocked outbound port 25 to stop spam, port 587 (RFC 4409) was split off for authenticated users to submit mail. That is why a large share of today's "mail goes out but I can only receive" outages are caused by port 25 being blocked.
| Item | Sendmail | Postfix |
|---|---|---|
| Released | 1983, the oldest MTA | 1998, developed with security and simplicity as goals |
| Architecture | One huge monolithic process | Split into several small processes (modular) |
| Config file | /etc/mail/sendmail.cf (generated with m4) | /etc/postfix/main.cf (intuitive) |
| Config difficulty | Very complex (.mc → .cf compile) | Relatively easy (key=value) |
| Security | Weak privilege separation (many historical vulnerabilities) | Strong security through privilege separation |
| Current standing | Legacy | De facto standard, the RHEL default |
Postfix replaced Sendmail because "one huge process" was the weak point for security. Postfix splits receiving, queueing, and delivery into small processes with different privileges, designed so that a breach in one part doesn't spread to the whole. "Security and modular = Postfix" is the key.
# /etc/postfix/main.cf — key settings
myhostname = mail.example.com # This server's hostname
mydomain = example.com # Domain name
myorigin = $mydomain # Domain for outgoing mail (fixes up the sender address)
inet_interfaces = all # Interfaces to listen on (all = every NIC)
mydestination = $myhostname, localhost, $mydomain # Domains treated as local delivery
mynetworks = 127.0.0.0/8, 192.168.0.0/24 # Trusted networks allowed to relay
relayhost = [smtp.isp.com]:587 # Relay server that outbound mail goes through
home_mailbox = Maildir/ # Mailbox format (Maildir/ vs mbox)postconf -n # Print only settings that differ from the defaults (for checking)
postfix check # Check config syntax
systemctl reload postfix # Apply config changes without downtime
newaliases # Rebuild the DB after changing /etc/aliases⚠️ Trap: If you set
inet_interfacestolocalhost, the server can't receive mail from outside. Also, if you open themynetworksrange too wide (e.g., 0.0.0.0/0), anyone can relay mail through this server, making it an open relay that gets abused as a spam source. They pair up as "can't receive = inet_interfaces, open relay risk = mynetworks".
Key distinction: Mailbox storage format mbox vs Maildir — mbox appends all mail into a single file, so lock conflicts are frequent, while Maildir stores each message as one file in a directory, which is safe for concurrent access. A value ending in a slash (/), like home_mailbox = Maildir/, is the signal for Maildir format.
# /etc/aliases — redirect recipient addresses (aliases)
root: admin@example.com # Forward mail addressed to root to admin
webmaster: root # Multi-level aliases are also possible
# After editing, always run
newaliases
# Check and handle the mail queue
mailq # Show the pending mail queue (same as postqueue -p)
postqueue -f # Flush the queue immediately (try resending)
postsuper -d ALL # Delete all mail in the queueIt is common for mail not to go out right away and pile up in the queue. Because of a temporary outage on the receiving server, a DNS MX lookup failure, greylisting, and so on, the MTA doesn't discard the mail but keeps it in the queue and retries periodically. So when a report comes in that "mail is delayed," the first thing to do is check the queue state with mailq. This is the mail administrator's first diagnostic command.
/etc/postfix/main.cf, Sendmail's is /etc/mail/sendmail.cfinet_interfaces : The interfaces on which Postfix receives mail. If set to localhost, it can't receive outside mail.mynetworks : The trusted networks allowed to relay. Too wide makes an open relay.relayhost : Specifies the relay server that outbound mail passes through instead of being sent directly./etc/aliases : The alias file that forwards a recipient address to another address. After editing, you must rebuild the DB with newaliases.mailq and push it out with postqueue -f.Click a choice to reveal the answer and explanation.
Question 1
Which component in a mail system is responsible for transferring (routing) mail between servers?
Question 2
Which option correctly pairs the default (plaintext) port numbers of SMTP, POP3, and IMAP, in order?
Question 3
Which statement about the difference between POP3 and IMAP is correct?
Question 4
Which is the correct path of Postfix's main configuration file?
Question 5
Which option correctly pairs the port used to send mail encrypted with SSL/TLS (SMTPS) and the IMAP encrypted port (IMAPS)?
Question 6
Which describes a characteristic of Postfix compared with Sendmail?
Question 7
What security problem occurs when mynetworks in Postfix is set excessively wide, such as 0.0.0.0/0?