systemd alert service - alerts when someone logs in via ssh or use sudo on the server
Systemd service that send gmail alerts when someone ssh into or use sudo on the machine.
Note: I have used same email to send and recieve email, you can change that if you want.
vars.env
filesshudo.service
filechmod 644 ~/.sshudo/sshudo.service
and chown root:root ~/.sshudo/sshudo.service
/etc/systemd/system/
chmod 700 ~/.sshudo
(I put vars.env and sshudo_alert.py files in this directory, you can put wherever you want but make sure that you add those changes to /etc/systemd/system/sshudo.service
file)chmod 600 ~/.sshudo/vars.env
chmod 700 ~/.sshudo/sshudo_alert.py
sudo systemctl daemon-reload
sudo systemctl start sshudo
sudo systemctl enable sshudo