Update sshrc.sh

This commit is contained in:
tianyu 2014-12-24 12:39:03 +08:00
parent cc61c8a157
commit 18e3c984b3
1 changed files with 4 additions and 13 deletions

View File

@ -1,19 +1,10 @@
#!/bin/bash #!/bin/bash
read -d " " ip <<< $SSH_CONNECTION
NAME="xxx" #date=$(date "+%d.%m.%Y %Hh%M")
EMAIL="xxx@gmail.com" #reverse=$(dig -x $ip +short)
read -d " " ip <<< $PAM_RHOST
geo=$(curl -s http://ip.xdty.org -X POST -d "geo=$ip") geo=$(curl -s http://ip.xdty.org -X POST -d "geo=$ip")
if [ -z "$geo" ];then if [ -z "$geo" ];then
geo="unknown" geo="unknown"
fi fi
ip="$ip($geo)" ip="$ip($geo)"
curl -s https://www.xdty.org/mail.php -X POST -d "event=($USER) login from $ip&name=vps&email=xxx@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" &