メールが受信できないとの連絡で調べたらメールログに下記メッセージが出力されていました。
May 8 06:46:52 centos7 postfix/smtpd[28604]: warning: connect to [127.0.0.1]:10023: Connection refused
May 8 06:46:52 centos7 postfix/smtpd[28604]: warning: problem talking to server [127.0.0.1]:10023: Connection refused
ポート10023はpostgreyです。
先日まで動作していたのに何故???
ポートを確認するとありません。
1 |
[root@centos7 ~]# netstat -an | grep 10023 |
postgreyは?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@centos7 ~]# systemctl status postgrey * postgrey.service - Postfix Greylisting Service Loaded: loaded (/usr/lib/systemd/system/postgrey.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2021-05-07 17:13:02 JST; 2 days ago Docs: man:postgrey(8) Process: 736 ExecStart=/usr/sbin/postgrey $POSTGREY_TYPE $POSTGREY_PID $POSTGREY_GROUP $POSTGREY_USER --greylist-text=Greylisted for %%s seconds --daemonize $POSTGREY_DELAY $POSTGREY_OPTS (code=exited, status=0/SUCCESS) Process: 705 ExecStartPre=/bin/rm -f /var/run/postgrey.pid (code=exited, status=0/SUCCESS) Main PID: 810 (postgrey --unix) CGroup: /system.slice/postgrey.service `-810 postgrey --unix=/var/spool/postfix/postgrey/socket --pidfile=/var/run/postgrey.pid --group=postgrey --use... May 07 17:12:58 ns.rootlinks.net systemd[1]: Starting Postfix Greylisting Service... May 07 17:13:02 ns.rootlinks.net postgrey[810]: Process Backgrounded May 07 17:13:02 ns.rootlinks.net postgrey[810]: 2021/05/07-17:13:02 postgrey (type Net::Server::Multiplex) starting! pid(810) May 07 17:13:02 ns.rootlinks.net postgrey[810]: Binding to UNIX socket file "/var/spool/postfix/postgrey/socket" May 07 17:13:02 ns.rootlinks.net systemd[1]: Started Postfix Greylisting Service. May 07 17:13:02 ns.rootlinks.net postgrey[810]: Setting gid to "991 991" May 07 17:13:02 ns.rootlinks.net postgrey[810]: Setting uid to "992" Hint: Some lines were ellipsized, use -l to show in full. |
動いているけど…なぜかUNIX Socketになっている。
で、もしかしたらと先日のyum updateのログを確認したらpostgreyがありました。
Updating : postgrey-1.37-13.el7.noarch
この更新で設定ファイルが置き換わったようです。
取り合えず/etc/sysconfig/postgreyを修正します。
1 2 3 4 5 6 7 8 9 10 11 |
[root@centos7 ~]# vi /etc/sysconfig/postgrey [root@centos7 ~]# cat /etc/sysconfig/postgrey # Postgrey offers 2 listening types, --inet and --unix. As default, Fedora # postgrey works under UNIX socket, but, changing to TCP socket on user's own # is also available, for instance, let it work at 10023 port of localhost: # --inet=10023 # To be more detailed, there is another way if you still run it at localhost: # --inet=127.0.0.1:10023 #POSTGREY_TYPE="--unix=/var/spool/postfix/postgrey/socket" POSTGREY_TYPE="--inet=127.0.0.1:10023" (snip) |
postgreyを再起動します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@centos7 ~]# systemctl restart postgrey [root@centos7 ~]# systemctl status postgrey * postgrey.service - Postfix Greylisting Service Loaded: loaded (/usr/lib/systemd/system/postgrey.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-05-8 12:27:47 JST; 6s ago Docs: man:postgrey(8)0 Process: 16507 ExecStart=/usr/sbin/postgrey $POSTGREY_TYPE $POSTGREY_PID $POSTGREY_GROUP $POSTGREY_USER --greylist-text=Greylisted for %%s seconds --daemonize $POSTGREY_DELAY $POSTGREY_OPTS (code=exited, status=0/SUCCESS) Process: 16505 ExecStartPre=/bin/rm -f /var/run/postgrey.pid (code=exited, status=0/SUCCESS) Main PID: 16509 (postgrey --inet) CGroup: /system.slice/postgrey.service `-16509 postgrey --inet=127.0.0.1:10023 --pidfile=/var/run/postgrey.pid --group=postgrey --user=postgrey --grey... May 8 12:27:47 ns.rootlinks.net systemd[1]: Starting Postfix Greylisting Service... May 8 12:27:47 ns.rootlinks.net postgrey[16509]: Process Backgrounded May 8 12:27:47 ns.rootlinks.net postgrey[16509]: 2021/05/10-12:27:47 postgrey (type Net::Server::Multiplex) starting...6509) May 8 12:27:47 ns.rootlinks.net systemd[1]: Started Postfix Greylisting Service. May 8 12:27:47 ns.rootlinks.net postgrey[16509]: Binding to TCP port 10023 on host 127.0.0.1 with IPv4 May 8 12:27:47 ns.rootlinks.net postgrey[16509]: Setting gid to "991 991" May 8 12:27:47 ns.rootlinks.net postgrey[16509]: Setting uid to "992" Hint: Some lines were ellipsized, use -l to show in full. |
ポート10023も開きました。
1 2 3 4 |
[root@centos7 ~]# netstat -an | grep 10023 tcp 0 0 127.0.0.1:10023 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:10023 127.0.0.1:51592 ESTABLISHED tcp 0 0 127.0.0.1:51592 127.0.0.1:10023 ESTABLISHED |
暫くログを眺めていると無事にメールを受信していました。
しかし更新で設定ファイルを置き換えなくてもいいのに。