Update sshrc.sh
This commit is contained in:
parent
5da95034ac
commit
cc61c8a157
17
ssh/sshrc.sh
17
ssh/sshrc.sh
|
@ -1,10 +1,19 @@
|
|||
#!/bin/bash
|
||||
read -d " " ip <<< $SSH_CONNECTION
|
||||
#date=$(date "+%d.%m.%Y %Hh%M")
|
||||
#reverse=$(dig -x $ip +short)
|
||||
|
||||
NAME="xxx"
|
||||
EMAIL="xxx@gmail.com"
|
||||
|
||||
read -d " " ip <<< $PAM_RHOST
|
||||
geo=$(curl -s http://ip.xdty.org -X POST -d "geo=$ip")
|
||||
if [ -z "$geo" ];then
|
||||
geo="unknown"
|
||||
fi
|
||||
ip="$ip($geo)"
|
||||
curl -s https://www.xdty.org/mail.php -X POST -d "event=($USER) login from $ip&name=whatever&email=xxxxx@gmail.com" &
|
||||
|
||||
if [ $PAM_TYPE = "close_session" ];then
|
||||
EVENT="logout"
|
||||
elif [ $PAM_TYPE = "open_session" ];then
|
||||
EVENT="login"
|
||||
fi
|
||||
|
||||
curl -s https://www.xdty.org/mail.php -X POST -d "event=($PAM_USER) $EVENT from $ip&name=$NAME&email=$EMAIL" &
|
||||
|
|
Loading…
Reference in New Issue