Move ssh notification code into its own plugin file

This commit is contained in:
Eric Torres 2022-05-25 17:14:11 -07:00
parent 565f6b204b
commit 6bdfa82dfa
2 changed files with 8 additions and 8 deletions

View File

@ -1,9 +1 @@
emulate sh -c 'source /etc/profile'
# Notify on ssh login
IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
HOSTNAME=$(hostname)
NOW=$(date +"%e %b %Y, %a %r")
EMAIL='erictorres4@protonmail.com'
echo "Login from ${IP} on ${HOSTNAME} on ${NOW}" | neomutt -s 'SSH Login Notification' "${EMAIL}" 2>/dev/null

View File

@ -0,0 +1,8 @@
# Notify on ssh login
if [[ -n $SSH_CONNECTION ]]; then
IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
HOSTNAME=$(hostname)
NOW=$(date +"%e %b %Y, %a %r")
EMAIL='erictorres4@pm.me'
echo "Login from ${IP} on ${HOSTNAME} on ${NOW}" | neomutt -s 'SSH Login Notification' "${EMAIL}" 2>/dev/null
fi