efa v4 和exchange 安装开源垃圾邮件网关在Ce
admin
2023-02-01 08:45:26
0

虚拟机插入 Centos 7 Min .ISO 光盘

进入到安装选 项 按tab键

efa v4 和exchange 安装开源垃圾邮件网关在Ce

添加 inst.ks=http://dl.efa-project.org/build/4/kstesting.cfg

efa v4 和exchange 安装开源垃圾邮件网关在Ce

按Enter 自动安装,网络安装 大概需要下载500MB左右的文件 需要等60分钟左右

efa v4 和exchange 安装开源垃圾邮件网关在Ce

安装完成

efa v4 和exchange 安装开源垃圾邮件网关在Ce

安装配置

efa v4 和exchange 安装开源垃圾邮件网关在Ce

修改网卡

vi /etc/sysconfig/network-scripts/ifcfg-ens160

efa v4 和exchange 安装开源垃圾邮件网关在Ce

你不会在eFa上使用智能主机,而是建立eFa作为出站中继。

EFA配置选项7)邮件设置 - >选项1)出站邮件中继

efa v4 和exchange 安装开源垃圾邮件网关在Ce

EFA配置选项7“出站智能主机”(7,2)“智能主机:已禁用”,因为您希望EFA直接发送邮件

efa v4 和exchange 安装开源垃圾邮件网关在Ce

EFA配置选项7“传输设置” “(7,4)as”domain.com“”<您的交换服务器的内部IP地址“

efa v4 和exchange 安装开源垃圾邮件网关在Ce

EFA配置选项8“垃圾邮件设置” “(8,1)非垃圾邮件设置

垃圾邮件设置>非垃圾邮件设置

  • 禁用存储非垃圾邮件:否(这允许培训误报以及最近的存档/恢复)。

禁用非垃圾邮件签名:是(此设置取决于您是否需要EFA水印,我禁用它,因为我们(IT管理员)管理垃圾邮件而不是用户。此外,我们的大多数(99%)用户都是外部的将全民教育暴露在互联网上。)

efa v4 和exchange 安装开源垃圾邮件网关在Ce

efa v4 和exchange 安装开源垃圾邮件网关在Ce

  • EFA配置选项9“垃圾邮件设置” “(8,2)圾邮件设置
  • 推荐:垃圾邮件设置>垃圾邮件设置。启用垃圾邮件传递:是的。(这与后面提到的其他规则相结合,允许可疑垃圾邮件进入用户的垃圾邮件文件夹。

EFA V4与Active Directory集成

请安装 php-ldap (rpm -qa|grep php)

yum install lrzsz -y

efa v4 和exchange 安装开源垃圾邮件网关在Ce

vi /var/www/html/mailscanner/conf.php(编辑后重启系统 需要开启apache https)

// LDAP settings for authentication

define('USE_LDAP', true);

define('LDAP_SSL', false);

define('LDAP_HOST', '192.168.32.83');

define('LDAP_PORT', '389');

define('LDAP_DN', 'OU=email,DC=test,DC=xyz');

define('LDAP_USER', 'test@test.xyz');

define('LDAP_PASS', '123456');

define('LDAP_SITE', 'Default-First-Site-Name');

define('LDAP_FILTER', 'proxyAddresses=smtp:%s', 'mail=%s');

define('LDAP_PROTOCOL_VERSION', 3);

define('LDAP_EMAIL_FIELD', 'mail');

define('LDAP_USERNAME_FIELD', 'cn');

define('LDAP_MS_AD_COMPATIBILITY', true);

efa v4 和exchange 安装开源垃圾邮件网关在Ce

vi /etc/hosts (添加exchange服务器IP和域名)

192.168.32.83 mail.test.xyz

efa v4 和exchange 安装开源垃圾邮件网关在Ce

设置垃圾邮件不修改主题

vi /etc/MailScanner/MailScanner.conf

Spam Subject Text =

efa v4 和exchange 安装开源垃圾邮件网关在Ce

/etc/init.d/spamassassin restart

exchange 设置垃圾邮件过滤

添加规则

New-TransportRule -Name "EFA to Junk Folder" -HeaderMatchesMessageHeader "X-Spam-Status" -HeaderMatchesPatterns "Yes" -SetSCL 9 -Comments "This rule moves spam messages from the EFA filter to the users junk mail folder."

步骤 2:使用命令行管理程序重新启动 Microsoft Exchange 传输服务

运行命令:Restart-Service MSExchangeTransport

efa v4 和exchange 安装开源垃圾邮件网关在Ce

重启服务

service sqlgrey restart

service spamassassin restart

service webmin restart

service clamd restart

service MailScanner restart

service postfix restart

MailScanner --lint

spamassassin -D --lint (重新加载规则)

安装fail2ban  自动拦截邮件***

yum install fail2ban –y

# vi /etc/fail2ban/jail.conf

最后一行添加如下:

[postfix]

enabled = true

filter = postfix

action = iptables-allports[name=postfix, port=25, protocol=tcp]

ignoreip = 127.0.0.1

logpath = /var/log/maillog

bantime = 6048000

findtime = 120

maxretry = 3

[postfix-ddos]

enabled = true

filter = postfix-ddos

action = iptables-allports[name=MAIL, protocol=all]

logpath = /var/log/maillog

maxretry = 2

findtime = 86400

bantime = 604800

/etc/fail2ban/filter.d中编辑或新加文件,文件名一定要跟上一步jail.conf配置文件中的“filter=”对应

POSTFIX

vi /etc/fail2ban/filter.d/postfix.conf

# Fail2Ban configuration file

#

# Author: Cyril Jaquier

#

# $Revision: 510 $

#

[Definition]

# Option: failregex

# Notes.: regex to match the password failures messages in the logfile. The

# host must be matched by a group named "host". The tag "" can

# be used for standard IP/hostname matching and is only an alias for

# (?:::f{4,6}:)?(?P\S+)

# Values: TEXT

#

failregex = warning: (.*)\[\]: SASL LOGIN authentication failed:

reject: RCPT from (.*)\[\]: 550 5.1.1

reject: RCPT from (.*)\[\]: 450 4.7.1

reject: RCPT from (.*)\[\]: 554 5.7.1

reject: RCPT from (.*)\[\]: 554 5.5.2

reject: RCPT from (.*)\[\]: 504 5.5.2

reject: RCPT from (.*)\[\]: 450

reject: RCPT from (.*)\[\]: 554

reject: RCPT from (.*)\[\]: 554 5.7.1

# Option: ignoreregex

# Notes.: regex to ignore. If this regex matches, the line is ignored.

# Values: TEXT

#

ignoreregex =

--------------------------------------------------------------------------------------------------------------

vi /etc/fail2ban/filter.d/postfix-ddos.conf

# Fail2Ban filter for Postfix DDOS attacks # [INCLUDES] before = common.conf [Definition] _daemon = postfix/(submission/)?smtp(d|s) failregex = ^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[\]: 450 4\.7\.1 Client host rejected: cannot find your hostname, (\[\S*\]); from=<\S*> to=<\S+> proto=ESMTP helo=<\S*>$ ^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[\]: 450 4\.7\.1 : Helo command rejected: Host not found; from=<> to=<> proto=ESMTP helo= *$ ^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[\]: 454 4\.7\.1 Service unavailable; Client host \[\S+\] blocked using .* from=<\S*> to=<\S+> proto=ESMTP helo=<\S*>$ ^%(__prefix_line)sNOQUEUE: reject: VRFY from \S+\[\]: 550 5\.1\.1 .*$ ^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[\]: 504 5\.5\.2 .*$ ^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[\]: 554 5\.7\.1 .*$ ^%(__prefix_line)simproper command pipelining after \S+ from [^[]*\[\]:?$ ^%(__prefix_line)slost connection after \S+ from [^[]*\[\]:?$ ^%(__prefix_line)swarning: [-._\w]+\[\]: SASL ((?i)LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [ A-Za-z0-9+/:]*={0,2})?\s*$ ^%(__prefix_line)sstatistics: max connection rate \S+ for \(smtp:\):?$ ignoreregex = lost connection after .* from unknown\[unknown\]$ authentication failed: Connection lost to authentication server$ statistics: max connection rate .* for \(smtp:unknown\).*$ [Init] journalmatch = _SYSTEMD_UNIT=postfix.service # Author: kn007

启动fail2ban

systemctl start fail2ban

查看拦截fail2ban

fail2ban-client status postfix

CentOS7版本后防火墙默认使用firewalld

systemctl start firewalld

yum install -y iptables-services

service iptables start

vi /etc/sysconfig/iptables

-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 587 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 10000 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT

测试邮件内容过滤

发送测试邮件的文本内容如下:

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

测试反病毒邮件

发送测试邮件的文本内容如下:

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

关闭MailScanner 对邮件内容扫描签名

vi /etc/MailScanner/MailScanner.conf

Dangerous Content Scanning = no

对发送的邮件进行签名

vi /etc/Mailscanner/Mailscanner.conf

Sign Clean Messages = no

这个选项默认是打开的,表示MailScanner对邮件内容进行扫描,但是过于严格了,会把很多html邮件滤掉,所以我把它关了。

systemctl restart mailscanner.service

efa v4 和exchange 安装开源垃圾邮件网关在Ce

Virus Scanners = clamd

设置杀毒软件,如果使用clamav,则Virus Scanners = clamav。

vi /etc/MailScanner/MailScanner.conf

在2242行

Required SpamAssassin Score = 4

(高评分垃圾邮件投递)

High Scoring Spam Actions = deliver header "X-Spam-Status:Yes"

efa v4 和exchange 安装开源垃圾邮件网关在Ce

systemctl restart mailscanner.service

相关内容

热门资讯

德国总理:美国正在被伊朗羞辱 德国之声4月27日报道,德国总理默茨在访问一所学校时表示,在当前的持续冲突中,伊朗领导层正试图羞辱美...
理响中国|“长”歌以行,风云激... 光阴如梭,东方潮阔。这里是中国的长三角,世界的长三角。无论过去、现在还是未来,这片土地都因时代而生,...
白宫:特朗普及其国安团队开会讨... 新华社华盛顿4月27日电 美国白宫新闻秘书莱维特27日在记者会上证实,总统特朗普及其国家安全团队当天...
人民日报刊文:日本放开杀伤性武... 日本放开杀伤性武器出口推高地缘冲突风险(国际论坛)常思纯《人民日报》(2026年04月28日 第 0...
医疗保障法草案二审:明确生育保... 满足多样化健康保障需求本报记者 彭 波4月27日,医疗保障法草案二审稿提请十四届全国人大常委会第二十...
天津一景区发生自转旋翼机事故1... 澎湃新闻记者 吕新文中国民用航空华北地区管理局4月22日公布《豪客通航“10•1”天津长芦汉盐旅游区...
卡塔尔埃米尔与美国总统特朗普通... 当地时间24日,卡塔尔埃米尔塔米姆与美国总统特朗普通电话,重点就中东地区局势以及伊朗与美国谈判问题交...
男子30年前被扣押2859克黄... 澎湃新闻记者 王鑫家住辽宁省大连市的潘永嘉近日向澎湃新闻反映称,三十年前,他在大连周水子机场被盖州市...
商务部:取消反制欧盟两家金融机... 中华人民共和国商务部令二〇二六年 第1号鉴于欧盟已取消对中国两家金融机构的制裁措施,现公布《关于取消...
过去24小时共有5艘船只通过霍... 总台记者当地时间24日获悉,过去24小时内,共有5艘船只通过霍尔木兹海峡,其中包括一艘伊朗油轮。(总...