====== Sendmail Configuration on Solaris ====== This document details how to configure sendmail on Solaris systems ===== Solaris 8 ===== Sendmail must be configured by editing the m4 marco file and building a new /etc/mail/sendmail.cf from the m4 macro. It solves a number problems that you would face if you tried to modifiy the sendmail.cf directly. 1. To build the macro you need to :- # cd /usr/lib/mail/cf 2. Create a macro file for your configuration by copying the main.mc or subsidiary.mc to .mc (Usually on BCC the subsidiary.mc should be used). 3. Main.mc assumes that you are directly connected to the internet and your machine can directly open a tcp connect to all other mail servers on theinternet (i.e. mail.sun.com, mail.ibm.com). It also assume that dns is correctly working. 4. Subsidiary.mc is the configuration mc file that should be used if you intend for sendmail to pass all outgoing mail to a mailserver (e.g to BCCHUB. This file smarthost line will need to be configured with the correct smarthost (i.e whatever the name or ip address of the machine where you want email to be sent to for that mail server to be responsable for delivery). For example: 5. The "define(`SMART_HOST', `mailhost$?m.$m$.')" could be changed to read "define(`SMART_HOST', `bcchub.birmingham.gov.uk')" 6. To find out what feature and defines that you can configure in these mc file a full readme is provided /usr/lib/mail/README. 7. To make the cf from the mc file you need to :- # rm /usr/lib/mail/cf/hostname.cf ( if there ) # /usr/ccs/bin/make hostname.cf 8. Then you will need to copy of the cf file into place :- # cp /etc/mail/sendmail.cf /etc/mail/sendmail.old # cp /usr/lib/mail/cf/hostname.cf /etc/mail/sendmail.cf # /etc/init.d/sendmail stop; /etc/init.d/sendmail start ===== Solaris 9 and 10 ===== This part of the document details how to configure sendmail on solaris 9 and 10 to work with the BCC DNS setup. Special setup is required because the BCC DNS does not resolve external addresses and does not return an appropriate response if it cannot resolve the address itself. 1. Prepare /etc/mail cd /etc/mail mkdir old cp *.cf ./old/ ln –s subsidiary.cf sendmail.cf 2.Prepare /usr/lib/mail/cf cd /usr/lib/mail mv cf cf.orig mkdir cf chown root:mail cf chmod 755 cf cp –p cf.orig/Makefile cf 3. Prepare Logging Touch /var/adm/mail.err Touch /var/adm/mail cp –p /etc/syslog.conf syslog.conf.the_date.your_initials 4. Edit /etc/syslog.conf and add the following lines (after the "# syslog configuration file." comment line). Note that if the two colums are not, separated by tab chars syslogd will not start correctly. Pasting these lines will often separate the colums by spaces #### START OF SENDMAIL LOGGING ENTRIES #### mail.notice /var/adm/mail mail.err /var/adm/mail.err #### START OF SENDMAIL LOGGING ENTRIES #### 5. Restart syslogd /etc/init.d/syslog stop /etc/init.d/syslog start 6. Verify that logging is working logger -p mail.notice “test using notice priority” logger -p mail.crit “test using critical priority” 7. A successful test should produce the following results: tail /var/adm/mail lists both messages tail /var/adm/mail.err lists only critcal message 8. If these results are not obtained, the syslog entry lines are probably separated by space characters rather than tab characters. 9. Install sendmail configuration files 10. cd to /usr/lib/mail/cf, then copy and paste the following files from appendix A submit.mc subsidiary.mc 11. If possible, FTP the files from a working server (e.g b0004dpc) as cut/paste versions of the files may not build correctly and sendmail will complain about missing records when started. 12. Customise subsidiary.mc. To do this edit subsidiary.mc and locate the lines: dnl These three lines below setup maskorading FEATURE(`masquerade_entire_domain') MASQUERADE_AS(`birmingham.gov.uk') FEATURE(`masquerade_envelope') 13. If masquerading is not required, delete these lines. If masquerading is required, then update the following line with the domain from which email should appear to originate: MASQUERADE_AS(`birmingham.gov.uk') 14. Build a new configuration and restart sendmail: cd /usr/lib/mail/cf make cp *.cf /etc/mail /etc/init.d/sendmail stop /etc/init.d/sendmail start 15. No error messages should be printed and no error messages should be seen in /var/adm/mail ===== Appendix A ===== ==== Submit.mc ==== divert(-1) # # Copyright D.M.K.Inman and ITNET PLC # # sendmail.mc (for sendmail 8.11 or higher) # # This Configuration will: # Not carry out DNS lookups # Accept mail from the localhost only # Deliver Local # Forward non-local email to a smarthost # Sender Address Masquerading is enabled # # This file must be paired up with its corresponding # subsidiary.mc divert(0)dnl VERSIONID(`$Id: submit.mc 1.10 (ITNET) 23/12/2004') define(`confCF_VERSION', `Submit')dnl define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet define(`confTIME_ZONE', `USE_TZ')dnl dnl The next two lines suppress dns lookups on the sender and dnl recipient domains define(`confDONT_INIT_GROUPS', `True')dnl define(`confDIRECT_SUBMISSION_MODIFIERS',`CC f') dnl If you use IPv6 only, change [127.0.0.1] to [IPv6:::1] FEATURE(`msp', `[127.0.0.1]')dnl ==== subsidiary.mc ==== divert(-1) # # Copyright D.M.K.Inman and ITNET PLC # # sendmail.mc (for sendmail 8.11 or higher) # # This Configuration will: # # Accept mail from the localhost only # Deliver Local # Forward non-local email to a smarthost # Sender Address Masquerading is enabled # # This file must be paired up with its corresponding # submit.mc divert(0)dnl VERSIONID(`@(#)subsidiary.mc 1.10 (ITNET) 23/12/2004') OSTYPE(`solaris8')dnl DOMAIN(`solaris-generic')dnl dnl The three lines below bind the sendmail daemons to localhost dnl as a result, with a few exceptions, only local applications dnl will be able to send mail via the sendmail application. dnl if a local application tries to send mail via a non 127.0.0.1 dnl local address, it will fail. The preferred solution is to update dnl the local application to send mail to localhost FEATURE(`no_default_msa') DAEMON_OPTIONS(`Name=MTA,Port=smtp,Addr=127.0.0.1') DAEMON_OPTIONS(`Name=MSA,Port=submission,Addr=127.0.0.1') dnl The line configures sendmail to smart relay all email to dnl a mail hub 'mailhost' mx record lookups are repressed by dnl the []. mailhost should be in the /etc/hosts file define(`SMART_HOST', `relay:[mailhost]')dnl dnl The line below suppresses DNS lookups FEATURE(`nocanonify')dnl dnl These three lines below setup masquerading FEATURE(`masquerade_entire_domain') MASQUERADE_AS(`birmingham.gov.uk') FEATURE(`masquerade_envelope') MAILER(`local')dnl MAILER(`smtp')dnl dnl This line is required by the smarthost definition above dnl LOCAL_NET_CONFIG dnl Note $* $#esmtp must bet separated by a tab R$* < @ $* .$m. > $* $#esmtp $@ $2.$m $: $1 < @ $2.$m. > $3