2022年8月、ホームページを全面リニューアルしました! 情報を分かりやすくお伝えできるサイト作りを目指してまいります。

超簡単メールサーバ構築!

RedHatLinux系(Laser5Linux6.0 Rel2)バイナリで構築。尚、sendmail本体は、バイナリバージョンがインストールされている事を前提とする。


1. sendmailのインストール(sendmail.cf作成まで)

1) sendmail.defの編集
# cd /usr/src/CF-3.7Wpl2/
# cp ./Standards/smtpcheck-v8.def ./sendmail.def
# vi sendmail.def      
←を編集

以下、編集内容(sendmail.def)① ~ ⑬まで訂正個所(sendmail.defファイルの内容)
===========================================


### Standard sendmail.cf for sendmail 8.9 or later ###

# directory of master files
#MASTERDIR=./Master
# directory of tools
#TOOLDIR=./Tools

### type of sendmail.cf
CF_TYPE=R8V8                     ← ①
### prototype filename
#PROTO=proto.v8
### feature definition filename
#FEATURE=files.v8

###
# [version.v8]
# ID for this definition file
##DEF_ID=’ID keywords for SCCS, RCS, etc….’

# version number for Received: header line
#VERSION=3.7W
#VERSION_SEPARATOR=
#LOCAL_VERSION=
##LOCAL_VERSION=`date +%D`
##LOCAL_VERSION=`date +%y%m%d%H`

#VENDER_CODE=Berkeley

# [ostype]
# OS type (choose a file name in ostype directory)
OS_TYPE=linux-redhat                 ← ②

# [general]
# with sendmail.mx (yes/no)
MX_SENDMAIL=yes                    ← ③
# local domain name (defined automatically) <Dm>
MY_DOMAIN=’hoge.co.jp’          ← ④ドメイン名
# local host name (defined automatically) <Dw>
# V1: with domain name; V5: without domain name
MY_NAME=’main’               ← ⑤ホスト名
# default my official SMTP hostname <Dj>
#OFFICIAL_NAME=’$w’ # for V1/NMTC
#OFFICIAL_NAME=’$w.$m’ # for V5
# my internet aliases <Cw>
#MY_ALIAS=
# define the class “w” with /etc/sendmail.cw (yes/no) <Fw>
#USE_cw_FILECLASS=no
#cw_FILE_PATH=’/etc/sendmail.cw’
##cw_FILE_PATH=’-o /etc/sendmail.cw’ # optional (only with R8)
# accept mails which delivered to user@$j
# (be sure you should configure that another host can get user@$j)
#ACCEPT_OFFICIAL=yes
# rewrite internet aliases to official name in header (yes/no)
#ALIAS_REWRITE=yes

# [address]
# user names which require host.domain
#LOCAL_ADMIN_USERS=’root daemon news usenet postmaster MAILER-DAEMON’
##LOCAL_USERS=’user1 user2 …’
# default from-address (can be $j, $m or another generic address)
#FROM_ADDRESS=’$j’
FROM_ADDRESS=’$m’ #user@domain       ← ⑥
# apply FROM_ADDRESS for receipients (yes/no)
#RECIPIENT_GENERIC=no
# rewrite address which has official name already into generic form
# (yes/lower/no)
#REWRITE_GENERIC_FROM=no
#REWRITE_GENERIC_TO=no
# rewrite local address of recipient on relay mailer (generic/strip/no)
#REWRITE_LOCAL_ON_RELAY=no

# [canon]
# canonicalization with nameserver lookup
# (all/one/short/unknown/cname/no; or *-append)
#CANON=one # if MX_SENDMAIL = yes
#CANON=no # if MX_SENDMAIL = no
# domains which are already completed
##NO_CMPLT_DOMS=’/etc/sendmail.topdomains’
##NO_CMPLT_DOMS=’jp net edu com mil org gov us’
# every envelope address should be canonicalized (yes/no/unknown)
# this is for addresses which is not canonicalized by CANON definition
#CANON_ENVELOPE=no

# [acceptaddr]
# addresses which should be accepted as local
ACCEPT_ADDRS=’$m’ # can be used with R8 sendmail   ← ⑦
#ACCEPT_ADDRS=$MY_DOMAIN
##ACCEPT_ADDRS=’accept.domain.name1 accept.domain.name2 …’
# use /etc/sendmail.aa file (yes/optional/no)
# (“optional” is for R8 only)
#USE_aa_FILECLASS=no
#aa_FILE_PATH=’/etc/sendmail.aa’
# accept mails for all hosts within my domain
# (yes/no/”a specific domain with leading dot”; default for “yes” is .$m)
ACCEPT_LOWER=yes                              ← ⑧
# lower name matching style (lw-file/!lw-file/any/one)
LOWER_MATCH_STYLE=any                         ← ⑨
#lw_FILE_PATH=’/etc/sendmail.lw’
# if LOWER_NAMES is defined, it is used instead of lw_FILE
##LOWER_NAMES=’lower1 lower2 lower3′
# consider local if the best MX for an address points to myself (yes/no)
# do not set “yes” if TryNullMXList(Ow) trick is used. (V6 or later)
#ACCEPT_BESTMX=no
# domains to be considered for best-mx match (all/”domain names”)
#BESTMX_DOMAINS=all

# [specialfrom]
# special address
##SPECIAL_FROM=’special.address’
# <<CONFIGURATIONS AS A SENDER>>
# special users who should use the special address
##SPECIAL_USERS=’user1 user2 …’
##SPECIAL_USERS=’/etc/sendmail.specialusers’
##SPECIAL_USER_HEAD=’pre1 pre2 …’
##SPECIAL_USER_TAIL=’post1 post2 …’
# perform special address rewriting (yes/no)
#SPECIAL_FROM_REWRITE=no
# <<CONFIGURATIONS AS A RECIPIENT>>
# special users who should use the special address
##SPECIAL_ACCEPTABLE_USERS=’user1 user2 …’
##SPECIAL_ACCEPTABLE_USERS=’/etc/sendmail.specialaccept’
##SPECIAL_ACCEPTABLE_USER_HEAD=’pre1 pre2 …’
##SPECIAL_ACCEPTABLE_USER_TAIL=’post1 post2 …’
# make “User Unknown” error for users not listed in SPECIAL_ACCEPTABL (yes/no)
#ERROR_NOT_ACCEPTABLE_USERS=no

# [hub]
# hub host
##HUB_HOST=’hub.host.name’
# list of users who should be recognized as remote
##REMOTE_USERS=/etc/users.remote
# list of users who should be recognized as local (higher preference)
##NON_REMOTE_USERS=/etc/users.local
# relay local to hub host (yes/no)
#RELAY_LOCAL_TO_HUBHOST=no
# exact address specification
#WITH_HUB_ADDR=no
#IGNORE_HUB_MX=no
# make local sticky (yes/no)
#LOCAL_STICKY=no

# [spool]
# spool host
##SPOOL_HOST=’spool.host.name’
# exact address specification
#IGNORE_SPOOL_MX=no
#WITH_SPOOL_ADDR=no
# make local(admin) users sticky (yes/no)
#ADMIN_STICKY=no

# [secondary]
# secondary domain
##SECONDARY_DOMAIN=’secondary.domain.name’
# list of users belong to the domain
##SECONDARY_USERS=’hash:/etc/aliases.secondary’
##SECONDARY_USERS=’dbm:/etc/aliases.secondary’
##SECONDARY_USERS=’nis:aliases.secondary.map’
##SECONDARY_USERS=’nisplus:aliases_secondary.org_dir’
##SECONDARY_USERS=’user1 user2 …’
##SECONDARY_USERS=/etc/users.secondary
##SECONDARY_USERS=’/etc/aliases.secondary %[^: \#]’
## the last style is available only with sendmail compiled with SCANF option
# addresses for users belong to the domain (yes/no)
#USE_SECONDARY_DOMAIN_FROM=no
#USE_SECONDARY_DOMAIN_TO=no

# [alias]
# hostname alias file (set path of alias file)
#ADDRESS_ALIAS_FILE=

# [domaintable]
# use domaintable feature (yes/no/”database path”; default:/etc/domaintable)
# how to make DB: makemap hash /etc/domaintable.db < /etc/domaintable
#DOMAINTABLE=no

# [one-token]
# action on one-token address (none/reject/deliver-ignmx)
#ONE_TOKEN_HOST=no

# [nosourceroute]
# generate rules not to relay source routed mails (yes/no)
#REJECT_SOURCE_ROUTE_RELAY=no

# [redirect]
# use REDIRECT error message feature (yes/no)
#REDIRECT=no

# [kanji]
# kanji code conversing local mailer
#KANJI_CONVERSION=no
# mailer path definitions
#LOCAL_MAILER_PATH=’/bin/binmail.kc’
#LOCAL_MAILER_ARGS=’mail $h -d $u’
##KANJI_J_USERS=’user1 user2′ # describe just in one line
##KANJI_J_USERS=’/etc/sendmail.jis_users’
##KANJI_S_USERS=’user3 user4′ # describe just in one line
##KANJI_S_USERS=’/etc/sendmail.sjis_users’
##KANJI_E_USERS=’user5 user6′ # describe just in one line
##KANJI_E_USERS=’/etc/sendmail.euc_users’
##KANJI_N_USERS=’user7 user8′ # describe just in one line
##KANJI_N_USERS=’/etc/sendmail.nc_users’

# [mailer.v7]
# always append domainname even local delivery (yes/no)
#ALWAYS_APPEND_DOMAIN=no
# leave raw from address with relay mailer (yes/no/normal)
#RELAY_FROM_RAW=no

# general mailer description
#LOCAL_MAILER_PATH=’/bin/mail’
#LOCAL_MAILER_FLAG_BASE=’lsDFMAw5:/|@qrmn’
##LOCAL_MAILER_FLAG_ADD=
##LOCAL_MAILER_FLAG_SUB=
#LOCAL_MAILER_TYPE=’DNS/RFC822/X-Unix’
#LOCAL_MAILER_ARGS=’mail -d $u’
##LOCAL_MAILER_MAXLINE=
##LOCAL_MAILER_MAXSIZE=
##LOCAL_MAILER_OPTS_ADD=
#PROG_MAILER_PATH=’/bin/sh’
##PROG_MAILER_PATH=’/usr/etc/smrsh’
#PROG_MAILER_FLAG_BASE=’lsDFMoqeuP’
##PROG_MAILER_FLAG_ADD=
##PROG_MAILER_FLAG_SUB=
#PROG_MAILER_TYPE=’X-Unix’
#PROG_MAILER_ARGS=’sh -c $u’
#PROG_MAILER_WDIR=’$z:/’
##PROG_MAILER_MAXLINE=
##PROG_MAILER_MAXSIZE=
##PROG_MAILER_OPTS_ADD=
#SMTP_MAILER_FLAG_BASE=’mDFMuX’
##SMTP_MAILER_FLAG_ADD=
##SMTP_MAILER_FLAG_SUB=
#SMTP_MAILER_ARGS=’IPC $h’
##SMTP_MAILER_ARGS=’IPC $h 25′
#SMTP_MAILER_TYPE=’DNS/RFC822/SMTP’
#SMTP_MAILER_MAXLINE=990
##SMTP_MAILER_MAXSIZE=
##SMTP_MAILER_OPTS_ADD=
#ESMTP_MAILER_FLAG_BASE=’mDFMuXa’
##ESMTP_MAILER_FLAG_ADD=
##ESMTP_MAILER_FLAG_SUB=
#ESMTP_MAILER_ARGS=’IPC $h’
##ESMTP_MAILER_ARGS=’IPC $h 25′
#ESMTP_MAILER_TYPE=’DNS/RFC822/SMTP’
#ESMTP_MAILER_MAXLINE=990
##ESMTP_MAILER_MAXSIZE=
##ESMTP_MAILER_OPTS_ADD=
#SMTP8_MAILER_FLAG_BASE=’mDFMuX8′
##SMTP8_MAILER_FLAG_ADD=
##SMTP8_MAILER_FLAG_SUB=
#SMTP8_MAILER_ARGS=’IPC $h’
##SMTP8_MAILER_ARGS=’IPC $h 25′
#SMTP8_MAILER_TYPE=’DNS/RFC822/SMTP’
#SMTP8_MAILER_MAXLINE=990
##SMTP8_MAILER_MAXSIZE=
##SMTP8_MAILER_OPTS_ADD=
#RELAY_MAILER_FLAG_BASE=’mDFMuX8′
##RELAY_MAILER_FLAG_ADD=
##RELAY_MAILER_FLAG_SUB=
#RELAY_MAILER_ARGS=’IPC $h’
##RELAY_MAILER_ARGS=’IPC $h 25′
#RELAY_MAILER_TYPE=’DNS/RFC822/SMTP’
#RELAY_MAILER_MAXLINE=2040
##RELAY_MAILER_MAXSIZE=
##RELAY_MAILER_OPTS_ADD=

# default SMTP mailer
#M_SMTP=smtp

# [procmail]
# procmail mailer handling
# define PROCMAIL_MAILER_PATH explicitly if you want to use procmail feature
##PROCMAIL_MAILER_PATH=/usr/local/bin/procmail
#PROCMAIL_MAILER_ARGS=’procmail -Y -m $h $g $u’
#PMLOCAL_MAILER_ARGS=’procmail -Y -a $h -d $u’
#
# Use procmail for local delivery instead of default local mailer (yes/no)
#LOCALDELIVER_PROCMAIL=no
#
### V5
#PROCMAIL_MAILER_FLAG=’DFMSPhnu’
#PMLOCAL_MAILER_FLAG=’lDFMSPfhnu’
### V6
#PROCMAIL_MAILER_FLAG=’DFMSPhnu’
#PMLOCAL_MAILER_FLAG=’lDFMAw5:/|@SPfhnu’
### V7 or later
#PROCMAIL_MAILER_FLAG=’DFMSPhnu’
#PMLOCAL_MAILER_FLAG=’lDFMAw5:/|@SPqfhnu’
#
##PROCMAIL_MAILER_MAXSIZE=100000
##PMLOCAL_MAILER_MAXSIZE=100000

# [localdeliver]
# separator to manage plussed users
#PLUSSED_SEPARATOR=’+’
##PLUSSED_SEPARATOR=’=’
# list of special plussed users
##PLUSSED_USERS=/etc/plussed.users
##PLUSSED_USERS=’puser1 puser2 puser3′
##PLUSSED_USERS=’all’
# shift token from domain part to local part
##PLUSSED_ADDRS=/etc/plussed.addrs
##PLUSSED_ADDRS=’host1.domain host2.domain host3.domain’
# matching style for token shift (exact/lower)
#PLUSSED_ADDRS_MATCH=exact
# order of user name and option for token shift (normal/reverse)
#PLUSSED_ORDER=’normal’

# [cyrus]
# cyrus IMAP mailer handling (supported with V6 cf or later)
# (see http://andrew2.andrew.cmu.edu/cyrus/ to get info. about the cyrus)
# define CYRUS_MAILER_PATH explicitly if you want to use cyrus feature
##CYRUS_MAILER_PATH=/usr/cyrus/bin/deliver
#CYRUS_MAILER_UID=’cyrus:mail’
#
#CYRUS_MAILER_ARGS=’deliver -m $h — $u’
##CYRUS_MAILER_ARGS=’deliver -e -m $h — $u’
#CYRUSBB_MAILER_ARGS=’deliver -m $u’
##CYRUSBB_MAILER_ARGS=’deliver -e -m $u’
#
# Domain name which should be accepted for delivery with IMAP mailer
# If you do not define, IMAP mailer is used instead of local mailer
##IMAP_DOMAIN=imap.domain
# Domain name which should be accepted for delivery with IMAP BB mailer
# If you do not define, bb+name@local is accepted for IMAP BB
##IMAPBB_DOMAIN=imapbb.domain
# Allow user+mbox@domain style addressing (yes/no)
#IMAP_PLUSSED_DELIVERY=no
#
### V6 cf
#CYRUS_MAILER_FLAG=’lsDFMA5@nSP’
#CYRUSBB_MAILER_FLAG=’lsDFMnSP’
### V7 cf
#CYRUS_MAILER_FLAG=’lsDFMA5@qnSP’
#CYRUSBB_MAILER_FLAG=’lsDFMnSP’

# [external]
# external mailer definitions
# a sample for authorization checker
##EXTERNAL_MAILER_PATH=/usr/local/mail/mail_filter
##EXTERNAL_MAILER_FLAG=’mDFMuXnP’
##EXTERNAL_MAILER_ARGS=’mail_filter $h $g $u’
##EXTERNAL_MAILER_MAXSIZE=100000
# the following line is only for R8 sendmail
##EXTERNAL_MAILER_MAXLINE=

# [separate]
# POP pseudo-domains support (yes/no)
#PSEUDO_POP_DOMAIN=no
#POPDOM_MAILER_PATH=’/usr/sbin/lmail’
#POPDOM_MAILER_FLAG=$PROG_MAILER_FLAG
#POPDOM_MAILER_ARGS=’lmail -d $h $u’
#POPDOM_MAILER_MAXSIZE=100000
# the following line is only for R8 sendmail
##POPDOM_MAILER_MAXLINE=

# [pop-feed]
# feed mails with pop via single user account (yes/no)
#USE_POPFEED=no
#POPFEED_MAILER_PATH=$LOCAL_MAILER_PATH
#POPFEED_MAILER_FLAG=’lsDFMmrn’
#POPFEED_MAILER_ARGS=’mail -d $u’
#POPFEED_MAILER_MAXSIZE=100000
# the following line is only for R8 sendmail
##POPFEED_MAILER_MAXLINE=

# [bitnet]
# resolve BITNET traffic (static/mx/no/auto)
#BITNET=no
BITNET=auto                            ← ⑩
#BITNET_RELAY=’bitnetjp.ad.jp’
##BITNET_RELAY=’dom.bitnetjp.ad.jp’

# [decnet]
# resolve DECNET traffic (“relay host name”/no)
#DECNET=no

# [junet]
# reject *.JUNET style address (yes/no)
#REJECT_JUNET=no

# [uucp.v6]
# UUCP connection (yes/no)
#UUCP_GW=no
# my UUCP node name (defined automatically with R8) <Dk>
##UUCP_HOST_NAME=’my-uucp-host-name’
# UUCP neighbors
##UUCP_NEIGHBORS=/etc/uucp.neighbors
##UUCP_NEIGHBORS=’uugw1 uugw2 uugw3′
# taylor’s UUCP style sysname aliases # not for NMTC
##SYSNAME_ALIASES=/etc/uucp.neighbor.domain
##SYSNAME_ALIASES=’uu.domain1 uu.domain2 uu.domain3′
# extended UUCP style to domain style route address conversion (yes/no)
#EXTENDED_UUCP_ADDR_CONV=no
# UUCP relay host name
##UUCP_RELAY=’uunet.uu.net’
# canonicalize to domain-style on unknown uucp hostname with nameserver
#CANON_UNKNOWN_UUCP=no

#UUCP_MAILER_PATH=’/usr/bin/uux’
#UUCP_MAILER_FLAG=’mDFMud’
##UUCP_MAILER_FLAG_ADD=
##UUCP_MAILER_FLAG_SUB=
# It would be better to add a parameter “-a$g” as UUCP_MAILER_ARGS
# if “uux” on your system supports “-a” option.
#UUCP_MAILER_ARGS=’uux – -r -gB $h!rmail ($u)’
##UUCP_MAILER_MAXLINE= # V5
#UUCP_MAILER_MAXSIZE=100000

# using ugly rmail which appeds somewhere! on domain address (yes/no)
#NEED_SOMEWHERE_HACK=no

# [another_addr]
# define another smtp/uucp mailer which uses another address
##ANOTHER_ADDRESS=another.address
#REWRITE_MYNAME_TO_ANOTHER_ADDRESS=no
#REWRITE_ACCEPT_ADDRS_TO_ANOTHER_ADDRESS=no
#SMTP2_MAILER_FLAG_BASE=”$SMTP_MAILER_FLAG_BASE”
#SMTP2_MAILER_FLAG_ADD=
#SMTP2_MAILER_FLAG_SUB=
#SMTP2_MAILER_ARGS=”$SMTP_MAILER_ARGS”
#SMTP2_MAILER_OPTS=”$SMTP_MAILER_OPTS”
#SMTP2_MAILER_TYPE=”$SMTP_MAILER_TYPE”
#UUCP2_MAILER_PATH=”$UUCP_MAILER_PATH”
#UUCP2_MAILER_FLAG_BASE=”$UUCP_MAILER_FLAG_BASE”
#UUCP2_MAILER_FLAG_ADD=
#UUCP2_MAILER_FLAG_SUB=
#UUCP2_MAILER_ARGS=”$UUCP_MAILER_ARGS”
#UUCP2_MAILER_OPTS=”$UUCP_MAILER_OPTS”
#UUCP2_MAILER_TYPE=”$UUCP_MAILER_TYPE”

# [netnews]
# NetNews Gateway Service (yes/no)
#NEWS_GATEWAY=no
# Accepting Groups (Only TOP Domains for NMTC)
#NEWS_GROUPS=
# Suffix
#NEWS_SUFFIX=.NETNEWS

#NEWS_MAILER_PATH=’/usr/lib/news/mailtonews’
#NEWS_MAILER_FLAG=’lsDFMm’
#NEWS_MAILER_ARGS=’mailtonews $u’
##NEWS_MAILER_MAXLINE= # V5
#NEWS_MAILER_MAXSIZE=100000

# [numeric]
# resolve numeric address spec with nameserver (yes/no)
# (should be YES to accept user@[my.IP.address] certainly)
#RES_NUMERIC=yes
# delivery with numeric address spec (yes/strip/no)
DELIVER_NUMERIC=yes                          ← ⑪

# [route]
# routing description file
#ROUTE_ADDRESS_FILE=

# [deliver]
# static routing description file
#STATIC_ROUTE_FILE=
# use long macro/class names (yes/no)
#USE_EXTENDED_NAMES=no

# [mailertable]
# use mailertable feature (yes/no/”db_type:db_path”/”db_type:-o db_path”)
# default is hash:/etc/mailertable)
# how to make DB: makemap hash /etc/mailertable.db < /etc/mailertable
# or makedbm /etc/mailertable /etc/mailertable (ndbm on SunOS4)
#MAILERTABLE=no

# [nis.hosts]
# use deliver with nis lookup (yes/no)
# (-DNIS must be specified at compile time)
#NIS_LOOKUP_DELIVER=no

# [indirect]
# for indirect delivery
# domain names to be deliverd directly (all/none/”domain names”)
DIRECT_DELIVER_DOMAINS=all                      ← ⑫
# mailer for direct delivery
#DIRECT_DELIVER_MAILER=smtp
# relay host for indirect delivery (in case of none or “domain names”)
##DEFAULT_RELAY=’smtp:relay.host.name’
##DEFAULT_RELAY=’smtp:relay1.host.name.:relay2.host.name.’
## with the above definition, relay2 will be tried only if relay1 is down
##DEFAULT_RELAY=’error:deliver’

# [error]
# use default error messages (yes/no)
#USE_DEFAULT_ERROR_MESSAGES=yes

# [usertable]
# domain names and map tables for usertable rewriting
##USERTABLE_MAPS=’local=hash:/etc/ut.local \
## ut.dom1=btree:/etc/ut.dom1:error \
## ut.dom2=dbm:/etc/ut.dom2 \
## ut.dom3=nis:usertable3′
## format: domain_name=map_type:map_path:error_on_no_user_flag
# How to make DB: makemap btree /etc/ut.dom1.db < /etc/ut.dom1 (btree)
# or makedbm /etc/ut.dom2 /etc/ut.dom2 (ndbm on SunOS4)
# rewrite from/to addresses on local map from user@$j or user@$ACCEPTADDRS
# into user@[mailname] (yes/no)
#USERTABLE_LOCAL_REWRITE=no
#USERTABLE_RECIPIENT_REWRITE=no

# [option.v8]
# format of Received: header line
# (combination of None/Simple/NoFrom|EnvFrom|Novers|Ident|Proto|Fold|Multi|Dest)
#FORMAT_RECEIVED=Ident-Proto-Dest-Multi

# trusted users <T>
#TRUSTED_USERS=
##TRUSTED_USERS_FILE_PATH=/etc/sendmail.ct
##TRUSTED_USERS_FILE_PATH=’-o /etc/sendmail.ct’ # config. for optipnal file

# my name <Dn>
#DAEMON_NAME=’MAILER-DAEMON’
# format of a total name <Dq>
##TOTAL_NAME=’$g$?x ($x)$.’
#TOTAL_NAME=’$?x$x <$g>$|$g$.’

# strip message body to 7 bits on input? <SevenBitInput> (True/False)
#SEVEN_BIT_INPUT=’False’

# 8-bit data handling <EightBitMode> (p/m/s)
#EIGHT_BIT_HANDLING=’pass8′
# location of alias file <AliasFile>
#ALIAS_FILE_PATH=’/etc/aliases’
##ALIAS_FILE_PATH=’/etc/aliases,/etc/aliases.share’
# map name of NIS aliases file (define if you want to use NIS aliases)
##NIS_ALIAS_MAP=mail.aliases
# NIS domain name (define if required)
##NIS_DOMAIN=my.nis.domain
# wait for alias file rebuild (default units: minutes) <AliasWait>
#ALIAS_WAIT=’10’
# maximum message size <MaxMessageSize>
##MAX_MSG_SIZE=’1000000′
# substitution for space (blank) characters <BlankSub>
#BLANK_SUB=’.’
# minimum number of free blocks on filesystem <MinFreeBlocks>
#MIN_FREE=’100′
# checkpoint queue runs after every N successful deliveries
# <CheckpointInterval>
#CHECKPOINT_INTERVAL=’10’
# avoid connecting to “expensive” mailers on initial submission?
# <HoldExpensive> (True/False)
#CON_EXP=’False’
# automatically rebuild the alias database? <AutoRebuildAliases> (True/False)
#AUTO_REBUILD=’False’
# default delivery mode <DeliveryMode>
#DELIVERY_MODE=’background’
# error message header/file <ErrorHeader>
##ERROR_MSG_FILE_PATH=’/etc/sendmail.oE’
# error mode <ErrorMode> (print/mail/write)
##ERROR_MODE=’print’
# temporary file mode <TempFileMode>
#TEMP_FILE_MODE=’0600′
# save Unix-style “From_” lines at top of header? <SaveFromLine> (True/False)
#SAVE_FROM_LINES=’False’
# match recipients against GCOS field? <MatchGECOS> (True/False)
#MATCH_GECOS=’False’
# location of help file <HelpFile>
#HELP_FILE_PATH=’/usr/lib/sendmail.hf’
# maximum hop count <MaxHopCount>
#MAX_HOP=’25’
# name resolver options <ResolverOptions>
# [+/-](debug/aaonly/usevc/primary/igntc/recurse/defnames/stayopen/
# dnsrch/HasWildcardMX)
#BIND_OPTS=”
# ignore dots as terminators in incoming messages? <IgnoreDots> (True/False)
#IGNORE_DOTS=’False’
# forward file search path <ForwardPath>
##FORWARD_FILE_PATH=’/var/forward/$u:$z/.forward.$w:$z/.forward’
# deliver MIME-encapsulated error messages? <SendMimeErrors> (True/False)
#MIME_FORMAT_ERRORS=’True’
# open connection cache timeout <ConnectionCacheTimeout>
#MCI_CACHE_TIMEOUT=’5m’
# open connection cache size <ConnectionCacheSize>
#MCI_CACHE_SIZE=’2′
# log level <LogLevel>
#LOG_LEVEL=’9′
# use Errors-To: header? <UseErrorsTo> (True/False)
#USE_ERRORS_TO=’False’
# send to me too, even in an alias expansion? <MeToo> (True/False)
#ME_TOO=’True’
# verify RHS in newaliases? <CheckAliases> (True/False)
#CHECK_ALIASES=’True’
# SMTP daemon options <DaemonPortOptions>
##DAEMON_OPTIONS=’Port=esmtp’
# default messages to old style headers if no special punctuation?
# <OldStyleHeaders> (True/False)
#OLD_STYLE_HEADERS=’True’
# who (if anyone) should get extra copies of error messages
# <OldStyleHeaders>
##COPY_ERRORS_TO=’postmaster’
# privacy flags <PrivacyOptions>
# (public/needmailhelo/needexpnhelo/needvrfyhelo/noexpn/
# novrfy/restrictmailq/restrictqrun/noreceipts/noetrn/noverb/
# goaway/authwarnings)
#PRIVACY_FLAGS=’authwarnings’
##PRIVACY_FLAGS=”
# queue directory <QueueDirectory>
#QUEUE_DIR=’/var/spool/mqueue’
# slope of queue-only function <QueueFactor>
##QUEUE_FACTOR=’600000′
# should we not prune routes in route-addr syntax addresses?
# <DontPruneRoutes>
##NO_STRIP_ROUTE=’False’
# timeouts (many of these) <Timeout.*>
##TIMEOUT_INITIAL=’5m’
##TIMEOUT_HELO=’5m’
##TIMEOUT_MAIL=’10m’
##TIMEOUT_RCPT=’1h’
##TIMEOUT_DATAINIT=’5m’
##TIMEOUT_DATABLOCK=’1h’
##TIMEOUT_DATAFINAL=’1h’
##TIMEOUT_CONNECT=’0s’
##TIMEOUT_INIT_CONNECT=’0s’
##TIMEOUT_RSET=’5m’
##TIMEOUT_QUIT=’2m’
##TIMEOUT_MISC=’2m’
##TIMEOUT_COMMAND=’1h’
##TIMEOUT_IDENT=’30s’
##TIMEOUT_FILEOPEN=’60s’
#TIMEOUT_QUEUERETURN=’5d’
##TIMEOUT_QUEUERETURN_NORMAL=’5d’
##TIMEOUT_QUEUERETURN_URGENT=’2d’
##TIMEOUT_QUEUERETURN_NON_URGENT=’7d’
##TIMEOUT_QUEUEWARN=’4h’
##TIMEOUT_QUEUEWARN_NORMAL=’4h’
##TIMEOUT_QUEUEWARN_URGENT=’1h’
##TIMEOUT_QUEUEWARN_NON_URGENT=’12h’
##TIMEOUT_MCI_INFO=’30m’
# status file <StatusFile>
#STAT_FILE_PATH=’/etc/sendmail.st’
# queue up everything before forking? <SuperSafe> (True/False)
#SAFE_QUEUE=’True’
# time zone handling: <TimeZoneSpec>
# if undefined, use system default
# if defined but null, use TZ envariable passed in
# if defined and non-null, use that info
TIME_ZONE=JST-9                              ← ⑬
# list of locations of user database file (null means no lookup)
# <UserDatabaseSpec>
#USER_DATABASE_FILE_PATH=”
# default UID (can be username or userid:groupid) <DefaultUser>
#DEF_UID=’1:1′
# fallback MX host <FallbackMXhost>
##FALLBACK_MX=’fall.back.host.net’
# if we are the best MX host for a site,
# try it directly instead of config error <TryNullMXList>
#TRY_NULL_MX_LIST=’False’
# load average at which we refuse connections <RefuseLA>
#LOAD_REFUSE=’12’
# load average at which we just queue messages <QueueLA>
#LOAD_QUEUE=’8′
# deliver each queued job in a separate process? <ForkEachJob> (True/False)
#SEPARATE_PROC=’False’
# work recipient factor <RecipientFactor>
##WORK_RECIPIENT_FACTOR=’30000′
# work time factor <RetryFactor>
##WORK_TIME_FACTOR=’90000′
# work class factor <ClassFactor>
##WORK_CLASS_FACTOR=’1800′
# shall we sort the queue by hostname first? <QueueSortOrder>
# (priority/host/time)
##QUEUE_SORT_ORDER=’priority’
# minimum time in queue before retry <MinQueueAge>
#MIN_QUEUE_AGE=’10m’
# default character set <DefaultCharSet>
##DEF_CHAR_SET=’iso-8859-1′
# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
# <ServiceSwitchFile>
##SERVICE_SWITCH=’/etc/service.switch’
# hosts file (normally /etc/hosts) <HostsFile>
##HOSTS_FILE_PATH=’/etc/hosts’
# dialup line delay on connection failure <DialDelay>
##DIAL_DELAY=’10s’
# action to take if there are no recipients in the message
# <NoRecipientAction> (none/add-to/add-apparently-to/add-bcc/add-to-undisclosed)
##NO_RECIPIENT_ACTION=’add-to-undisclosed’
# chrooted environment for writing to files <SafeFileEnvironment>
##FILE_ENV=’/arch’
# are colons OK in addresses? <ColonOkInAddr>
#COLON_OK_IN_ADDR=’False’
# how many jobs can you process in the queue? <MaxQueueRunSize>
##MAX_QUEUE_RUN=’10000′
# shall I avoid expanding CNAMEs (violates protocols)? <DontExpandCnames>
#DONT_EXPAND_CNAME=’False’
# SMTP initial login message (old $e macro) <SmtpGreetingMessage>
#SMTP_GREETING_MSG=’$j Sendmail $v/$Z; $b’
# UNIX initial From header format (old $l macro) <UnixFromLine>
#UNIX_FROM_LINE=’From $g $d’
# delimiter (operator) characters (old $o macro) <OperatorChars>
#OPERATOR_CHARS=’.:%@!^=/[]|+’
# shall I avoid calling initgroups(3) because of high NIS costs?
# <DontInitGroups>
#DONT_INIT_GROUPS=’False’
# make sure from fits on one line <SingleLineFromHeader>
#SINGLE_LINE_FROM=’False’
# allow HELO commands with syntax errors <AllowBogusHELO>
#ALLOW_BOGUS_HELO=’False’
# connection rate throttle <ConnectionRateThrottle>
##CONN_RATE=’3′
# group writable files are unsafe <UnsafeGroupWrites>
#UNSAFE_GROUP_WRITES=’False’
# address to which to send double bounces <DoubleBounceAddress>
#DOUBLE_BOUNCE=’postmaster’
# persistent host status directory <HostStatusDirectory>
##HSTAT_DIR=’.hoststat’
# single thread deliveries (requires hsdir) <SingleThreadDelivery>
#SINGLE_THREAD_DELIVERY=’False’
# run bulk of code as this user <RunAsUser>
#RUN_AS_USER=’postmaster’
# maximum number of children we allow at one time <MaxDaemonChildren>
##MAX_DAEMON_CHILDREN=’12’
# Characters to be quoted in a full name phrase
# (@,;:\()[] are automatic) <MustQuoteChars>
##MUST_QUOTE_CHAR=’.’
# override file safeties – setting this option compromises system security
# need to set this now for the sake of class files <DontBlameSendmail>
##DONT_BLAME_SENDMAIL=’safe’
# shall we get local names from our installed interfaces?
# <DontProbeInterfaces>
##DONT_PROBE_INTERFACE=’False’
# maximum number of recipients per SMTP envelope <MaxRecipientsPerMessage>
##MAX_RCPT_PER_MSG=’100′

# [smtpcheck]
#MAIL_RELAY_RESTRICTION=yes
#WITH_OLD_CF=no # (just for smtpcheck.def)
##CHECK_HOST_ALLOW=/etc/sendmail.allow
##CHECK_HOST_DENY=/etc/sendmail.deny
#CHECK_RELAY_DEFAULT=allow # (allow/deny)
# LOCAL_HOST_* does not check senders address
##LOCAL_HOST_IPADDR=/etc/sendmail.localip
#LOCAL_HOST_IPADDR=192.168.255
#LOCAL_HOST_DOMAIN=mity.co.jp
##LOCAL_HOST_DOMAIN=sub.kyoto-u.ac.jp
#
# CLIENT_* does check senders address
##CLIENT_HOST_IPADDR=/etc/sendmail.clientip
##CLIENT_HOST_IPADDR=130.54
##CLIENT_HOST_DOMAIN=/etc/sendmail.clientdomain
##CLIENT_HOST_DOMAIN=kyoto-u.ac.jp
##CLIENT_FROM_DOMAIN=/etc/sendmail.clientfrom
##CLIENT_FROM_DOMAIN=kyoto-u.ac.jp
#(CLIENT_FROM_DOMAIN will cause a trouble when global MLs are operated
#at client hosts.)
#
# ROAM_* does check senders address
##ROAM_HOST_IPADDR=/etc/sendmail.roamip
##ROAM_HOST_IPADDR=133.3
##ROAM_HOST_DOMAIN=/etc/sendmail.roamdomain
##ROAM_HOST_DOMAIN=kyoto.isp.jp
##ROAM_USERS=/etc/sendmail.roamusers
##ROAM_USERS=’user1@kyoto-u.ac.jp user2@sub.kyoto-u.ac.jp’
#
# create db with “makemap hash /etc/sendmail.spamlist.db < list” for hash.
# types are: null, dbm, hash, btree,… (null is to ignore this map)
##SPAM_LIST=hash:/etc/sendmail.spamlist
##SPAM_REGEX=’^[0-9]+@(aol|msn)\.com’
#
# Use the MAPS (the Mail Abuse Protection System) RBL (Realtime Blackhole
# List) by Paul Vixie (see http://maps.vix.com/rbl/) (yes/no/log/mark)
# (“log”/”mark” can be used with sendmail 8.9.1+3.1W)
# You should be aware of extra DNS traffic
#USE_MAPS_RBL=no
# Use the ORBS (Open Relay Blocking System) provided by www.dorkslayers.com
# (see http://www.dorkslayers.com/orbs/) (yes/no/log/mark)
# (“log”/”mark” can be used with sendmail 8.9.1+3.1W)
# You should be aware of extra DNS traffic
#USE_ORBS=no

# Reject from-addresses without domain part (just a user name) (yes/no)
#NEED_SENDER_DOMAIN=yes
#
# Reject from-addresses with one-token domain part (not FQDN) (yes/no)
#CHECK_FROM_FQDN=yes
#
# Verify existence of DNS entry for sender address
# CAUTION: messages will be rejected even if just DNS lookup failure
# with sendmail 8.8(V7), and you also should be aware of extra DNS traffic
# (yes/no/log/mark) (“log”/”mark” can be used with sendmail 8.9.1+3.1W)
#USE_SENDER_DNS_CHECK=no
#
# Allow relaying if I am an MX host for the recipient (yes/no) (V8 or later)
# Your sendmail should be compiled with NAMED_BIND=1
#LOWER_MX_OK=no
#
##ALLOW_RECIPIENT_DOMAIN=/etc/sendmail.acceptdomain
##ALLOW_RECIPIENT_DOMAIN=hash:/etc/sendmail.acceptdomain
##ALLOW_RECIPIENT_DOMAIN=kyoto-u.ac.jp
##ALLOW_RELAY_FROM=/etc/sendmail.relay.from
##ALLOW_RELAY_FROM=kyoto-u.ac.jp
##ALLOW_RELAY_TO=/etc/sendmail.relay.to
##ALLOW_RELAY_TO=kyoto-u.ac.jp
##RELAY_MAP=hash:/etc/sendmail.relay.map
#
##CLIENT_DENY_TO=/etc/sendmail.deny.to
##CLIENT_DENY_TO=kyoto-u.ac.jp
##RELAY_MAP_INSIDE=hash:/etc/sendmail.inside.relay.map
## reject source routing from out side (yes/no)
#REJECT_EXTERN_SRR=yes
#
# Reject recipients as if the recipients are unknown users.
# create db with “makemap hash /etc/sendmail.rejrcpt.db < list” for hash.
# types are: null, dbm, hash, btree,… (null is to ignore this map)
##REJ_RCPT_LIST=hash:/etc/sendmail.rejrcpt
#
# (Following configurations are independent of MAIL_RELAY_RESTRICTION)
# Checking contents of header (V8 or later)
# Reject messages with ill formated Message-Id: (yes/no)
#HDR_REJECT_BADMID=no
# Reject messages with specific addresses in To:/Cc:
##HDR_REJECT_RCPTADDRS=friend
##HDR_REJECT_RCPTADDRS=friend@public.com
##HDR_REJECT_RCPTADDRS=/etc/sendmail.hdrrejaddr
# Action for rejection (error/discard) error=bounce; discard=/dev/null
#HDR_REJECT_ACTION=error

# [localhack]
# localhack description file
#LOCALHACK_FILE=
# can be defined ID to LOCALHACK_REVISION_ID in localhack file

2) sendmail.cfの作成

# make sendmail.cf

# cp sendmail.cf /etc/

# chmod 644 /etc/sendmail.cf

3) sendmail.cfの編集

前略

################################
# SMTP processing restrictions #
################################

##
## upon SMTP authentication
##

# CONFIG: clients to be allowed to connect this server
C{HostAllow} 127.0.0.1
#C{HostAllow} 12.34.56
#F{HostAllow} -o /etc/sendmail.allow
# CONFIG: clients to be rejected to connect this server
#C{HostDeny} 23.45.67
#F{HostDeny} -o /etc/sendmail.deny
# CONFIG: acceptable (no further checking) clients

C{LocalIP} 127.0.0.1 192.168.1       <=重要 192.168.1.0のネットワークアドレスのドメインの場合、これを定義しないと、外部にメールを配送できないので注意すること!

#C{LocalIP} 127.0.0.1
#F{LocalIP} -o /etc/sendmail.localip

後略

4) sendmailのテスト

# /usr/lib/sendmail -bt -d0.2 -v

ルールセット0チェック

> 0 user01
> 0 user01@foo.com

ルールセット3チェック

> 3 user01
> 3 user01@mgate

> 3 user01@foo.com


2. POPサーバのインストール(ソースからインストール)

RPMバージョンもあるが、あえてソースからのインストールを説明する。

1) POPサーバのインストール(qpopper)

# cd /usr/local/src/
# tar zxvf qpopper3.0.2.tar.gz
# cd qpopper3.0.2
# ./configure –enable-apop –enable-specialauth –with-popuid=mail
# make
# install -m755 popper/popper /usr/sbin/

2) /etc/inetd.confの編集

pop-2    stream    tcp    nowait    root    /usr/sbin/tcpd popper -s
pop-3    stream    tcp    nowait    root    /usr/sbin/tcpd popper -s

# ps ax | grep inetd
? XXX

# kill -HUP XXX   

又は、

# /etc/rc.d/init.d/inet restart

# /etc/rc.d/init.d/sendmail restart

以上

コメント