Description:
Install python3
yum install -y python3 python3-pip
Install send mail module
#In centos or ubuntu
pip3 install --index-url https://nexus.xethh.me/repository/pypi/simple --upgrade XSysLogSendmail
#In some case in rasbian
#pip and pip3 get messaged
pip3 install --index-url https://nexus.xethh.me/repository/pypi/simple --upgrade XSysLogSendmail
Open python3 repl, send genZohoAuthenLogMail to generate a send mail script on current directory
python3
=========
import XSysLogSendmail
XSysLogSendmail.genZohoAuthenLogMail()
**Current directory is /data/scripts, confirm?
[Enter]
**Please enter smtp host:
[Smtp Account]
**Please enter smtp pwd:
[Smtp Password]
**Please enter sender:
[Send address]
**Please enter receiver:
[Receiver addresses separated by comma]
add below line to /etc/pam.d/sshd
#Based on the blog post, it suggest to use require
#But to my understanding, the script maybe have change return error, which will lead to fail authen
#So i would like to use optional instead, the operation will perceed, but result ignored
session optional pam_exec.so {path to sh file}
After generated the file, change modification permission
chmod +x sendmail.sh
Temporary disable selinux if needed, will fix this in the future [Link]
setenforce 0
#setenforce 1 ==> set enable