sendmail の概要
sendmail パッケージはメール転送エージェント (Mail
Transport Agent; MTA) を提供します。
注記
LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS
開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。
パッケージ情報
sendmail の依存パッケージ
必須
OpenLDAP-2.6.6 (クライアント)
Recommended
Cyrus SASL-2.1.28
任意
ghostscript-10.02.1 (PDF ドキュメント生成のため),
Procmail-3.22 (the configuration proposed below
requires that procmail be present at run-time),
and nph
sendmail のインストール
sendmail
をビルドする前に、必要となるユーザー、グループ、ディレクトリを生成します。 root
ユーザーになって以下のコマンドを実行します。
groupadd -g 26 smmsp &&
useradd -c "Sendmail Daemon" -g smmsp -d /dev/null \
-s /bin/false -u 26 smmsp &&
chmod -v 1777 /var/mail &&
install -v -m700 -d /var/spool/mqueue
注記
ビルドにあたって任意のパッケージをリンクする方法については、ソースツリー内の sendmail/README
ファイルを参照してください。
以下は本パッケージを利用する一つの例であり、SASLサポート、StartTLS (OpenSSL) サポート、OpenLDAP サポートを加えるものです。
もちろん必要な状況に応じて設定を変えてください。
cat >> devtools/Site/site.config.m4 << "EOF"
APPENDDEF(`confENVDEF',`-DSTARTTLS -DSASL -DLDAPMAP -DHASFLOCK')
APPENDDEF(`confLIBS', `-lssl -lcrypto -lsasl2 -lldap -llber')
APPENDDEF(`confINCDIRS', `-I/usr/include/sasl')
EOF
Install sendmail with the
following commands:
cat >> devtools/Site/site.config.m4 << "EOF"
define(`confMANGRP',`root')
define(`confMANOWN',`root')
define(`confSBINGRP',`root')
define(`confUBINGRP',`root')
define(`confUBINOWN',`root')
EOF
sed -i 's|/usr/man/man|/usr/share/man/man|' \
devtools/OS/Linux &&
cd sendmail &&
sh Build &&
cd ../cf/cf &&
cp generic-linux.mc sendmail.mc &&
sh Build sendmail.cf
This package does not come with a test suite.
Now, as the root
user:
install -v -d -m755 /etc/mail &&
sh Build install-cf &&
cd ../.. &&
sh Build install &&
install -v -m644 cf/cf/{submit,sendmail}.mc /etc/mail &&
cp -v -R cf/* /etc/mail &&
install -v -m755 -d /usr/share/doc/sendmail-8.17.2/{cf,sendmail} &&
install -v -m644 CACerts FAQ KNOWNBUGS LICENSE PGPKEYS README RELEASE_NOTES \
/usr/share/doc/sendmail-8.17.2 &&
install -v -m644 sendmail/{README,SECURITY,TRACEFLAGS,TUNING} \
/usr/share/doc/sendmail-8.17.2/sendmail &&
install -v -m644 cf/README /usr/share/doc/sendmail-8.17.2/cf &&
for manpage in sendmail editmap mailstats makemap praliases smrsh
do
install -v -m644 $manpage/$manpage.8 /usr/share/man/man8
done &&
install -v -m644 sendmail/aliases.5 /usr/share/man/man5 &&
install -v -m644 sendmail/mailq.1 /usr/share/man/man1 &&
install -v -m644 sendmail/newaliases.1 /usr/share/man/man1 &&
install -v -m644 vacation/vacation.1 /usr/share/man/man1
Install the sendmail Installation
and Operations Guide with the following commands:
注記
Remove op.pdf
from the make and install commands below if you
don't have Ghostscript
installed.
cd doc/op &&
sed -i 's/groff/GROFF_NO_SGR=1 groff/' Makefile &&
make op.txt op.pdf
Now, as the root
user:
install -v -d -m755 /usr/share/doc/sendmail-8.17.2 &&
install -v -m644 op.ps op.txt op.pdf /usr/share/doc/sendmail-8.17.2 &&
cd ../..
Command Explanations
cat > devtools/Site/site.config.m4
<< "EOF": This creates a configuration file
changing some of the default settings.
sed ...
devtools/OS/Linux: The site.config.m4 does not
honor a change to the man directory, so fix it in the OS
definitions.
sh Build; sh Build sendmail.cf; sh
Build install-cf; sh Build install: sendmail uses an m4 based build script to create the various
Makefile
s. These commands build and
install the package.
for manpage in...;do...;done; install
...: The man pages are installed already formatted
and man displays them
somewhat garbled. These commands replace the formatted pages with
pages man can display
properly.
Configuring sendmail
Configuration Information
注記
Ensure you have a fully qualified domain name defined in
/etc/hosts
for your system before
proceeding.
Create the /etc/mail/local-host-names
and /etc/mail/aliases
files using the following
commands as the root
user:
echo $(hostname) > /etc/mail/local-host-names
cat > /etc/mail/aliases << "EOF"
postmaster: root
MAILER-DAEMON: root
EOF
# Does not work if there is no database backend compiled in:
#newaliases
sendmail's primary configuration
file, /etc/mail/sendmail.cf
, is
complex and not meant to be directly edited. The recommended
method for changing it is to modify /etc/mail/sendmail.mc
and various m4 files, then run the m4 macro processor from within
/etc/mail
as follows:
cd /etc/mail &&
m4 m4/cf.m4 sendmail.mc > sendmail.cf
A full explanation of the files to modify, and the available
parameters can be found in /etc/mail/README
.
Systemd Unit
To automate the running of sendmail at startup, install the
sendmail.service
unit included in the
blfs-systemd-units-20231205 package:
make install-sendmail
注記
The -qNm option to sendmail, where N is number
of minutes, controls how often sendmail will process the mail queue. A
default of 5 minutes is used in the systemd unit. Individual workstation users may
want to set this as low as 1 minute, large installations
handling more mail may want to set it higher.