Amavis: scanner les mails sortant ainsi que les mails provenant du webmail

Actuellement, amavis scanne tous les mails entrant (en les envoyant à spamassassin et clamav) et ca marche plutot bien. Maintenant, on me demande de scanner également les mails sortant afin d’éviter que des virus surtout soient envoyés, est-il possible de régler cela? A quel niveau cela se fait: postfix je suppose? Merci d’avance.

Une autre question pendant que j’y suis: quand j’envoi un mail de mon webmail, il n’est pas analysé par l’antivirus, postfix ne le transmet pas à amavis, il l’envoie à mon cyrus (mon serveur entrant) sans analyser le mail. On m’a dit que cela venait probablement du fait que postfix et mon webmail sont sur le même serveur, et donc les mails envoyés de mon webmail sont considérés comme des mails venant de l’adresse locale 127.0.0.1. Comment dire à postfix de transmettre malgré tout le mail à amavis, quoi qu’il arrive?
Edité le 07/08/2007 à 09:51

tu peux nous monter ton master.cf ? (/etc/postfix/master.cf)

J’ai postfix chez moi avec amavisd-new et mon webmail tout ça sur un seul serveur et mes mails sortants sont scannés
Edité le 03/08/2007 à 03:49

Le voici, peut être ai-je oublié de configureer quelque chose c’est fort possible ^^


#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# The script postfix-chroot.sh can be used to set up a Postfix chroot
# environment on your Mandrivalinux System.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp	inet	n	-	 y	 -	 -	 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	-	y	60	1	pickup
  -o content_filter=
  -o receive_override_options=
cleanup	unix	n	-	y	-	0	cleanup
qmgr	fifo	n	-	y	300	1	qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr	unix	-	-	y	1000?	1	tlsmgr
rewrite	unix	-	-	y	-	-	trivial-rewrite
bounce	unix	-	-	y	-	0	bounce
defer	unix	-	-	y	-	0	bounce
trace	unix	-	-	y	-	0	bounce
verify	unix	-	-	y	-	1	verify
flush	unix	n	-	y	1000?	0	flush
proxymap  unix  -       -       n       -       -       proxymap
smtp	unix	-	-	y	-	-	smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay	unix	-	-	y	-	-	smtp
	-o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq	unix	n	-	y	-	-	showq
error	unix	-	-	y	-	-	error
discard	unix	-	-	y	-	-	discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp	unix	-	-	n	-	-	lmtp
anvil	unix	-	-	y	-	1	anvil
scache	unix	-	-	y	-	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=nobody argv=/usr/bin/maildrop -d ${recipient}
#
# Cyrus. Please See the Postfix CYRUS_README file for details
#
# deliver interface (deprecated), to use this also use
# postconf -e cyrus-deliver_destination_recipient_limit=1
cyrus-deliver     unix  -       n       n       -       -       pipe
  user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
#
# for default cyrus socket placement
#cyrus     unix  -       n       n       -       -       lmtp
#  -o lmtp_cache_connection=yes
#
# if you configure cyrus socket in the chroot jail
#cyrus-chroot     unix  -       -       y       -       -       lmtp
#  -o lmtp_cache_connection=yes
#
# for lmtp to cyrus via tcp
#cyrus-inet	unix	-	-	y	-	-	lmtp
#  -o lmtp_cache_connection=yes
#  -o lmtp_sasl_auth_enable=yes
#  -o lmtp_sasl_password_maps=hash:/etc/postfix/cyrus_lmtp_sasl_pass
#  -o lmtp_sasl_security_options=noanonymous
#
# UUCP. Unix to Unix CoPy
#
# 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.
# These are not distributed with Mandrivalinux
#
#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

##### START OF CONTENT FILTER CUSTOMIZATIONS #####
# Please see the Postfix FILTER_README for details.
# These sample entries expect your content filter to
# listen on port 10025 and to inject mail back into
# postfix on port 10026.
#
# to enable such content filter run the command
#    postconf -e content_filter=smtp-filter:127.0.0.1:10025
#    postconf -e smtp-filter_destination_concurrency_limit=2
# or
#    postconf -e content_filter=lmtp-filter:127.0.0.1:10025
#    postconf -e lmtp-filter_destination_concurrency_limit=2
# and the command
#    postconf -e receive_override_options=no_address_mappings
#


127.0.0.1:10026	inet	n	-	y	-	-	smtpd
  -o content_filter=
  -o smtpd_restriction_classes=
  -o smtpd_client_restrictions=permit_mynetworks,reject
  -o smtpd_helo_restrictions=
  -o smtpd_sender_restrictions=
  -o smtpd_delay_reject=no
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o mynetworks=127.0.0.0/8
  -o smtpd_authorized_xforward_hosts=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
  -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks


#smtp-filter	unix	-	-	y	-	-	smtp
#  -o smtp_data_done_timeout=1200
#  -o smtp_send_xforward_command=yes
#  -o max_use=20

smtp-amavis	unix	-	-	y	-	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	-	y	-	-	smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -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 receive_override_options=no_header_body_checks,no_unknown_recipient_checks


##### END OF CONTENT FILTER CUSTOMIZATIONS #####

ah oui il est tout de même pas mal différent: :paf: (je pensais pas trouver tant de diff :ane:)
ce qui me surprend le plus c’est cette configuration avec le port 10025 et 10026

dans ton main.cf tu as bien cette ligne?

voici le mien si ça peut donner des idées (il est bcp plus “simple”)


# DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#submission inet n      -       -       -       -       smtpd
#	-o smtpd_etrn_restrictions=reject
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       -       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
#
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# maildrop. See the Postfix MAILDROP_README file for details.
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
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=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop -f$sender $recipient
scalemail-backend unix	-	n	n	-	2	pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}

# only used by postfix-tls
#tlsmgr	  fifo	-	-	n	300	1	tlsmgr
#smtps	  inet	n	-	n	-	-	smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#587	  inet	n	-	n	-	-	smtpd -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes



smtp-amavis unix -	-	n	-	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	-	n	-	-  smtpd
    -o content_filter=
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -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 smtpd_milters=
    -o local_header_rewrite_clients=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks

tlsmgr    unix  -       -       -       1000?   1       tlsmgr
scache    unix  -       -       -       -       1       scache
discard   unix  -       -       -       -       -       discard

Edité le 03/08/2007 à 13:52

Oui j’ai bien la ligne sur amavis dans mon main, mais mes mails sont apparemment analysés UNIQUEMENT en entrée, les mails sortant ne le sont pas. Pour la confugration avec les ports 10025 et 10026, le port 10026 était là par défaut, et j’ai rajouté le 10025 pour amavis. Mais apparemment, amavis renvoi par défaut (sur ma mandriva tout au moins) sur 10026, mais je n’ai pas encore eu le temps de m’y attarder.

Sinon, comme ce sont les mails sortant qui ne sont pas analysés, je pense que le problème vient plutot du main, mais bon, je ne vois pas ce que je pourrais changer. A moins que Postfix ne considèrent les mails provenant du réseau local comme sûrs? Je vais regarder un peu plus en détail ton master, et voir si quelque chose pourrait m’intéresser, mais à mon avis le problème vient d’autre part.

je doute que ce soit dans le main.cf
je te montre le mien y’a rien qui corresponde

en gras j’ai juste masqué mon nom d’hôte et mon nom de domaine

ok ca marche, en fait, je devais avoir une option ( -o smtpd_authorized_xforward_hosts=127.0.0.0/8 je pense, mais j’ai la flemme de vérifier) qui devait coincer. J’ai simplement viré le port 10026, et remplacer le 10025 par 10026, et ca tourne bien, merci :slight_smile:

Par contre l’émetteur n’est pas informé que son mail n’a pas été envoyé, une option à activer dans amavis je suppose?

oui dans /etc/amavid.conf

je pense que ce sont les lignes que j’ai mis en gras

cf www.linux-pour-lesnuls.com…

ok merci pour tous ces renseignements. Par contre, chose assez étrange, j’ai du mettre D_PASS pour la variable $final_virus_destiny = D_BOUNCE; Logiquement, D_BOUNCE devrait très bien fonctionner. Bref, ca marche, et j’ai une foule d’autres problèmes à régler ^^ Merci beaucoup

bon courage alors :wink: