Postfix配置多个Content Filter的方法
思韵闪耀
2013-03-19
0

   Postfix邮件服务器可以在接收邮件时使用content_filter来扫描邮件(病毒,广告等).通过整合一个集中化的电子邮件内容过滤器,比如amavis或mailscanner,Postfix可以利用单次调用来进行多个扫描.这非常好,但是有些过滤器很难或者几乎不可能整合到一个集中化的过滤器中.这是一个问题,尤其是你的Postfix系统已经安装了某些集中化的content_filter.我们能解决这个问题吗,当然可以.这个文档将给出许多可能的解决方案中的一种.你的步骤可能不一样,根据你的配置而定.

  在案例中,我们假设我们需要一个运行Postfix,Amavis(包含各种插件)和Avira MailGate的邮件系统.Postfix已经配置为使用Amavis系统作为content_filter.MailGate 不能通过Amavis进行整合,因此它要使用一个单独的content_filter.

  Amavis配置:Amavis监听10026端口,然后通过10027端口进行转发.

 代码如下  
$inet_socket_port = 10026;
forward_method => 'smtp:[127.0.0.1]:10027';

  MailGate配置:MailGate监听20024端口,然后通过20025端口进行转发.

 代码如下  
ListenAddress localhost port 20024
ForwardTo SMTP: localhost port 20025

  Postfix需要配置两个过滤器.

  这可以通过串接过滤器:进入的邮件首先提交到Postfix Content_filter,(www.3lian.net然后Content_filter将扫描后的邮件传给Postfix.扫描后的邮件再传给第二个Content_filter.最后再送到用户手中.我们的链是这样的:Postfix > MailGate > Postfix > Amavisd-new >

 代码如下  

Postfix > User
main.cf:

content_filter = smtp:127.0.0.1:20024
master.cf

localhost:20025 inet n - n - - smtpd
-o content_filter=smtp:127.0.0.1:10026
127.0.0.1:10027 inet n - n - - smtpd
-o content_filter= -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 smtpd_restriction_classes=
-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,no_milters
-o local_header_rewrite_clients=

  就这样,Postfix提交所有进来的邮件到20024端口的MailGate,MailGate再将扫描的结果传回到20025的Postfix.Postfix在20025端口运行着一个额外的SMTP服务,这个服务也包含了一个content_filter,因此所有到达20025端口的邮件会再传给10026端口.Amavis监听着10026端口,因此邮件将被Aamavis扫描.扫描完成后Amavis将邮件传送到10027端口.而在10027端口上运行着另外一个Postfix提供的SMTP服务,至此邮件到达链的终点,邮件将被邮递给用户.

  另外一个配置样例可能如下:

 代码如下  

In main.cf:

# send email to amavisd
content_filter = amavisd:[127.0.0.1]:10024
In master.cf:

# amavisd
amavisd unix - - n - 2 lmtp
-o lmtp_data_done_timeout=1200s
-o disable_dns_lookups=yes

# receive email from amavisd
# and then send email to altermine
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=altermine

# receive email from 127.0.0.1:10025
altermine unix - - n - 2 pipe
...

# receive email from altermine
127.0.0.1:20025 inet n - n - - smtpd
-o content_filter=
-o ...

  整个流程为: postfix -> amavisd:[127.0.0.1]:10024 -> postfix -> altermine -> postfix -> user


【版权声明】
本站部分内容来源于互联网,本站不拥有所有权,不承担相关法律责任。如果发现本站有侵权的内容,欢迎发送邮件至masing@13sy.com 举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

相关内容

将IIS设置克隆到新服务器...
将IIS设置克隆到新服务器的最佳方法是使用IIS配置文件。以下是详...
2025-06-06
搭建Git服务器及本机克隆...
Git是什么?Git是目前世界上最先进的分布式版本控制系统。SVN...
2025-03-17
ubuntu环境下搭建gi...
操作环境:服务器:Ubuntu 24.04.2 LTS+git 2...
2025-03-17
ubuntu配置DNS
ubuntu配置DNS在Ubuntu中配置DNS通常涉及编辑/et...
2024-11-17
docker-compos...
1.Compose介绍 DockerCompose是一个用来定义和...
2024-04-26
firewall-cmd ...
firewalld的简要说明:firewalld 、firewal...
2024-03-15

热门资讯

Roundcube 配置过各提... Fileinfo/mime_content_type configuration: OK Mimet...
搭建PostfixAdmin ... 一、原理及其应用: 笔者之前就职在上海一家信息公司,至力于全面的电子邮件营销解决方案,公司中等规模,...
在wdos系统下搭建postf... 一.简介: 1. wdOS是一个基于CentOS版本精简优化过的Linux服务器系统,大部分保留着c...
RHEL5系统中安装Postf... 前提1:安装RHEL5时把所有的开发工具装上。 原理图 前提2 :开始前请确保您已经配置好指向此邮件...
Linux停止和启动postf... 1.启动Postfix服务 启动Postfix服务的命令为: /etc/init.d/postfix...