SHELL系列2-告警文件

外部邮箱服务器,告警文件

yum install -y mailx
vim /etc/mail.rc

mailx

# mkdir -p /root/.certs/    ###创建目录,用来存放证书
# echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt   ###添加一个ssl证书到证书数据库中
# certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt  ###添加一个Global证书到证书数据库中
# certutil -L -d /root/.certs   ###列出目录下的数字证书
# vim /etc/mail.rc
set [email protected]
set smtp=smtps://smtp.163.com:465
set [email protected]
set smtp-auth-password=*****    ###该密码是在网易邮箱中申请的第三方客户端密码,不是账户的登陆密码。
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs
三、邮箱测试:
注意有些邮箱账号必须要写全,否则收不到邮件!例如:live邮箱就必须写全才能收到邮件。但是163邮箱不用
写全,就能接收到邮件。echo "hi jack,i am rose" | mail -s "zabbix"   [email protected]
依次输入命令:
# cd /root/.certs/
# ll
# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt
解决问题,成功的标志:

Notice: Trust flag u is set automatically if the private key is present.

猜你喜欢

转载自blog.csdn.net/m0_67849390/article/details/130192556
今日推荐