SHELL series 2-alarm file

External mailbox server, alert file

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

mailx

# mkdir -p /root/.certs/ ###Create a directory to store certificates 
# 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 # ##Add an ssl certificate to the certificate database 
# certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt ###Add a Global Certificate to the certificate database 
# certutil -L -d /root/.certs ###List the digital certificates in the directory
# vim /etc/mail.rc 
set [email protected] 
set smtp=smtps://smtp.163.com:465 
set [email protected] 
set smtp-auth-password=* **** ### This password is the third-party client password applied in the NetEase mailbox, not the login password of the account. 
set smtp-auth=login 
set ssl-verify=ignore 
set nss-config-dir=/root/.certs
3. Email test: 
Note that some email accounts must be written in full, otherwise the email will not be received! For example: the live mailbox must be fully written in order to receive the mail. However, you don't need to fill in all the 163 mailboxes 
to receive emails. echo "hi jack,i am rose" | mail -s "zabbix" [email protected]
Enter the commands in sequence: 
# cd /root/.certs/ 
# ll 
# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt 
solves the problem successfully Flag: 

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

Guess you like

Origin blog.csdn.net/m0_67849390/article/details/130192556