# Trouble connecting to amavisd [SOLVED]

## Muppy

I'm just trying to setup some mailfiltering for my postfix MTA, following this guide: http://www.gentoo.org/doc/en/mailfilter-guide.xml. I try to use spamassassin and clamav, glued together by amavis. However, postfix seems to be setup correctly in this scenario since I can connect to port 25 as well as 10025 without any problems, but connecting to amavis on port 10024 does not work at all. (Connecting means using netcat: nc localhost 10024). It doesn't respond at all, it just times out after a long while. Therefore, I cannot send nor receive any mail at the moment.  :Sad: 

Here's the snippet of my log when I start amavisd (replaced my domain name...):

```

Oct 11 07:45:42 statler amavis[12075]: starting.  /usr/sbin/amavisd at statler.mydomain.com amavisd-new-2.4.2 (20060627)

, Unicode aware

Oct 11 07:45:42 statler amavis[12075]: user=, EUID: 0 (0);  group=, EGID: 0 27 26 20 11 10 6 4 3 2 1 0 (0 27 26 20 11 10

 6 4 3 2 1 0); log_level=2

Oct 11 07:45:42 statler amavis[12075]: Perl version               5.008008

Oct 11 07:45:43 statler amavis[12075]: INFO: no optional modules: Mail::SpamAssassin::Plugin::DomainKeys Mail::SpamAssas

sin::Plugin::HTTPSMismatch Mail::DomainKeys::Header Mail::DomainKeys::Message Mail::DomainKeys::Policy Mail::DomainKeys:

:Signature Mail::DomainKeys::Key Mail::DomainKeys::Key::Public Crypt::OpenSSL::RSA auto::Crypt::OpenSSL::RSA::new_public

_key auto::Crypt::OpenSSL::RSA::new_public_key auto::Crypt::OpenSSL::RSA::new_key_from_parameters auto::Crypt::OpenSSL::

RSA::get_key_parameters auto::Crypt::OpenSSL::RSA::import_random_seed

Oct 11 07:45:43 statler amavis[12075]: SpamControl: init_pre_chroot done

Oct 11 07:45:43 statler amavis[12076]: Net::Server: Process Backgrounded

Oct 11 07:45:43 statler amavis[12076]: Net::Server: 2006/10/11-07:45:43 Amavis (type Net::Server::PreForkSimple) startin

g! pid(12076)

Oct 11 07:45:43 statler amavis[12076]: Net::Server: Binding to UNIX socket file /var/amavis/amavisd.sock using SOCK_STRE

AM

Oct 11 07:45:43 statler amavis[12076]: Net::Server: Binding to TCP port 10024 on host 127.0.0.1

Oct 11 07:45:43 statler amavis[12076]: Net::Server: Setting gid to "444 444"

Oct 11 07:45:43 statler amavis[12076]: Net::Server: Setting uid to "104"

Oct 11 07:45:43 statler amavis[12076]: Module Amavis::Conf        2.068

Oct 11 07:45:43 statler amavis[12076]: Module Archive::Tar        1.29

Oct 11 07:45:43 statler amavis[12076]: Module Archive::Zip        1.16

Oct 11 07:45:43 statler amavis[12076]: Module BerkeleyDB          0.30

Oct 11 07:45:43 statler amavis[12076]: Module Compress::Zlib      1.42

Oct 11 07:45:43 statler amavis[12076]: Module Convert::TNEF       0.17

Oct 11 07:45:43 statler amavis[12076]: Module Convert::UUlib      1.06

Oct 11 07:45:43 statler amavis[12076]: Module DBD::mysql          3.0007

Oct 11 07:45:43 statler amavis[12076]: Module DBI                 1.52

Oct 11 07:45:43 statler amavis[12076]: Module DB_File             1.814

Oct 11 07:45:43 statler amavis[12076]: Module Digest::MD5         2.36

Oct 11 07:45:43 statler amavis[12076]: Module IO::Socket::INET6   2.51

Oct 11 07:45:43 statler amavis[12076]: Module MIME::Entity        5.420

Oct 11 07:45:43 statler amavis[12076]: Module MIME::Parser        5.420

Oct 11 07:45:43 statler amavis[12076]: Module MIME::Tools         5.420

Oct 11 07:45:43 statler amavis[12076]: Module Mail::Header        1.74

Oct 11 07:45:43 statler amavis[12076]: Module Mail::Internet      1.74

Oct 11 07:45:43 statler amavis[12076]: Module Mail::SPF::Query    1.999001

Oct 11 07:45:43 statler amavis[12076]: Module Mail::SpamAssassin  3.001005

Oct 11 07:45:43 statler amavis[12076]: Module Net::Cmd            2.26

Oct 11 07:45:43 statler amavis[12076]: Module Net::DNS            0.59

Oct 11 07:45:43 statler amavis[12076]: Module Net::SMTP           2.29

Oct 11 07:45:43 statler amavis[12076]: Module Net::Server         0.94

Oct 11 07:45:43 statler amavis[12076]: Module Razor2::Client::Version 2.82

Oct 11 07:45:43 statler amavis[12076]: Module Time::HiRes         1.9

Oct 11 07:45:43 statler amavis[12076]: Module Unix::Syslog        0.100

Oct 11 07:45:43 statler amavis[12076]: Amavis::DB code      loaded

Oct 11 07:45:43 statler amavis[12076]: Amavis::Cache code   loaded

Oct 11 07:45:43 statler amavis[12076]: SQL base code        NOT loaded

Oct 11 07:45:43 statler amavis[12076]: SQL::Log code        NOT loaded

Oct 11 07:45:43 statler amavis[12076]: SQL::Quarantine      NOT loaded

Oct 11 07:45:43 statler amavis[12076]: Lookup::SQL code     NOT loaded

Oct 11 07:45:43 statler amavis[12076]: Lookup::LDAP code    NOT loaded

Oct 11 07:45:43 statler amavis[12076]: AM.PDP-in proto code loaded

Oct 11 07:45:43 statler amavis[12076]: SMTP-in proto code   NOT loaded

Oct 11 07:45:43 statler amavis[12076]: Courier proto code   NOT loaded

Oct 11 07:45:43 statler amavis[12076]: QMQPqq-in proto code  loaded

Oct 11 07:45:43 statler amavis[12076]: SMTP-out proto code  loaded

Oct 11 07:45:43 statler amavis[12076]: Pipe-out proto code  NOT loaded

Oct 11 07:45:43 statler amavis[12076]: BSMTP-out proto code NOT loaded

Oct 11 07:45:43 statler amavis[12076]: Local-out proto code loaded

Oct 11 07:45:43 statler amavis[12076]: OS_Fingerprint code  NOT loaded

Oct 11 07:45:43 statler amavis[12076]: ANTI-VIRUS code      loaded

Oct 11 07:45:43 statler amavis[12076]: ANTI-SPAM code       loaded

Oct 11 07:45:43 statler amavis[12076]: ANTI-SPAM-SA code    loaded

Oct 11 07:45:43 statler amavis[12076]: Unpackers code       loaded

Oct 11 07:45:43 statler amavis[12076]: Found $file            at /usr/bin/file

Oct 11 07:45:43 statler amavis[12076]: No $dspam,             not using it

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .mail

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .asc 

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .uue 

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .hqx 

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .ync 

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .F    at /usr/bin/unfreeze

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .Z    at /bin/gzip -d

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .gz   at /bin/gzip -d

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .gz   (backup, not used)

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .bz2  at /bin/bzip2 -d

Oct 11 07:45:43 statler amavis[12076]: No decoder for       .lzo  tried: lzop -d

Oct 11 07:45:43 statler amavis[12076]: No decoder for       .rpm  tried: rpm2cpio.pl, rpm2cpio

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .cpio at /bin/cpio

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .tar  at /bin/cpio

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .tar  (backup, not used)

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .deb  at /usr/bin/ar

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .zip 

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .rar  at /usr/bin/unrar

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .arj  at /usr/bin/unarj

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .arc  at /usr/bin/arc

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .zoo  at /usr/bin/zoo

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .deb  at /usr/bin/ar

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .zip 

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .rar  at /usr/bin/unrar

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .arj  at /usr/bin/unarj

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .arc  at /usr/bin/arc

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .zoo  at /usr/bin/zoo

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .lha  at /usr/bin/lha

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .cab  at /usr/bin/cabextract

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .tnef at /usr/bin/tnef

Oct 11 07:45:43 statler amavis[12076]: Internal decoder for .tnef (backup, not used)

Oct 11 07:45:43 statler amavis[12076]: Found decoder for    .exe  at /usr/bin/unrar; /usr/bin/lha; /usr/bin/unarj

Oct 11 07:45:43 statler amavis[12076]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan

Oct 11 07:45:43 statler amavis[12076]: Found secondary av scanner FRISK F-Prot Antivirus at /usr/bin/f-prot

Oct 11 07:45:43 statler amavis[12076]: Creating db in /var/amavis/db/; BerkeleyDB 0.30, libdb 4.3

Oct 11 07:45:44 statler amavis[12076]: SpamControl: initializing Mail::SpamAssassin

Oct 11 07:45:50 statler amavis[12076]: SpamControl: init_pre_fork done

Oct 11 07:45:50 statler amavis[12087]: TIMING [total 34 ms] - bdb-open: 34 (100%)100, rundown: 0 (0%)100

Oct 11 07:45:50 statler amavis[12088]: TIMING [total 57 ms] - bdb-open: 57 (100%)100, rundown: 0 (0%)100

Oct 11 07:45:50 statler amavis[12090]: TIMING [total 18 ms] - bdb-open: 18 (100%)100, rundown: 0 (0%)100

Oct 11 07:45:50 statler amavis[12089]: TIMING [total 52 ms] - bdb-open: 52 (100%)100, rundown: 0 (0%)100

Oct 11 07:45:59 statler amavis[12087]: (12087-01) QMQPqq: NOTICE: EOF on socket at (eval 53) line 61.

Oct 11 07:45:59 statler amavis[12087]: (12087-01) TIMING [total 9053 ms] - rundown: 9053 (100%)100

```

Here's my master.cf of postfix (but I don't suspect the culprit in there):

```

#

# Postfix master process configuration file.  For details on the format

# of the file, see the master(5) manual page (command: "man 5 master").

#

# ==========================================================================

# service type  private unpriv  chroot  wakeup  maxproc command + args

#               (yes)   (yes)   (yes)   (never) (100)

# ==========================================================================

smtp      inet  n       -       n       -       -       smtpd

#submission inet n       -       n       -       -       smtpd

#  -o smtpd_enforce_tls=yes

#  -o smtpd_sasl_auth_enable=yes

#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

#smtps     inet  n       -       n       -       -       smtpd

#  -o smtpd_tls_wrappermode=yes

#  -o smtpd_sasl_auth_enable=yes

#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

#628      inet  n       -       n       -       -       qmqpd

pickup    fifo  n       -       n       60      1       pickup

cleanup   unix  n       -       n       -       0       cleanup

qmgr      fifo  n       -       n       300     1       qmgr

#qmgr     fifo  n       -       n       300     1       oqmgr

tlsmgr    unix  -       -       n       1000?   1       tlsmgr

rewrite   unix  -       -       n       -       -       trivial-rewrite

bounce    unix  -       -       n       -       0       bounce

defer     unix  -       -       n       -       0       bounce

trace     unix  -       -       n       -       0       bounce

verify    unix  -       -       n       -       1       verify

flush     unix  n       -       n       1000?   0       flush

proxymap  unix  -       -       n       -       -       proxymap

smtp      unix  -       -       n       -       -       smtp

# When relaying mail as backup MX, disable fallback_relay to avoid MX loops

relay     unix  -       -       n       -       -       smtp

        -o fallback_relay=

#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5

showq     unix  n       -       n       -       -       showq

error     unix  -       -       n       -       -       error

discard   unix  -       -       n       -       -       discard

local     unix  -       n       n       -       -       local

virtual   unix  -       n       n       -       -       virtual

lmtp      unix  -       -       n       -       -       lmtp

anvil     unix  -       -       n       -       1       anvil

scache    unix  -       -       n       -       1       scache

#

# ====================================================================

# Interfaces to non-Postfix software. Be sure to examine the manual

# pages of the non-Postfix software to find out what options it wants.

#

# Many of the following services use the Postfix pipe(8) delivery

# agent.  See the pipe(8) man page for information about ${recipient}

# and other message envelope options.

# ====================================================================

#

# maildrop. See the Postfix MAILDROP_README file for details.

# Also specify in main.cf: maildrop_destination_recipient_limit=1

#

maildrop  unix  -       n       n       -       -       pipe

  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}

#

# The Cyrus deliver program has changed incompatibly, multiple times.

#

old-cyrus unix  -       n       n       -       -       pipe

  flags=R user=cyrus argv=/usr/lib/cyrus/deliver -e -m ${extension} ${user}

# Cyrus 2.1.5 (Amos Gouaux)

# Also specify in main.cf: cyrus_destination_recipient_limit=1

cyrus     unix  -       n       n       -       -       pipe

  flags=hu user=cyrus argv=/usr/lib/cyrus/deliver -e -r ${sender} -m ${extension} ${user}

# Cyrus with "virtdomains: yes"

# Also specify in main.cf: virtual_transport = virt-cyrus

virt-cyrus     unix  -       n       n       -       -       pipe

  flags=hu user=cyrus argv=/usr/lib/cyrus/deliver -e -r ${sender} -m ${recipient} ${user}

#

# See the Postfix UUCP_README file for configuration details.

#

uucp      unix  -       n       n       -       -       pipe

  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)

#

# Other external delivery methods.

#

ifmail    unix  -       n       n       -       -       pipe

  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)

bsmtp     unix  -       n       n       -       -       pipe

  flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient

smtp-amavis     unix -        -       n     -       2  smtp

  -o smtp_data_done_timeout=1200

  -o smtp_send_xforward_command=yes

127.0.0.1:10025 inet n        -       n     -       -  smtpd

  -o content_filter=

  -o local_recipient_maps=

  -o relay_recipient_maps=

  -o smtpd_restriction_classes=

  -o smtpd_client_restrictions=

  -o smtpd_helo_restrictions=

  -o smtpd_sender_restrictions=

  -o smtpd_recipient_restrictions=permit_mynetworks,reject

  -o mynetworks=127.0.0.0/8

  -o strict_rfc821_envelopes=yes

  -o smtpd_error_sleep_time=0

  -o smtpd_soft_error_limit=1001

  -o smtpd_hard_error_limit=1000

```

Some emerge information:

```

mail-mta/postfix-2.3.2  USE="dovecot-sasl ipv6 ldap mailwrapper mysql pam sasl ssl vda -cdb -hardened -mbox -nis -postgres (-selinux)"

mail-filter/amavisd-new-2.4.2-r1  USE="ldap mysql -milter -postgres"

# I have set the qmail use flag in spamassassin because I was playing around with qmail before I actually

# switched back to postfix...

mail-filter/spamassassin-3.1.5  USE="berkdb ipv6 ldap mysql qmail ssl tools -doc -postgres -sqlite"

app-antivirus/clamav-0.88.4  USE="crypt mailwrapper -milter (-selinux)"

```

Any ideas? Do you need any other information? Your help is greatly appreciated!

Thanks!

ManfredLast edited by Muppy on Wed Oct 11, 2006 8:39 am; edited 1 time in total

----------

## Janne Pikkarainen

Do you have this in /etc/amavisd.conf?

```
$inet_socket_port = 10024;        # accept SMTP on this local TCP port
```

And this in /etc/postfix/main.cf?

```
content_filter=smtp-amavis:[127.0.0.1]:10024
```

----------

## Muppy

Hi Janne,

thanks for your quick reply! Here are some settings from my amavisd.conf:

```

$mydomain = 'mydomain.com';

$myhostname = 'statler.mydomain.com';

$forward_method = 'smtp:[127.0.0.1]:10025';

$notify_method = $forward_method;

$inet_socket_port = 10024;

$inet_socket_bind = '127.0.0.1';

$protocol = 'QMQPqq';

@inet_acl = qw(127.0.0.1 [::1]); 

```

And some lines from my main.cf:

```

empty_address_recipient = MAILER-DAEMON

queue_minfree = 120000000

content_filter = smtp-amavis:[127.0.0.1]:10024

```

Meanwhile, I have changed my master.cf a little, adding the following lines:

```

spamfilter unix - n n - - pipe

  flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter.sh -f ${sender} -- ${recipient}

```

...and created the file /usr/local/bin/spamfilter.sh:

```

#!/bin/bash

/usr/bin/spamc -u amavis | /usr/sbin/sendmail -i "$"

exit $?

```

However, as soon as my smtpd wants to connect to amavis, I see this in my logs:

```

postfix/qmgr[14277]: input attribute value: conversation with 127.0.0.1[127.0.0.1] timed out while receiving the initial server greeting

```

Strange... Also, some other error messages immediately before that, which puzzle me:

```

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: status

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: status

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute value: 4.4.2

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: diag_type

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: diag_type

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute value: (end)

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: diag_text

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: diag_text

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute value: (end)

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: mta_type

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: mta_type

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute value: (end)

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: mta_mname

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: mta_mname

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute value: (end)

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: action

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: action

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute value: (end)

Oct 11 09:48:13 statler postfix/qmgr[14277]: private/smtp-amavis socket: wanted attribute: reason

Oct 11 09:48:13 statler postfix/qmgr[14277]: input attribute name: reason

```

How to solve that?

Thanks so much for help!

Manfred

----------

## Janne Pikkarainen

 *Muppy wrote:*   

> Hi Janne,
> 
> thanks for your quick reply! Here are some settings from my amavisd.conf:
> 
> ```
> ...

 

Try to comment out the /etc/amavisd.conf parameters above, restart amavisd and see if it helps. If it helps, then you'll need to investigate why those parameters are breaking your amavisd. Other than those two parameters everything looked like similar to my installation...

----------

## Muppy

That was it! You ARE the man.  :Wink: 

I can say that only commenting out the protocol did not solve my problem, but commenting out both definitely did the job.

Cheers!

Manfred

----------

## Janne Pikkarainen

 :Smile:  Have a nice day!

----------

## framirez

i was having the same issue but ,

I only comment out the /etc/amavisd.conf this parameters:

$protocol = 'QMQPqq';        # suggested protocol to use on all input sockets

----------

