Get SSH client IP address

pull/42/head
Honghui Ding 2016-01-09 07:37:28 +00:00
parent 2f54c369f7
commit dd36857cf8
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ from jperm.ansible_api import MyRunner
from jlog.models import ExecLog, FileLog
login_user = get_object(User, username=getpass.getuser())
remote_ip = os.popen("who -m | awk '{ print $NF }'").read().strip('()\n')
remote_ip = os.environ.get('SSH_CLIENT').split()[0]
try:
import termios