sendmail configuration and installation presented by kathleen

22
Sendmail Sendmail configuration and configuration and installation installation Presented by kathleen Presented by kathleen

Upload: victor-hancock

Post on 24-Dec-2015

225 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Sendmail configuration and installation Presented by kathleen

SendmailSendmailconfiguration and installationconfiguration and installation

Presented by kathleenPresented by kathleen

Page 2: Sendmail configuration and installation Presented by kathleen

ImportanceImportance

Business and personal Business and personal communicationcommunication

Each company provides some Each company provides some type of email servicetype of email service

Important to learn how to install Important to learn how to install and build and configure and build and configure sendmailsendmail

Page 3: Sendmail configuration and installation Presented by kathleen

Basic configurationBasic configuration

Many types of configuration possibleMany types of configuration possible Separate mail servers on one networkSeparate mail servers on one network Mails forwarded to a gateway then Mails forwarded to a gateway then

forwarded onto individual mail-serversforwarded onto individual mail-servers One mail server with many clientsOne mail server with many clients

Method Chosen:Method Chosen: One mail serverOne mail server

Problems occur with too much loadProblems occur with too much load Overcome by load balancing through many Overcome by load balancing through many

mail servers with same disksmail servers with same disks Method most chosen in sites (easier to Method most chosen in sites (easier to

administrate)administrate)

Page 4: Sendmail configuration and installation Presented by kathleen

Concepts of sendmailConcepts of sendmail

Simple installationSimple installation Mail user agent-read and compose email Mail user agent-read and compose email

messagesmessages pine – cursor based graphical mail viewerpine – cursor based graphical mail viewer mail – command line mail mail – command line mail

Mail transport agent- accepts mail from user Mail transport agent- accepts mail from user agent, understand recipients address. Gets mail agent, understand recipients address. Gets mail to correct host for deliveryto correct host for delivery

esmtp- extended simple mail transport protocolesmtp- extended simple mail transport protocol Or smail, qmail, eximOr smail, qmail, exim

Delivery agent – Delivery agent – accepts mail from transport and accepts mail from transport and delivers it to appropriate recipientsdelivers it to appropriate recipients

Mail, /bin/sh, procmail ,pop, phquery, uucpMail, /bin/sh, procmail ,pop, phquery, uucp Mail – simple user delivery agentMail – simple user delivery agent

Page 5: Sendmail configuration and installation Presented by kathleen

NecessitiesNecessities

Other software needed besides Other software needed besides sendmailsendmail

DNS serverDNS server Canonical name for local hostCanonical name for local host Looks up hosts that connectLooks up hosts that connect Looks up hosts for deliveryLooks up hosts for delivery SMTP to find the address to connect toSMTP to find the address to connect to

NFS/ Distributed File SystemNFS/ Distributed File System /var/mail access inbox/spool for clients/var/mail access inbox/spool for clients /home to access simple files/home to access simple files /usr/local or software to access mail /usr/local or software to access mail

softwaresoftware

Page 6: Sendmail configuration and installation Presented by kathleen

Possible NecessitiesPossible Necessities

YP (NIS) serverYP (NIS) server User names and passwords to allow User names and passwords to allow

client machines about usernames. client machines about usernames. Providing central servicesProviding central services

Unless you share the same passwd fileUnless you share the same passwd file

Page 7: Sendmail configuration and installation Presented by kathleen

Checklist for DNSChecklist for DNS

mailserver mailserver An mx record on dnsAn mx record on dns

HostsHosts A lookup record Name to IPA lookup record Name to IP A reverse lookup record (validation A reverse lookup record (validation

purpose) IP to Namepurpose) IP to Name /etc/hosts/etc/hosts

Page 8: Sendmail configuration and installation Presented by kathleen

CompileCompile retrieve off of sendmail.orgretrieve off of sendmail.org untar and unzipuntar and unzip compile .sh Buildcompile .sh Build

ConfigurationConfiguration Choose a configuration file matching Choose a configuration file matching

your osyour os Generic-linux.m4Generic-linux.m4

Page 9: Sendmail configuration and installation Presented by kathleen

m4 Configuration Filesm4 Configuration Files

M4 a macro preprocessor that produces a M4 a macro preprocessor that produces a sendmail configuration file by processing a sendmail configuration file by processing a file that ends in .mc.file that ends in .mc.

Macros used are:Macros used are: define – defines a macrodefine – defines a macro undefine – discards a previous definitionundefine – discards a previous definition include – includes a fileinclude – includes a file dnl – discards characters up to including the dnl – discards characters up to including the

next new linenext new line divert – manages output streamsdivert – manages output streams

Page 10: Sendmail configuration and installation Presented by kathleen

Types of ConfigurationTypes of Configuration

OSTYPEOSTYPE is the operating type is the operating type Linux, sgi, solarisLinux, sgi, solaris Specifies directories of where files are located Specifies directories of where files are located

for normal sendmail including queues and spool for normal sendmail including queues and spool directories through variablesdirectories through variables

Chose ostype(linux)Chose ostype(linux)

VERSIONIDVERSIONID version id of the sendmail you version id of the sendmail you buildbuild

Page 11: Sendmail configuration and installation Presented by kathleen

More ConfigurationMore Configuration

DOMAINDOMAIN allows to include domain files for allows to include domain files for site specific informationsite specific information Use generic for small sitesUse generic for small sites Large sites spam, databases, tablesLarge sites spam, databases, tables

MAILERMAILER delivery agent specifications. delivery agent specifications. Types:Types:

Local,smtp,fax,usenet,procmail…Local,smtp,fax,usenet,procmail… UsedUsed

local and smtplocal and smtp MAILER(`local’) MAILER(`smtp’)MAILER(`local’) MAILER(`smtp’)

Computer science dept:Computer science dept: Procmail, local, and smtpProcmail, local, and smtp

Page 12: Sendmail configuration and installation Presented by kathleen

Even more ConfigurationEven more Configuration

FEATUREFEATURE Options to change sendmail’s behaviorOptions to change sendmail’s behavior use_cw_file – necessary, names of all local use_cw_file – necessary, names of all local

hosts for which this host acceptshosts for which this host accepts ““whatever.com”, “mail.whatever.com”whatever.com”, “mail.whatever.com”

redirect – allows forwardingredirect – allows forwarding access_db – necessary, consists of ips, or access_db – necessary, consists of ips, or

domainsdomains Specify rejects, OK, discard or relay for machines to use Specify rejects, OK, discard or relay for machines to use

smtp on that server.smtp on that server. Must use makemap hash /etc/mail/access < Must use makemap hash /etc/mail/access <

/etc/mail/access/etc/mail/access

Page 13: Sendmail configuration and installation Presented by kathleen

No not more….. configurationNo not more….. configuration

nocanonifynocanonify Avoid dns lookups locally. Avoid dns lookups locally. Used for client transport agentsUsed for client transport agents

nullclient nullclient FEATURE(`nullclient’,`mail.whatever.com’)FEATURE(`nullclient’,`mail.whatever.com’) All mail is delivered to the mailserverAll mail is delivered to the mailserver

MASQUERADE_ASMASQUERADE_AS allow multiple machines hide behind one single allow multiple machines hide behind one single

identityidentity MASQUERADE_AS(`cs.umbc.edu’)MASQUERADE_AS(`cs.umbc.edu’) MASQUERADE_AS(`whatever.com’)MASQUERADE_AS(`whatever.com’)

MAIL_HUBMAIL_HUB Automatically doneAutomatically done Incoming mail smtp:mail.whatever.comIncoming mail smtp:mail.whatever.com

SMART_HOSTSMART_HOST Automatic with masqueradeAutomatic with masquerade Outgoing mail smtp:mail.whatever.comOutgoing mail smtp:mail.whatever.com

Page 14: Sendmail configuration and installation Presented by kathleen

ConfigurationConfiguration

Server configurationServer configuration OSTYPE(`linux’)OSTYPE(`linux’) DOMAIN(`generic’)DOMAIN(`generic’) FEATURE(`use_cw_file’)FEATURE(`use_cw_file’) FEATURE(`access_db’)FEATURE(`access_db’) MASQUERADE_AS(`whatever.com’)MASQUERADE_AS(`whatever.com’) MAILER(`local’)MAILER(`local’) MAILER(`smtp’)MAILER(`smtp’)

Client configurationClient configuration OSTYPE(`linux’)OSTYPE(`linux’) FEATURE(`nocanonify’)FEATURE(`nocanonify’) FEATURE(`nullclient’, `mail.whatever.com’)FEATURE(`nullclient’, `mail.whatever.com’)

Page 15: Sendmail configuration and installation Presented by kathleen

Creating cf fileCreating cf file

Build cf file for client/serverBuild cf file for client/server make filename.cfmake filename.cf cp filename.cf /etc/mail/sendmail.cfcp filename.cf /etc/mail/sendmail.cf

Client configuration is copied for clientClient configuration is copied for client Server configuration is copied for serverServer configuration is copied for server

Page 16: Sendmail configuration and installation Presented by kathleen

/etc/aliases/etc/aliases

Necessary file for sendmailNecessary file for sendmail System wide config file maintained by administratorSystem wide config file maintained by administrator

Computer Science Dept. uses email lists, and aliases Computer Science Dept. uses email lists, and aliases for professorsfor professors

Should always contain postmasterShould always contain postmaster Sendmail will not work without this fileSendmail will not work without this file

Trust me…..Trust me….. Can contain include files for lists or other interfaces Can contain include files for lists or other interfaces

to majordomo (CS) or listproc like (OIT)to majordomo (CS) or listproc like (OIT) Majordomo = FREEMajordomo = FREE Listproc = expensiveListproc = expensive Configuration for sendmail has to enable /bin/sh for Configuration for sendmail has to enable /bin/sh for

majordomo or listprocmajordomo or listproc

Page 17: Sendmail configuration and installation Presented by kathleen

Running SendmailRunning Sendmail

Should be done in RC scriptsShould be done in RC scripts Linux has a rc file already if sendmail is Linux has a rc file already if sendmail is

installedinstalled Kill –TERM pid to kill sendmailKill –TERM pid to kill sendmail /usr/sbin/sendmail k-bd –q1h & to run /usr/sbin/sendmail k-bd –q1h & to run

againagain mv mqueue if queue is clogged, located mv mqueue if queue is clogged, located

in /var/spool/mqueuein /var/spool/mqueue

Page 18: Sendmail configuration and installation Presented by kathleen

ClientsClients

Copy new version of sendmailCopy new version of sendmail Copy sendmail.cfCopy sendmail.cf Make sure following are mounted from Make sure following are mounted from

serversservers /var/mail/var/mail /usr/local/usr/local /home/home

Page 19: Sendmail configuration and installation Presented by kathleen

Various Types of Clients with Various Types of Clients with Different Operating SystemsDifferent Operating Systems For each OS and version compile a new For each OS and version compile a new

sendmailsendmail Make sure all clients share the same Make sure all clients share the same

version of sendmail. Or sendmail not version of sendmail. Or sendmail not interact properly with server and clientinteract properly with server and client

Create a new sendmail.cf file for each type Create a new sendmail.cf file for each type of operating system supported. Use the of operating system supported. Use the m4 interpreterm4 interpreter SolarisSolaris LinuxLinux IrixIrix

Page 20: Sendmail configuration and installation Presented by kathleen

Problem Solving for Problem Solving for ConfigurationConfiguration Ensure smtp is running on mail-serverEnsure smtp is running on mail-server

telnet to hostname w/ port 25 from clienttelnet to hostname w/ port 25 from client If connection refused major problemIf connection refused major problem Try from mail server as wellTry from mail server as well

cd /var/log and tail messagescd /var/log and tail messages Make sure variables are sound and correct on Make sure variables are sound and correct on

start upstart up Make sure dns resolving and lookups are Make sure dns resolving and lookups are

correct when mails are receivedcorrect when mails are received tail maillogtail maillog

Make sure no errors have been reportedMake sure no errors have been reported

Page 21: Sendmail configuration and installation Presented by kathleen

More problem solving…More problem solving…

make sure mail is being placed into mqueue at least make sure mail is being placed into mqueue at least temporarily directorytemporarily directory Also try typing mailq to see if they are not being Also try typing mailq to see if they are not being

delivered to end userdelivered to end user Make sure mail is being placed in user Make sure mail is being placed in user

/var/mail/username./var/mail/username. Simply cat out user fileSimply cat out user file Make sure you created a mail inbox in /var/mailMake sure you created a mail inbox in /var/mail

Page 22: Sendmail configuration and installation Presented by kathleen

Any questions?Any questions?