总结:

总结:

我在使用 clamd 和 amavisd 时遇到问题,请参阅下面的错误消息,我在 CentOS 7.3 上运行电子邮件服务器.....amavisd 和 clamd 似乎运行良好,但每次在我从我的电子邮件服务器发送邮件之前,它们都会出现错误,如果我从 Gmail 向我的电子邮件服务器发送邮件,也会出现错误。

Apr  4 15:37:49 mail postfix/smtpd[3367]: connect from mail-pg0-f45.google.com[74.12*.**.**]
Apr  4 15:37:49 mail postfix/smtpd[3367]: E42B1606A5C9: client=mail-pg0-f45.google.com[74.12*.**.**]
Apr  4 15:37:50 mail postfix/cleanup[3371]: E42B1606A5C9: message-id=<CAC-5EtvTiKHMGZXukkj=4rxhOKiD1f3oifaBE6QnmCnbgjM10A@mail.gmail.com>
Apr  4 15:37:50 mail postfix/qmgr[1374]: E42B1606A5C9: from=<wil*******@gmail.com>, size=2488, nrcpt=1 (queue active)
Apr  4 15:37:50 mail postfix/smtpd[3367]: disconnect from mail-pg0-f45.google.com[74.12*.**.**]
Apr  4 15:37:50 mail amavis[2097]: (02097-02) (!)connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory
Apr  4 15:37:51 mail amavis[2097]: (02097-02) (!)connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory
Apr  4 15:37:51 mail amavis[2097]: (02097-02) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.sock, retrying (2)
Apr  4 15:37:57 mail amavis[2097]: (02097-02) (!)connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory
Apr  4 15:37:57 mail amavis[2097]: (02097-02) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamd.amavisd/clamd.sock (All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.sock) at (eval 129) line 613.\n
Apr  4 15:37:57 mail amavis[2097]: (02097-02) (!)WARN: all primary virus scanners failed, considering backups

请帮忙,非常感谢!

答案1

总结:

setsebool -P antivirus_can_scan_system 1
setsebool -P clamd_use_jit on

yum install clamav-scanner-systemd

cd /usr/lib/systemd/system
cp clamd\@scan.service clamd\@amavisd.service

systemctl start clamd@amavisd
systemctl enable clamd@amavisd
systemctl restart amavisd

长版本:

我猜你收到“没有这样的文件或目录”错误是因为套接字/var/run/clamd.amavisd/clamd.sock不存在,而这又是因为 clam 守护进程未安装或未运行并未在该套接字上监听。

要修复,请尝试

yum install clamav-scanner-systemd

...其中包括守护进程,clamd

默认情况下,它附带的服务(包括)会尝试打开错误的配置文件,因为/usr/lib/systemd/system/[email protected]/usr/lib/systemd/system/[email protected]%i在服务中,它是实例名称的占位符。要使服务改用 amavis conf 文件,请将其复制到适当实例化的单元:

cd /usr/lib/systemd/system
cp clamd\@scan.service clamd\@amavisd.service

(看9.6.5. 使用实例化单元RHEL 7 文档了解更多信息)

最后,尝试

systemctl start clamd@amavisd

并检查它现在是否正在运行,使用

systemctl status clamd@amavisd

最后启用它

systemctl enable clamd@amavisd

检查 的内容/var/run/clamd.amavisd,您现在应该发现clamd.sock存在。

为了更好的衡量,

systemctl restart amavisd

并仔细检查您的日志文件,确保一切正常。

如果不是,如果SELinux正在强制执行,您可能需要先运行以下命令,以使 ClamAV 和 freshclam 正常运行:

setsebool -P antivirus_can_scan_system 1
setsebool -P clamd_use_jit on

答案2

我在 Centos 7 上的 Plesk 上遇到了这个问题

问题,项目滞留在邮件队列中

日志包括status=deferred (delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)

解决方案安装 Amavis(一种开源电子邮件内容过滤器)https://www.amavis.org

yum install amavisd-new 
systemctl enable amavisd && systemctl start amavisd
systemctl restart postfix

https://support.plesk.com/hc/en-us/articles/12376969376279-Unable-to-send-mail-deferred-delivery-temporarily-suspended-connect-to-127-0-0-1-127-0-0-1-10024-Connection-refused

相关内容