S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Popular MTAs EXIM & POSTFIX SPARCS 10 이대근 (harry)
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems MTA M ail T ransfer A gent M essage T ransfer A gent or
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Let’s recall…
MTA MUA (ex: outlook express) MUA 그냥 새 MDA : Mail 우편함
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems With MTA you can… Send and receive an , of course –To users of your machine, without ISP –To other mail servers, you need connection to internet Fetch s from POP3 server –using fetchmail Receive s in right place –Using procmail Get messages from some programs via –Log files or security warnings can be delivered to your
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems A Lot of MTAs And Qmail, Courier, Smail, MMDF…
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems EXIM EXperimental Internet Mailer
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems EXIM One of the most popular MTAs Default MTA for Ubuntu SPARCS server GPL Flexible, extensible Good compatibility with Sendmail Latest stable release: 4.72 (2010/06/03)
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems How EXIM delivers mails? Internet SMTP(25) Daemon Mail server Spool Receiver Queue runner Delivery Remote Delivery Local Delivery Mailbox
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Message ID 1OROMT-0003j0-6G The time at which the message started to be received. The number of seconds since the start of the epoch. TimeProcess ID ID of the process which received the message. Time Fractional part of the time of reception. The unit may be 1/2000 sec, 1/1000 sec, 1/200 sec or 1/100 sec.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Command line options # exim [options] [arguments] ––help Displays help message –bd Runs exim as a daemon, awaiting incoming SMTP connections from all available interfaces. Usually used with option –q. –q Starts one queue runner process. Time specifications start queue runner periodically. (–q30m for starting every 30 minutes)
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Command line options # exim [options] [arguments] –Mc … Deliver messages in turn. Usually called internally by queue runner. –C Find configuration files in and apply them instead of default configuration file specified by CONFIGURE_FILE. –bP … Print the current configuration to standard output.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Let’s see SPARCS server ps aux | grep exim ? Ss Jul01 0:02 /usr/sbin/exim4 -bd -q30m Root ? S 18:14 0:00 /usr/sbin/exim4 -Mc 1OXW fL-QH ? S 18:14 0:00 /usr/sbin/exim4 -Mc 1OXW fL-QH ? S 18:14 0:00 /usr/sbin/exim4 -bd -q30m
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Configuring EXIM EXIM configuration file is divided into 6 parts –ACL: Access control list for controlling incoming SMTP mails –Authenticators: Settings for authenticator drivers –Routers: Determines how the messages is to be delivered –Transports: Defines the mechanisms how the messages are to be copied –Retry: Rules for use when the message cannot be delivered immediately –Rewrite: Global address rewriting rules –Local_scan: Private options for local_scan() function Difficult?
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf cat update-exim4.conf.conf # /etc/exim4/update-exim4.conf.conf # # Edit this file and /etc/mailname by hand and execute update-exim4.conf # yourself or use 'dpkg-reconfigure exim4-config' # # Please note that this is _not_ a dpkg-conffile and that automatic changes # to this file might happen. The code handling this will honor your local # changes, so this is usually fine, but will break local schemes that mess # around with multiple versions of the file. # # update-exim4.conf uses this file to determine variable values to generate # exim configuration macros for the configuration file. # # Most settings found in here do have corresponding questions in the # Debconf configuration, but not all of them. # # This is a Debian specific file
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf dc_eximconfig_configtype='internet' dc_other_hostnames='sparcs.org;sparcs.net; ' dc_local_interfaces='' dc_readhost='' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='' CFILEMODE='644' dc_use_split_config='true' dc_hide_mailname='' dc_mailname_in_oh='true' dc_localdelivery='maildir_home'
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf dc_eximconfig_configtype='internet' dc_eximconfig_configtype : The main configuration type. ‘local’: Mails are sent and received between the accounts of local machine ‘internet’: Configure as a general server connected to internet ‘satellite’: Sends mail to another machine(smarthost) ‘smarthost’: Intermediates Sets macro DC_eximconfig_configtype.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf dc_other_hostnames='sparcs.org;sparcs.net; ' dc_other_hostnames : List of domains of mails that the server will finally accept Multiple values can be set, separated by colon(:). Mails delivered to will be passed from daemon process to receiver process.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf dc_local_interfaces='' dc_local_interfaces : List of IPs for daemon to listen on Multiple values can be set, separated by colon(:). Empty string means all interfaces.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf CFILEMODE='644' CFILEMODE : The octal file mode of the generated file Sets the mode of the files that are generated by update-exim4.conf.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/exim4/update-exim4.conf.conf dc_use_split_config='true' dc_use_split_config : Defines whether it uses split configuration files ‘true’: Uses multiple files below /etc/exim4/conf.d ‘false’: Uses single file /etc/exim4/exim4.conf.template dc_localdelivery='maildir_home' dc_local_delivery : Name of default transport directory ‘’ or ‘mail_spool’: Mails are delivered to spool by default ‘maildir_home’: Mails are delivered to ~/Maildir/ by default
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Update configuration # update-exim4.conf –d /etc/exim4 –o /etc/exim4/exim4.conf Automatically generates configuration files. # /etc/init.d/exim4 restart Restarts the daemon with new configuration.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Log files /var/log/exim4/mainlog /var/log/exim4/rejectlog
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems POSTFIX
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems POSTFIX One of the most popular MTAs IBM Public License(free) Secure alternative to Sendmail Able to handle large amounts of s Latest stable release: (2010/06/08)
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Installation
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/postfix/main.cf cat main.cf # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending.domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/postfix/main.cf # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = sparcs alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = sparcs.org, sparcs.net, localhost.localdomain,, localhost relayhost = mynetworks = /8 [::ffff: ]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/postfix/main.cf # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. myorigin = /etc/mailname myorigin : Specifies the domain that appears in mail that posted on this machine. /etc/mailname has sparcs.kaist.ac.kr in its first line, so specifying myorigin = /etc/mailname makes the sender of the mails outgoing from this machine like myorigin = $mydomain is one of the most generally used settings.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/postfix/main.cf mynetworks_style = subnet mynetworks_style : Specifies what kinds of clients to relay mail from. host: Forwards mails from only the local machine subnet: Forwards mail from the clients in the same subnetwork as the machine class: Forwards mail from the clients in the same class as the machine If mynetworks_style is not set, you should specify the mynetworks list by hand.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/postfix/main.cf mydestination = sparcs.org, sparcs.net, localhost.localdomain,, localhost mydestination : Specifies what domains this server will finally accept Multiple values can be set, separated by commas(,).
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/postfix/main.cf relayhost = relayhost : Specifies the delivery method (empty string): Deliver the mail directly to the internet $mydomain: Deliver mails via local mail server inet_interfaces = all inet_interfaces : Specifies what interfaces that daemon should listen on
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Update configuration # postfix reload # /etc/init.d/postfix restart Restarting postfix daemon will apply your new settings
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Log files /var/log/mail.log /var/log/mail.info /var/log/mail.err /var/log/mail.warn
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems ALIASES & FORWARDING
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Aliases Alias is a way to use a virtual mail account –If webmaster is an alias of harry, messages sent to will be redirected to harry ’s mailbox. Alias is an easy way to configure mailing list –If wheel-seminar is aliases of all members who participates in wheel seminar, messages sent to will be redirected to their mailboxes. MTAs automatically reads alias database when the delivery process starts and deliver messages according to it.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems /etc/aliases : –webmaster : harry : :include: –wheel-seminar : :include:/SPARCS/mail/aliases.d/wheel-seminar –Files is just a list of usernames separated by newlines. We have a good tool: edalias
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems newaliases MTAs read /etc/aliases.db, not /etc/aliases. You have to update database file after editing aliases files. # newaliases
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Forwarding Pass messages to other mail addresses If harry forwards his mails to all mails sent to will be delivered to in fact.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Settings Alias –harry : /home/harry/.forward
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Questions?
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Thank you!