0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Ubuntu 22.04] Net::ServerのエラーでAmavisが起動しない

Posted at

Amavisが起動しない

 mail.logに以下のログが出力され、amavisが一瞬起動して落ちるという現象が起きた。対処について記載。

mail.log
starting. /usr/sbin/amavisd-new at xxxxx.jp amavisd-new-2.12.2 (20211013), Unicode aware, LANG="ja_JP.UTF-8"
perl=5.034000, user=119, EUID: 119 (119);  group=, EGID: 129 127 129 (129 127 129)
(!)Net::Server: 2022/10/02-00:30:49 Can't connect to TCP port 10024 on ::1 [Cannot assign requested address]\n  at line 64 in file /usr/share/perl5/Net/Server/Proto/TCP.pm

心当たり

 IPv6関係の設定をいじったせいだろうなぁ。具体的には/etc/sysctl.d配下のファイルで以下の設定を行った。

/etc/sysctl.d/userfile
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

ポート状況の確認

 Postfixとやりとりするポートに接続できなかった場合にこのログが出力されるらしい。他のアプリケーションがポートを先に占有した等が考えられる。

netstat -tulpn
結果
稼働中のインターネット接続 (サーバのみ)
Proto 受信-Q 送信-Q 内部アドレス            外部アドレス            状態       PID/Program name    
tcp        0      0 127.0.0.1:5433          0.0.0.0:*               LISTEN      1362/postgres       
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1357/postgres       
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      785/dovecot         
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      4741/master         
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      785/dovecot         
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      1388/smbd           
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      4741/master         
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      1388/smbd           
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      4741/master         
tcp        0      0 0.0.0.0:514             0.0.0.0:*               LISTEN      811/rsyslogd        
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      785/dovecot         
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      785/dovecot         
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN      1574/perl           
tcp        0      0 127.0.0.1:8891          0.0.0.0:*               LISTEN      873/opendkim        
tcp        0      0 0.0.0.0:xxxxx           0.0.0.0:*               LISTEN      937/sshd: /usr/sbin 
tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      4741/master         
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      756/systemd-resolve

 今回のサーバーでは送信を10026、受信を10024でlistenしているが、リストに上がってこない。別のプログラムが占有している場合は競合するプログラムのポート設定を変更する等してkill、restartすれば良いが、今回はそのパターンでは無い様子。

Amavisの設定に追記

Amavisの設定を変更する。

vi /etc/amavis/conf.d/50-user

 設定可能な最終行に$inet_socket_bindを追記する。デフォルトではこの値が[ '127.0.0.1', '[::1]' ]となっており、IPv6共存の設定となっている。

/etc/amavis/conf.d/50-user
# For configure with invalidating IPv6.
# Got error from /var/log/mail.log and can't start amavisd.
$inet_socket_bind = '127.0.0.1';

# ~↑上記を追記~

#------------ Do not modify anything below this line -------------
1;  # ensure a defined return

 起動して確認する。

systemctl start amavis
systemctl status amavis
結果
● amavis.service - Interface between MTA and virus scanner/content filters
     Loaded: loaded (/lib/systemd/system/amavis.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-10-02 10:05:48 JST; 8min ago

 無事に起動し落ちる事はなくなった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?