Postfixを構成するプログラム master, qmgr, tlsmgr, pickup, smtpd, trivial-rewrite, cleanup, smtp, anvil, virtual

Postfixは複数のプログラムが連携してメール配送を行っている. どんなプログラムが動作しているのか調べた. 環境はpostfix-2.10.1-7.el7.x86_64/CentOS Linux release 7.6

May 10, 2020 @pa_pa_paper



## 初期状態の起動プログラム(master, qmgr, tlsmgr, pickup)

``` 
root     28511     1  0  5月03 ?      00:00:06   /usr/libexec/postfix/master -w
postfix  16376 28511  0  5月07 ?      00:00:00     qmgr -l -t unix -u
postfix  18378 28511  0  5月07 ?      00:00:00     tlsmgr -l -t unix -u
postfix   8823 28511  0 15:11 ?        00:00:00     pickup -l -t unix -u
```

+ master
 - master(8), Postfix master daemon
 - 全体制御用のデーモン

+ qmgr
 - qmgr(8), Postfix queue manager
 - キュー内のメールを配送プログラムに渡す

+ tlsmgr
 - tlsmgr(8), Postfix TLS cache and randomness manager

+ pickup
 - pickup(8), Postfix local mail pickup
 - maildropキューを監視し, 内部配送を処理

## メール送信時の起動プログラム(smtpd, trivial-rewrite, cleanup, smtp)

```
root     28511     1  0  5月03 ?      00:00:06   /usr/libexec/postfix/master -w
postfix  16376 28511  0  5月07 ?      00:00:00     qmgr -l -t unix -u
postfix  18378 28511  0  5月07 ?      00:00:00     tlsmgr -l -t unix -u
postfix   8823 28511  0 15:11 ?        00:00:00     pickup -l -t unix -u
postfix  11579 28511  0 15:52 ?        00:00:00     smtpd -n smtp -t inet -u -o stress=
postfix  11581 28511  0 15:52 ?        00:00:00     trivial-rewrite -n rewrite -t unix -u
postfix  11582 28511  0 15:52 ?        00:00:00     cleanup -z -t unix -u
postfix  11584 28511  0 15:52 ?        00:00:00     smtp -t unix -u
```

+ smtpd
 - smtpd(8), Postfix SMTP server
 - 外部配送を処理

+ trivial-rewrite
 - trivial-rewrite(8), Postfix address rewriting

+ cleanup
 - cleanup(8), canonicalize and enqueue message
 - ヘッダ書換え等を行いincomingキューに入れ, qmgrに通知

+ smtp
 - smtp(8) Postfix SMTP client
 

```
postfix/smtpd[11579]: connect from localhost[127.0.0.1]
postfix/trivial-rewrite[11581]: warning: do not list domain xxxx.vs.sakura.ne.jp in BOTH mydestination and virtual_mailbox_domains
postfix/smtpd[11579]: 7EAD3695C: client=localhost[127.0.0.1]
postfix/cleanup[11582]: 7EAD3695C: message-id=<20200510065212.7EAD3695C@xxxx.vs.sakura.ne.jp>
postfix/qmgr[16376]: 7EAD3695C: from=<xxxx@xxxx.vs.sakura.ne.jp>, size=516, nrcpt=1 (queue active)
postfix/smtpd[11579]: disconnect from localhost[127.0.0.1]
postfix/smtp[11584]: 7EAD3695C: to=<xxxx@gmail.com>, relay=gmail-smtp-in.l.google.com[108.177.125.26]:25, delay=1.4, delays=0.02/0.02/0.62/0.73, dsn=2.0.0, status=sent (250 2.0.0 OK  1589093533 94si5287132plf.223 - gsmtp)
postfix/qmgr[16376]: 7EAD3695C: removed
```


## メール受信時の起動プログラム(anvil, virtual)

```
root     28511     1  0  5月03 ?      00:00:06   /usr/libexec/postfix/master -w
postfix  16376 28511  0  5月07 ?      00:00:00     qmgr -l -t unix -u
postfix  18378 28511  0  5月07 ?      00:00:00     tlsmgr -l -t unix -u
postfix   8823 28511  0 15:11 ?        00:00:00     pickup -l -t unix -u
postfix  18941 28511  0 16:28 ?        00:00:00     smtpd -n smtp -t inet -u -o stress=
postfix  18942 28511  0 16:28 ?        00:00:00     anvil -l -t unix -u
postfix  18944 28511  0 16:28 ?        00:00:00     trivial-rewrite -n rewrite -t unix -u
postfix  18945 28511  0 16:28 ?        00:00:00     cleanup -z -t unix -u
postfix  18946 28511  0 16:28 ?        00:00:00     virtual -t unix
```

+ anvil
 - anvil(8), Postfix connection/rate limiting

+ virtual
 - virtual(8), Postfix virtual delivery agent


```
postfix/smtpd[18941]: connect from mail-io1-f41.google.com[209.85.166.41]
postfix/trivial-rewrite[18944]: warning: do not list domain xxxx.vs.sakura.ne.jp in BOTH mydestination and virtual_mailbox_domains
postfix/smtpd[18941]: B6C33A639: client=mail-io1-f41.google.com[209.85.166.41]
postfix/cleanup[18945]: B6C33A639: message-id=<CAH54enE=mRpxq3xMWmfpc5e=PEQs7NOAHJ5Tj0m8pW69RHjdGA@mail.gmail.com>
postfix/qmgr[16376]: B6C33A639: from=<xxxx@gmail.com>, size=3446, nrcpt=1 (queue active)
postfix/trivial-rewrite[18944]: warning: do not list domain xxxx.vs.sakura.ne.jp in BOTH mydestination and virtual_mailbox_domains
postfix/virtual[18946]: B6C33A639: to=<xxxx@xxxx.vs.sakura.ne.jp>, relay=virtual, delay=0.21, delays=0.16/0.02/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
postfix/qmgr[16376]: B6C33A639: removed
```