因此,我使用LogWatch已经有一段时间了,并且希望对其进行定制,所以这是我想要编辑的内容之一。
我想让LogWatch通过SMTP进行验证?
我的邮件服务器(iREDmail)对auth有一些非常严格的规则,因此我必须为一个帐户设置密码,并且它必须在系统中。
如何使用电子邮件和密码将LogWatch设置为STMP?
发布于 2020-09-30 11:21:56
嗨,如果您想要使用smtp帐户发送日志表邮件,您可以使用软件包msmtp (debian)并配置logwatch来使用它,因此它会发送经过身份验证的邮件。您不需要后缀,设置自身不会影响系统中现有的MTA配置。
步骤1:安装和测试msmtp
apt-get install msmtp通过在用户主文件夹中创建配置文件来配置它
cd ~
touch ./.msmtprc
edit .msmtprc编辑并粘贴此内容以满足您的需要。
account default
host mail.domain.tld
port 587
from user@domain.tld
auth on
user user@domain.tld
password myverysecretpass
tls on
tls_certcheck off tls_certcheck off #如果您不想检查邮件服务器的ssl证书
tls_trust_file mycacertificatefile #(如果要检查ca证书)
保存文件并使用命令检查/验证配置
msmtp -S步骤2:编辑日志表的配置
edit /etc/logwatch/conf/logwatch.conf找到现有的邮件行并对其进行注释。创建新行并更改目标邮件地址
mailer = "/usr/bin/msmtp administrator@domain.tld"检查.msmtprc中日志表匹配邮件中的邮件地址,否则您将得到非传递报告。
MailFrom = user@domain.tld保存并运行日志监视脚本,检查目标邮箱中的电子邮件,如果没有任何消息,请检查user@domain.tld邮箱是否有问题。
这个解决方案对我有效,我得到邮件正确的方式,我使用DMARC和DKIM正确的报告,我需要。
发布于 2017-06-19 09:13:22
所有有效的Logwatch设置及其默认值的列表都在默认的logwatch.conf文件中,您可能可以在/usr/share/logwatch/default.conf/logwatch.conf中找到该文件。Logwatch邮件选项非常有限;没有任何类型的身份验证。配置文件上的注释记录了所有可能的内容:
#Output/Format Options
#By default Logwatch will print to stdout in text with no encoding.
#To make email Default set Output = mail to save to file set Output = file
Output = stdout
#To make Html the default formatting Format = html
Format = text
#To make Base64 [aka uuencode] Encode = base64
Encode = none
# Default person to mail reports to. Can be a local account or a
# complete email address. Variable Output should be set to mail, or
# --output mail should be passed on command line to enable mail feature.
MailTo = root
# WHen using option --multiemail, it is possible to specify a different
# email recipient per host processed. For example, to send the report
# for hostname host1 to user@example.com, use:
#Mailto_host1 = user@example.com
# Multiple recipients can be specified by separating them with a space.
# Default person to mail reports from. Can be a local account or a
# complete email address.
MailFrom = Logwatch这表示您必须允许Logwatch在本地MTA上发送电子邮件而不进行身份验证。
使用身份验证可能在后缀中通过以下方法强制执行:
smtpd_client_restrictions = permit_sasl_authenticated,rejectsmtpd_sender_restrictions = reject_sender_login_mismatch.这些都是在端口587上提交时的正常设置,但是将permit_mynetworks放在Postfix上监听端口25将允许本地用户在不进行身份验证的情况下发送邮件。这通常足以让Logwatch发送邮件。
您的iRedMail 使用后缀作为邮件传输代理。iRedMail文档还为允许用户发送电子邮件而无需SMTP身份验证提供了使用两种不同方法的文章。这两种方法都涉及手动编辑配置文件。您应该将您的Logwatch添加为允许的发件人。
https://serverfault.com/questions/856516
复制相似问题