# Postfix and Amavis doesn't work [RESOLVED]

## lostinspace2011

I tired to follow the instruction from http://www.gentoo.org/doc/en/mailfilter-guide.xml and https://forums.gentoo.org/viewtopic-t-163861-highlight-spam.html however after changing my /etc/postfix/master.cf and /etc/postfix/main.cf postfix didn't work anymore. I managed to get it running on port 10025 and amavisd on 10024, however nothing was listening on port 25 and hence none of my clients were able to send outbound message, nor were any messages coming in. 

From the configuration it seems that smtp-amavis is only available via unit sockets, however this would prevent my networked clients from sending any messages via this server. This just doesn't make sense to me, however both examples include similar instructions.

Any idea what I am doing wrong. Would be really grateful for any help.

Thanks in advance.

Here are my configuration files :

cat /etc/postfix/master.cf |grep -v "#"

```

smtp-amavis     unix -        -       n     -       10  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

pickup    fifo  n       -       n       60      1       pickup

cleanup   unix  n       -       n       -       0       cleanup

qmgr      fifo  n       -       n       300     1       qmgr

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

proxywrite unix -       -       n       -       1       proxymap

smtp      unix  -       -       n       -       -       smtp

relay     unix  -       -       n       -       -       smtp

   -o smtp_fallback_relay=

showq     unix  n       -       n       -       -       showq

error     unix  -       -       n       -       -       error

retry     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

```

Previously I was using the following instead of the new configurations suggestion by the mail filtering instructions.

```
smtp      inet  n       -       n       -       -       smtpd

```

cat /etc/postfix/main.cf |grep -v "#"|grep -v "^$"

```

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = //usr/lib/postfix

data_directory = /var/lib/postfix

mail_owner = postfix

myhostname = bumblebee.mydomain.com 

mydomain = mydomain.com

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain

unknown_local_recipient_reject_code = 550

mynetworks = 192.168.0.0/24, 127.0.0.0/8

recipient_delimiter = +

home_mailbox = .maildir/

  

local_destination_concurrency_limit = 5

default_destination_concurrency_limit = 20

debug_peer_level = 2

debugger_command =

    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

    ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

html_directory = /usr/share/doc/postfix-2.5.7/html

manpage_directory = /usr/share/man

sample_directory = /etc/postfix

readme_directory = /usr/share/doc/postfix-2.3.6/readme

default_destination_concurrency_limit = 2

alias_database = hash:/etc/mail/aliases, hash:/var/lib/mailman/data/aliases

local_destination_concurrency_limit = 2

alias_maps = hash:/etc/mail/aliases, hash:/var/lib/mailman/data/aliases

home_mailbox = .maildir/

broken_sasl_auth_clients = yes

smtpd_sasl_auth_enable = yes

smtpd_sasl_path = smtpd

smtpd_sasl_security_options = noanonymous

smtpd_sasl_authenticated_header = yes

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

smtpd_use_tls = yes

smtpd_tls_auth_only = yes

smtp_tls_note_starttls_offer = yes

smtpd_tls_key_file = /etc/ssl/misc/mail/privkey.pem

smtpd_tls_cert_file = /etc/ssl/misc/mail/signed.cer

smtpd_tls_CAfile = /etc/ssl/misc/certs/ca.cer 

smtpd_tls_loglevel = 3

smtpd_tls_received_header = yes

smtpd_tls_session_cache_timeout = 3600s

tls_random_source = dev:/dev/urandom

virtual_uid_maps = static:1000

virtual_gid_maps = static:100

virtual_mailbox_base = /home/vmail

virtual_mailbox_domains = pgsql:/etc/postfix/pgsql_virtual_domains_maps.cf

virtual_mailbox_maps = pgsql:/etc/postfix/pgsql_virtual_mailbox_maps.cf

virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, pgsql:/etc/postfix/pgsql_virtual_alias_maps.cf

virtual_mailbox_limit = 51200000

virtual_transport =   virtual 

header_size_limit = 30720000

message_size_limit = 30720000

owner_request_special = no

biff = no

smtpd_helo_required = yes

content_filter = smtp-amavis:[localhost]:10024

```

Last edited by lostinspace2011 on Sun Jan 10, 2010 9:59 am; edited 2 times in total

----------

## lostinspace2011

This is to show the processes are using the port configured and the services are running. However nothing seems to be on port 25.

Amavisd on port 10024

```
bumblebee postfix # lsof -i tcp:10024

COMMAND   PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME

amavisd 26810 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26822 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26823 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26824 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26825 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26826 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26827 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26828 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26829 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26830 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)

amavisd 26831 amavis    5u  IPv4 5372091      0t0  TCP localhost:10024 (LISTEN)
```

Postfix master process on port 10025

```
bumblebee postfix # lsof -i tcp:10025

COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME

master  27005 root   16u  IPv4 5375498      0t0  TCP localhost:10025 (LISTEN)
```

Nothing on port 25, so I can't send or receive any mail

```
bumblebee postfix # lsof -i tcp:25   

bumblebee postfix # 
```

----------

## cach0rr0

hiya

i used that guide for my own, so hopefully can provide a bit of help

the postfix process listening on 10025 is supposed to be *in addition to*, not a replacement (which is the crux of your issue), and as such should be an *addition* to master.cf rather than a replacement for the original smtp listener on 25 

Here is my fully functional master.cf if it helps

```

smtp      inet  n       -       n       -       -       smtpd

pickup    fifo  n       -       n       60      1       pickup

cleanup   unix  n       -       n       -       0       cleanup

qmgr      fifo  n       -       n       300     1       qmgr   

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

proxywrite unix -       -       n       -       1       proxymap

smtp      unix  -       -       n       -       -       smtp

relay     unix  -       -       n       -       -       smtp

        -o smtp_fallback_relay=

showq     unix  n       -       n       -       -       showq

error     unix  -       -       n       -       -       error

retry     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

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

```

----------

## cach0rr0

actually, it's just this line you're missing from master.conf

```

smtp      inet  n       -       n       -       -       smtpd

```

literally that's it. add that up top, and it should get you sorted back to sending/receiving mail (or if you're lazy, use mine verbatim  :Razz:  )

everything else looks fine

----------

## lostinspace2011

Thanks. That did it. All working now.

 :Very Happy: 

----------

## lostinspace2011

Thanks. That did it. But now I have another issue : https://forums.gentoo.org/viewtopic-t-810482.html

Thanks for your help

----------

