120 likes | 292 Views
CT 320: Network and System Administration. SENDMAIL Colorado State University Computer Science Department Chris Wilcox Fall 2012. Original slides from Dr. James Walden at Northern Kentucky University. Topics. Features of Sendmail Running Sendmail Mail Queues Configuring Sendmail
E N D
CT 320: Network and System Administration SENDMAIL Colorado State University Computer Science Department Chris Wilcox Fall 2012 Original slides from Dr. James Walden at Northern Kentucky University.
Topics • Features of Sendmail • Running Sendmail • Mail Queues • Configuring Sendmail • sendmail.cf CT320: Fall Semester 2012
Sendmail Tasks • Handle messages from user agents. • Understand recipient addresses. • Choosing delivery/transport agents. • Rewriting addresses to a form understood by delivery agent. • Reformatting headers as required. • Passing transformed message to delivery agent. CT320: Fall Semester 2012
History of Sendmail • Written by Eric Allman in 1983. • Precursor: delivermail (1979) BSD 4.0, 4.1 • Sendmail v5 • Released 1983 for BSD 4.1c (1st TCP/IP UNIX) • IDA enhanced version appeared in 1987. • Many vendor proprietary extensions. • Sendmail v8 • Version 8.1 released 1993 for BSD 4.4 • Current release: 8.13 CT320: Fall Semester 2012
Files and Directories Sendmail binary /usr/sbin, /usr/libexec, /usr/lib Links to binary for specific tasks newaliases, mailq, etc. Configuration file /etc/mail/sendmail.cf Mail queue /var/spool/mqueue Local delivery agents mail.local, smrsh, procmail Configuration and status files /etc/mail: aliases,sendmail.st,sendmail.hf CT320: Fall Semester 2012
Sendmail Modes -bd: Run as daemon, listening on port 25. -bD: Run as daemon in foreground (debug.) -bh: View recent connection information. -bi: Rebuild alias database (newaliases) -bp: Print mail queue (mailq) -bt: Address test mode. -q: Process mail queue immediately. -q1h: Process queue once every hour. CT320: Fall Semester 2012
When is a message queued? • All messages are placed in the queue when received, so that if there’s a crash during delivery, the message isn’t lost. • If a message is temporarily undeliverable, it remains in the queue until the next run. • If the load average is too high, messages are queued without a delivery attempt. CT320: Fall Semester 2012
Mail Queues Sendmail may use multiple queues. Permanent queues. Temporary queues. A mail queue is a directory of queued msgs. qf: Header of message, control file. df: Body of message. tf: Temporary qf file while qf is updated. Tf: tf is renamed to Tf if 32+ lock attempts fail. Qf: message bounced, could not be returned. xf: Temporary transcript file of error messages. CT320: Fall Semester 2012
The qf files • One of 2 primary parts of queued message. • The df file is the other part. • All parts have same unique queue identifier. • Qf file data • Headers • Priority of message in queue. • Date message will expired (and be bounced.) • Contains reason message is in queue. CT320: Fall Semester 2012
Sendmail Configuration • Choice of delivery agents. • Address rewriting rules. • Mail header formats. • Options. • Security precautions. • Spam resistance. CT320: Fall Semester 2012
sendmail.cf • Sendmail configuration file • A complete programming language. • Single char commands, lots of symbols, recursive rules. • Macro-configuration files • Generate sendmail.cf from m4 macro files. • Most config files can be created this way. CT320: Fall Semester 2012