Spam Header removed

Discussion in 'Server Operation' started by asidev, Aug 22, 2011.

  1. asidev

    asidev New Member

    Hi,
    I'm using ISPConfig to manage a mail server, and I set all email account to "Normal" policy as spamfilter

    I notice 2 strange behaviour

    1) I have a mailbox with an alias, spam e-mail sent to the alias are checked (I can see in the log the entry from amavis) and recognized as spam, but when the mail is delivered to mailbox no header is in the mail at all. I set spam_level to -69, so spam header should be added for every mail

    2) Sometimes behaviour described above is noticed also for normal account, in the log I can see the SPAM line, mail is marked but after delivery in the headers there is no X-Spam-* line at all

    Has anyone had the same behaviour?

    Any idea about avoid this?
     
  2. asidev

    asidev New Member

    I forget to say that if I try to send spamassin GTUBE through sendmail, the mail is correctly marked and headers still remain, for both alias and mailbox
     
  3. asidev

    asidev New Member

    Checking better log seems that this bahaviuor occur with all mail address in mail_forwarding table, seems that after a first analisys by amavis (with default values) the mail is no longer analized when the forward is expanded and the old headers are removed

    Anyone has a similar issue?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You mean that you created postfix transports for the emails? In that case, you will have to define the final recipient domain or email address manually in the spamfilter user list when it does not exist as mailbox (where you selected the spam filter level for) on the server.
     
  5. asidev

    asidev New Member

    For these domains I don't create a specific transport, i configured dovecot for delivery

    Simplifyng I have 2 domains, a.tld and b.tld, a mailbox [email protected] and a forward [email protected] --> [email protected]

    Both domains are listed in Email domains and [email protected] has a spamfilter policy which adds Spam header at level -69, so I should have header always added

    If I send the mail directly to [email protected] everuthing works well, if I send to the alias I can see in the log the amavis processing (with default params in conf.d/50-user) but when the mail is delivered to real mailbox the headers disappear, also when the mail is detected as spam

    Seems that after the mail is processed for alias it is not reinjected into postfix queue and spam headers stripped

    Is possible?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Please check in postfix main.cf that it contains this line:

    receive_override_options = no_address_mappings
     
  7. asidev

    asidev New Member

    Yes, the line is in main.cf:

    myhostname = bishop.asidev.net
    alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    alias_database = hash:/etc/aliases
    mydestination = bishop.asidev.net, localhost, localhost.localdomain
    relayhost =
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    html_directory = /usr/share/doc/postfix/html

    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf, hash:/var/lib/mailman/data/virtual-mailman
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /var/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    virtual_create_maildirsize = yes
    virtual_maildir_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes

    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_tls_security_level = may

    transport_maps = mysql:/etc/postfix/mysql-virtual_transports.cf
    relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf

    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps

    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination
    smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
    smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
    maildrop_destination_concurrency_limit = 1
    maildrop_destination_recipient_limit = 1

    virtual_transport = dovecot

    header_checks = regexp:/etc/postfix/header_checks
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    nested_header_checks = regexp:/etc/postfix/nested_header_checks
    body_checks = regexp:/etc/postfix/body_checks

    dovecot_destination_recipient_limit = 1

    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
    message_size_limit=31457280

    In master.cf I have:

    dovecot unix - n n - - pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}

    amavis unix - - - - 2 smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

    127.0.0.1:10025 inet 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_client_restrictions=permit_mynetworks,reject
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o mynetworks=127.0.0.0/8
    -o strict_rfc821_envelopes=yes
    -o receive_override_options=no_unknown_recipient_checks, no_header_body_checks
    -o smtpd_bind_address=127.0.0.1
    -o smtpd_delay_reject=no
    -o smtpd_data_restrictions=reject_unauth_pipelining
    -o smtpd_end_of_data_restrictions=
    -o mynetworks=127.0.0.0/8
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o local_header_rewrite_clients=
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Is the "Local" setting under Spamfilter > User/Domain set to "Yes" for all records. if this is set to "No" in a record, them amavisd will remove the spam filter headers.
     
  9. asidev

    asidev New Member

    Local is yes for all records, one for each mailbox

    I have to specify also a record for each mail alias?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, please do that. Or at least enable the spamfilter on every domain that you use for the alias records.
     
  11. asidev

    asidev New Member

    Adding a spamfilter for the alias domain solves the problem.

    I posted in Amavis list to bettere understand and the result is that @local_domains_map should contains every domain considered local, otherwise headers are removed.

    This variable is automatically filled when you use $sql_select_policy, in the case of default query I found in ispconfig installation with all spamfilter, so adding a spamfilter for the domain solves the issue

    I'll change the query to return a domain if it is in mail_domain table
     

Share This Page