1

Topic: Amavisd not opening ports before manual service restart

Hi,

I did a fresh install of iRedMail on CentOS 7, on a newly installed default CentOS 7 machine. After the machine boots up, the Amavisd starts but does not open the ports that it should. I did not change these configuration files, this is the default behaviour after installing as described in your installation guide:

[root@mail ~]# netstat -lpn | grep amavis
unix  2      [ ACC ]     STREAM     LISTENING     15127    882/master           private/smtp-amavis
unix  2      [ ACC ]     STREAM     LISTENING     17988    553/clamd            /var/run/clamd.amavisd/clamd.socket
unix  2      [ ACC ]     STREAM     LISTENING     16378    1381/amavisd (maste  /var/run/amavisd/amavisd.sock

[root@mail ~]# grep inet_socket_port /etc/amavisd/amavisd.conf
               # option(s) -p overrides $inet_socket_port and $unix_socketname
$inet_socket_port = [10024, 10026, 9998];
# $inet_socket_port = [10024, 10026, 9998];

[root@mail ~]# systemctl restart amavisd
[root@mail ~]# netstat -lpn | grep amavis
tcp        0      0 127.0.0.1:10024         0.0.0.0:*               LISTEN      2961/amavisd (maste
tcp        0      0 127.0.0.1:10026         0.0.0.0:*               LISTEN      2961/amavisd (maste
tcp        0      0 127.0.0.1:9998          0.0.0.0:*               LISTEN      2961/amavisd (maste
unix  2      [ ACC ]     STREAM     LISTENING     24593    2961/amavisd (maste  /var/run/amavisd/amavisd.sock
unix  2      [ ACC ]     STREAM     LISTENING     15127    882/master           private/smtp-amavis
unix  2      [ ACC ]     STREAM     LISTENING     17988    553/clamd            /var/run/clamd.amavisd/clamd.socket

Regards,

Sven

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5
- Linux/BSD distribution name and version: CentOS Linux release 7.2.1511 (Core)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PostgreSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

May 14 10:20:52 mail amavis[561]: starting. /usr/sbin/amavisd at XXX amavisd-new-2.10.1 (20141025), Unicode aware, LANG="en_US.UTF-8"
May 14 10:20:53 mail amavis[1344]: Net::Server: Group Not Defined.  Defaulting to EGID '987 987'
May 14 10:20:53 mail amavis[1344]: Net::Server: User Not Defined.  Defaulting to EUID '989'
May 14 10:20:53 mail amavis[1344]: Module Amavis::Conf        2.404
May 14 10:20:53 mail amavis[1344]: Module Archive::Zip        1.30
May 14 10:20:53 mail amavis[1344]: Module BerkeleyDB          0.51
May 14 10:20:53 mail amavis[1344]: Module Compress::Raw::Zlib 2.061
May 14 10:20:53 mail amavis[1344]: Module Compress::Zlib      2.061
May 14 10:20:53 mail amavis[1344]: Module Crypt::OpenSSL::RSA 0.28
May 14 10:20:53 mail amavis[1344]: Module DBD::Pg             2.19.3
May 14 10:20:53 mail amavis[1344]: Module DBI                 1.627
May 14 10:20:53 mail amavis[1344]: Module DB_File             1.83
May 14 10:20:53 mail amavis[1344]: Module Digest::MD5         2.52
May 14 10:20:53 mail amavis[1344]: Module Digest::SHA         5.85
May 14 10:20:53 mail amavis[1344]: Module Encode              2.51
May 14 10:20:53 mail amavis[1344]: Module File::Temp          0.2301
May 14 10:20:53 mail amavis[1344]: Module IO::Socket::INET6   2.69
May 14 10:20:53 mail amavis[1344]: Module IO::Socket::IP      0.21
May 14 10:20:53 mail amavis[1344]: Module MIME::Entity        5.505
May 14 10:20:53 mail amavis[1344]: Module MIME::Parser        5.505
May 14 10:20:53 mail amavis[1344]: Module MIME::Tools         5.505
May 14 10:20:53 mail amavis[1344]: Module Mail::DKIM::Signer  0.39
May 14 10:20:53 mail amavis[1344]: Module Mail::DKIM::Verifier 0.39
May 14 10:20:53 mail amavis[1344]: Module Mail::Header        2.12
May 14 10:20:53 mail amavis[1344]: Module Mail::Internet      2.12
May 14 10:20:53 mail amavis[1344]: Module Mail::SPF           v2.008
May 14 10:20:53 mail amavis[1344]: Module Mail::SpamAssassin  3.004000
May 14 10:20:53 mail amavis[1344]: Module Net::DNS            0.72
May 14 10:20:53 mail amavis[1344]: Module Net::LibIDN         0.12
May 14 10:20:53 mail amavis[1344]: Module Net::Server         2.007
May 14 10:20:53 mail amavis[1344]: Module NetAddr::IP         4.069
May 14 10:20:53 mail amavis[1344]: Module Razor2::Client::Version 2.84
May 14 10:20:53 mail amavis[1344]: Module Scalar::Util        1.27
May 14 10:20:53 mail amavis[1344]: Module Socket              2.010
May 14 10:20:53 mail amavis[1344]: Module Socket6             0.23
May 14 10:20:53 mail amavis[1344]: Module Time::HiRes         1.9725
May 14 10:20:53 mail amavis[1344]: Module URI                 1.60
May 14 10:20:53 mail amavis[1344]: Module Unix::Syslog        1.1
May 14 10:20:53 mail amavis[1344]: Amavis::ZMQ code     NOT loaded
May 14 10:20:53 mail amavis[1344]: Amavis::DB code      loaded
May 14 10:20:53 mail amavis[1344]: SQL base code        loaded
May 14 10:20:53 mail amavis[1344]: SQL::Log code        loaded
May 14 10:20:53 mail amavis[1344]: SQL::Quarantine      loaded
May 14 10:20:53 mail amavis[1344]: Lookup::SQL code     loaded
May 14 10:20:53 mail amavis[1344]: Lookup::LDAP code    NOT loaded
May 14 10:20:53 mail amavis[1344]: AM.PDP-in proto code loaded
May 14 10:20:53 mail amavis[1344]: SMTP-in proto code   loaded
May 14 10:20:53 mail amavis[1344]: Courier proto code   NOT loaded
May 14 10:20:53 mail amavis[1344]: SMTP-out proto code  loaded
May 14 10:20:53 mail amavis[1344]: Pipe-out proto code  NOT loaded
May 14 10:20:53 mail amavis[1344]: BSMTP-out proto code NOT loaded
May 14 10:20:53 mail amavis[1344]: Local-out proto code NOT loaded
May 14 10:20:53 mail amavis[1344]: OS_Fingerprint code  NOT loaded
May 14 10:20:53 mail amavis[1344]: ANTI-VIRUS code      loaded
May 14 10:20:53 mail amavis[1344]: ANTI-SPAM code       loaded
May 14 10:20:53 mail amavis[1344]: ANTI-SPAM-EXT code   NOT loaded
May 14 10:20:53 mail amavis[1344]: ANTI-SPAM-C code     NOT loaded
May 14 10:20:53 mail amavis[1344]: ANTI-SPAM-SA code    loaded
May 14 10:20:53 mail amavis[1344]: Unpackers code       loaded
May 14 10:20:53 mail amavis[1344]: DKIM code            loaded
May 14 10:20:53 mail amavis[1344]: Tools code           NOT loaded
May 14 10:20:53 mail amavis[1344]: Found $file            at /usr/bin/file
May 14 10:20:53 mail amavis[1344]: Found $altermime       at /usr/bin/altermime
May 14 10:20:53 mail amavis[1344]: Internal decoder for .mail
May 14 10:20:53 mail amavis[1344]: Found decoder for    .F    at /usr/bin/unfreeze
May 14 10:20:53 mail amavis[1344]: Found decoder for    .Z    at /usr/bin/gzip -d
May 14 10:20:53 mail amavis[1344]: Found decoder for    .gz   at /usr/bin/gzip -d
May 14 10:20:53 mail amavis[1344]: Found decoder for    .bz2  at /usr/bin/bzip2 -d
May 14 10:20:53 mail amavis[1344]: Found decoder for    .xz   at /usr/bin/xzdec
May 14 10:20:53 mail amavis[1344]: Found decoder for    .lzma at /usr/bin/xz -dc --format=lzma
May 14 10:20:53 mail amavis[1344]: Found decoder for    .lrz  at /usr/bin/lrzip -q -k -d -o -
May 14 10:20:53 mail amavis[1344]: Found decoder for    .lzo  at /usr/bin/lzop -d
May 14 10:20:53 mail amavis[1344]: No ext program for   .lz4, tried: lz4c -d
May 14 10:20:53 mail amavis[1344]: Found decoder for    .rpm  at /usr/bin/rpm2cpio
May 14 10:20:53 mail amavis[1344]: Found decoder for    .cpio at /usr/bin/pax
May 14 10:20:53 mail amavis[1344]: Found decoder for    .tar  at /usr/bin/pax
May 14 10:20:53 mail amavis[1344]: Found decoder for    .deb  at /usr/bin/ar
May 14 10:20:53 mail amavis[1344]: Found decoder for    .rar  at /usr/bin/unrar
May 14 10:20:53 mail amavis[1344]: Found decoder for    .arj  at /usr/bin/unarj
May 14 10:20:53 mail amavis[1344]: Found decoder for    .arc  at /usr/bin/nomarch
May 14 10:20:53 mail amavis[1344]: Found decoder for    .zoo  at /usr/bin/unzoo
May 14 10:20:53 mail amavis[1344]: Found decoder for    .cab  at /usr/bin/cabextract
May 14 10:20:53 mail amavis[1344]: Internal decoder for .tnef
May 14 10:20:53 mail amavis[1344]: Found decoder for    .zip  at /usr/bin/7za
May 14 10:20:53 mail amavis[1344]: Found decoder for    .kmz  at /usr/bin/7za
May 14 10:20:53 mail amavis[1344]: Found decoder for    .7z   at /usr/bin/7za
May 14 10:20:53 mail amavis[1344]: Found decoder for    .jar  at /usr/bin/7z
May 14 10:20:53 mail amavis[1344]: Found decoder for    .swf  at /usr/bin/7z
May 14 10:20:53 mail amavis[1344]: Found decoder for    .lha  at /usr/bin/7z
May 14 10:20:53 mail amavis[1344]: Found decoder for    .iso  at /usr/bin/7z
May 14 10:20:53 mail amavis[1344]: Found decoder for    .exe  at /usr/bin/unrar; /usr/bin/unarj
May 14 10:20:53 mail amavis[1344]: No decoder for       .lz4
May 14 10:20:53 mail amavis[1344]: Using primary internal av scanner code for ClamAV-clamd
May 14 10:20:53 mail amavis[1344]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
May 14 10:20:53 mail amavis[1344]: Deleting db files __db.001,nanny.db,__db.002,snmp.db,__db.003 in /var/spool/amavisd/db
May 14 10:20:53 mail amavis[1344]: Creating db in /var/spool/amavisd/db/; BerkeleyDB 0.51, libdb 5.3

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Amavisd not opening ports before manual service restart

Please try to enable amavisd service with systemctl:

systemctl enable amavisd

Then reboot server and check whether it's started automatically.

3

Re: Amavisd not opening ports before manual service restart

ZhangHuangbin wrote:

Please try to enable amavisd service with systemctl:

systemctl enable amavisd

Then reboot server and check whether it's started automatically.

Hi Zhang,

no, that does not help.

As you see from my commands in the first posting, amavisd is running after a reboot, it just does not open the ports that are specified in the configuration.

The systemctl output confirms this:

root@mail ~]# systemctl | grep amavis
amavisd.service                                                                             loaded active running   Amavisd-new is an interface between MTA and content checkers.
clamd@amavisd.service                                                                       loaded active running   clamd scanner (amavisd) daemon
amavisd-clean-quarantine.timer                                                              loaded active waiting   Amavisd clean quarantine timer
amavisd-clean-tmp.timer                                                                     loaded active waiting   Amavisd clean tmp timer

I nevertheless executed "systemctl enable amavisd" and did a reboot, did not change anything. Restarting amavisd via "systemctl restart amavisd" solves the problem, until next reboot. I guess amavisd starts too early in the normal boot process, not sure why this happens.

[root@mail ~]# cat /usr/lib/systemd/system/amavisd.service
[Unit]
Description=Amavisd-new is an interface between MTA and content checkers.
Documentation=http://www.ijs.si/software/amavisd/#doc
After=network.target
Wants=clamd@amavisd.service
Wants=postfix.service

[Service]
Type=forking
User=amavis
Group=amavis
PIDFile=/var/run/amavisd/amavisd.pid
ExecStart=/usr/sbin/amavisd -c /etc/amavisd/amavisd.conf
ExecReload=/usr/sbin/amavisd -c /etc/amavisd/amavisd.conf reload
Restart=on-failure
PrivateTmp=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

4

Re: Amavisd not opening ports before manual service restart

sven.borkert wrote:

Hi,

I did a fresh install of iRedMail on CentOS 7, on a newly installed default CentOS 7 machine. After the machine boots up, the Amavisd starts but does not open the ports that it should. I did not change these configuration files, this is the default behaviour after installing as described in your installation guide:

[root@mail ~]# netstat -lpn | grep amavis
unix  2      [ ACC ]     STREAM     LISTENING     15127    882/master           private/smtp-amavis
unix  2      [ ACC ]     STREAM     LISTENING     17988    553/clamd            /var/run/clamd.amavisd/clamd.socket
unix  2      [ ACC ]     STREAM     LISTENING     16378    1381/amavisd (maste  /var/run/amavisd/amavisd.sock

[root@mail ~]# grep inet_socket_port /etc/amavisd/amavisd.conf
               # option(s) -p overrides $inet_socket_port and $unix_socketname
$inet_socket_port = [10024, 10026, 9998];
# $inet_socket_port = [10024, 10026, 9998];

[root@mail ~]# systemctl restart amavisd
[root@mail ~]# netstat -lpn | grep amavis
tcp        0      0 127.0.0.1:10024         0.0.0.0:*               LISTEN      2961/amavisd (maste
tcp        0      0 127.0.0.1:10026         0.0.0.0:*               LISTEN      2961/amavisd (maste
tcp        0      0 127.0.0.1:9998          0.0.0.0:*               LISTEN      2961/amavisd (maste
unix  2      [ ACC ]     STREAM     LISTENING     24593    2961/amavisd (maste  /var/run/amavisd/amavisd.sock
unix  2      [ ACC ]     STREAM     LISTENING     15127    882/master           private/smtp-amavis
unix  2      [ ACC ]     STREAM     LISTENING     17988    553/clamd            /var/run/clamd.amavisd/clamd.socket

Regards,

Sven

I have also seen this behavior and it continues to be an issue. See the thread below.
http://www.iredmail.org/forum/topic1035 … eboot.html

5

Re: Amavisd not opening ports before manual service restart

Hi,

I know now what the problem is. The service configuration of amavisd is not correct:

[root@mail ~]# grep After /usr/lib/systemd/system/amavisd.service
After=network.target

The correct target to start Amavisd after the network is started is "network-online.target" not "network.target":

[root@mail ~]# systemctl list-units --type target | grep network
network-online.target loaded active active Network is Online

Change "After=network.target" to "After=network-online.target" and it works fine.

Regards,

Sven

6

Re: Amavisd not opening ports before manual service restart

sven.borkert wrote:

Change "After=network.target" to "After=network-online.target" and it works fine.

You'd better report this issue to RPM package maintainer. smile

7

Re: Amavisd not opening ports before manual service restart

I'll do. But as it affects the proper functioning of your product, I thought I'd tell you anyway.

Regards,

Sven

8

Re: Amavisd not opening ports before manual service restart

Thanks for the feedback. But seems amavisd works fine for other users, no similar reports yet.