mirror of https://github.com/jumpserver/jumpserver
				
				
				
			[Update] session添加登陆ip
							parent
							
								
									1888c698f1
								
							
						
					
					
						commit
						9a6bc9fec5
					
				
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -8,7 +8,7 @@ msgid ""
 | 
			
		|||
msgstr ""
 | 
			
		||||
"Project-Id-Version: Jumpserver 0.3.3\n"
 | 
			
		||||
"Report-Msgid-Bugs-To: \n"
 | 
			
		||||
"POT-Creation-Date: 2018-01-05 17:27+0800\n"
 | 
			
		||||
"POT-Creation-Date: 2018-01-05 18:18+0800\n"
 | 
			
		||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 | 
			
		||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
 | 
			
		||||
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ msgstr "选择的系统用户将会在该集群资产上创建"
 | 
			
		|||
#: perms/templates/perms/asset_permission_detail.html:62
 | 
			
		||||
#: perms/templates/perms/asset_permission_list.html:25
 | 
			
		||||
#: perms/templates/perms/asset_permission_user.html:54 terminal/models.py:14
 | 
			
		||||
#: terminal/models.py:117 terminal/templates/terminal/terminal_detail.html:43
 | 
			
		||||
#: terminal/models.py:118 terminal/templates/terminal/terminal_detail.html:43
 | 
			
		||||
#: terminal/templates/terminal/terminal_list.html:29 users/models/group.py:14
 | 
			
		||||
#: users/models/user.py:36 users/templates/users/_select_user_modal.html:13
 | 
			
		||||
#: users/templates/users/user_detail.html:62
 | 
			
		||||
| 
						 | 
				
			
			@ -811,7 +811,7 @@ msgstr "比例"
 | 
			
		|||
#: ops/templates/ops/adhoc_history.html:59 ops/templates/ops/task_adhoc.html:61
 | 
			
		||||
#: ops/templates/ops/task_history.html:62 ops/templates/ops/task_list.html:41
 | 
			
		||||
#: perms/templates/perms/asset_permission_list.html:32
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:78
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:79
 | 
			
		||||
#: terminal/templates/terminal/terminal_list.html:36
 | 
			
		||||
#: users/templates/users/user_group_list.html:15
 | 
			
		||||
#: users/templates/users/user_list.html:28
 | 
			
		||||
| 
						 | 
				
			
			@ -1418,8 +1418,8 @@ msgstr "执行历史"
 | 
			
		|||
 | 
			
		||||
#: ops/templates/ops/adhoc_history.html:52
 | 
			
		||||
#: ops/templates/ops/adhoc_history_detail.html:58
 | 
			
		||||
#: ops/templates/ops/task_history.html:55 terminal/models.py:100
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:76
 | 
			
		||||
#: ops/templates/ops/task_history.html:55 terminal/models.py:101
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:77
 | 
			
		||||
msgid "Date start"
 | 
			
		||||
msgstr "开始日期"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1480,6 +1480,7 @@ msgstr "版本"
 | 
			
		|||
 | 
			
		||||
#: ops/templates/ops/task_adhoc.html:60
 | 
			
		||||
#: terminal/templates/terminal/command_list.html:76
 | 
			
		||||
#: terminal/templates/terminal/session_detail.html:50
 | 
			
		||||
msgid "Datetime"
 | 
			
		||||
msgstr "日期"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1782,8 +1783,8 @@ msgid "Close"
 | 
			
		|||
msgstr "关闭"
 | 
			
		||||
 | 
			
		||||
#: templates/_nav.html:9 users/views/group.py:30 users/views/group.py:46
 | 
			
		||||
#: users/views/group.py:72 users/views/group.py:89 users/views/login.py:192
 | 
			
		||||
#: users/views/login.py:241 users/views/user.py:55 users/views/user.py:70
 | 
			
		||||
#: users/views/group.py:72 users/views/group.py:89 users/views/login.py:193
 | 
			
		||||
#: users/views/login.py:242 users/views/user.py:55 users/views/user.py:70
 | 
			
		||||
#: users/views/user.py:95 users/views/user.py:151 users/views/user.py:308
 | 
			
		||||
#: users/views/user.py:322 users/views/user.py:366 users/views/user.py:388
 | 
			
		||||
msgid "Users"
 | 
			
		||||
| 
						 | 
				
			
			@ -1806,7 +1807,7 @@ msgid "Task"
 | 
			
		|||
msgstr "任务"
 | 
			
		||||
 | 
			
		||||
#: templates/_nav.html:47 templates/_nav.html:50
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:74
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:75
 | 
			
		||||
#: terminal/views/command.py:47 terminal/views/session.py:75
 | 
			
		||||
#: terminal/views/session.py:92 terminal/views/session.py:114
 | 
			
		||||
#: terminal/views/terminal.py:31 terminal/views/terminal.py:46
 | 
			
		||||
| 
						 | 
				
			
			@ -1822,10 +1823,11 @@ msgstr "在线会话"
 | 
			
		|||
msgid "Session offline"
 | 
			
		||||
msgstr "离线会话"
 | 
			
		||||
 | 
			
		||||
#: templates/_nav.html:53 terminal/models.py:98
 | 
			
		||||
#: templates/_nav.html:53 terminal/models.py:99
 | 
			
		||||
#: terminal/templates/terminal/command_list.html:55
 | 
			
		||||
#: terminal/templates/terminal/command_list.html:71
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:75
 | 
			
		||||
#: terminal/templates/terminal/session_detail.html:48
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:76
 | 
			
		||||
msgid "Command"
 | 
			
		||||
msgstr "命令"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1858,11 +1860,11 @@ msgstr "输出"
 | 
			
		|||
msgid "Session"
 | 
			
		||||
msgstr "会话"
 | 
			
		||||
 | 
			
		||||
#: terminal/forms.py:16
 | 
			
		||||
#: terminal/forms.py:15
 | 
			
		||||
msgid "Coco ssh listen port"
 | 
			
		||||
msgstr "SSH 监听端口"
 | 
			
		||||
 | 
			
		||||
#: terminal/forms.py:17
 | 
			
		||||
#: terminal/forms.py:16
 | 
			
		||||
msgid "Coco http/ws listen port"
 | 
			
		||||
msgstr "Http/Websocket 监听端口"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1902,15 +1904,19 @@ msgstr "线程数"
 | 
			
		|||
msgid "Boot Time"
 | 
			
		||||
msgstr "运行时间"
 | 
			
		||||
 | 
			
		||||
#: terminal/models.py:97 terminal/templates/terminal/session_list.html:98
 | 
			
		||||
#: terminal/models.py:96 terminal/templates/terminal/session_list.html:74
 | 
			
		||||
msgid "Remote addr"
 | 
			
		||||
msgstr "远端地址"
 | 
			
		||||
 | 
			
		||||
#: terminal/models.py:98 terminal/templates/terminal/session_list.html:100
 | 
			
		||||
msgid "Replay"
 | 
			
		||||
msgstr "回放"
 | 
			
		||||
 | 
			
		||||
#: terminal/models.py:101
 | 
			
		||||
#: terminal/models.py:102
 | 
			
		||||
msgid "Date end"
 | 
			
		||||
msgstr "结束日期"
 | 
			
		||||
 | 
			
		||||
#: terminal/models.py:118
 | 
			
		||||
#: terminal/models.py:119
 | 
			
		||||
msgid "Args"
 | 
			
		||||
msgstr "参数"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1949,19 +1955,19 @@ msgstr "监控"
 | 
			
		|||
msgid "Terminate session"
 | 
			
		||||
msgstr "终止会话"
 | 
			
		||||
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:77
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:78
 | 
			
		||||
msgid "Duration"
 | 
			
		||||
msgstr "时长"
 | 
			
		||||
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:100
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:102
 | 
			
		||||
msgid "Monitor"
 | 
			
		||||
msgstr "监控"
 | 
			
		||||
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:101
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:103
 | 
			
		||||
msgid "Terminate"
 | 
			
		||||
msgstr "终断"
 | 
			
		||||
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:117
 | 
			
		||||
#: terminal/templates/terminal/session_list.html:119
 | 
			
		||||
msgid "Terminate task send, waiting ..."
 | 
			
		||||
msgstr "终断任务已发送,请等待"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1970,10 +1976,6 @@ msgstr "终断任务已发送,请等待"
 | 
			
		|||
msgid "Terminal detail"
 | 
			
		||||
msgstr "终端详情"
 | 
			
		||||
 | 
			
		||||
#: terminal/templates/terminal/terminal_detail.html:47
 | 
			
		||||
msgid "Remote address"
 | 
			
		||||
msgstr "远端地址"
 | 
			
		||||
 | 
			
		||||
#: terminal/templates/terminal/terminal_detail.html:51
 | 
			
		||||
#: terminal/templates/terminal/terminal_list.html:31
 | 
			
		||||
msgid "SSH port"
 | 
			
		||||
| 
						 | 
				
			
			@ -2611,40 +2613,40 @@ msgstr "退出登录成功"
 | 
			
		|||
msgid "Logout success, return login page"
 | 
			
		||||
msgstr "退出登录成功,返回到登录页面"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:99
 | 
			
		||||
#: users/views/login.py:100
 | 
			
		||||
msgid "Email address invalid, please input again"
 | 
			
		||||
msgstr "邮箱地址错误,重新输入"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:112
 | 
			
		||||
#: users/views/login.py:113
 | 
			
		||||
msgid "Send reset password message"
 | 
			
		||||
msgstr "发送重置密码邮件"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:113
 | 
			
		||||
#: users/views/login.py:114
 | 
			
		||||
msgid "Send reset password mail success, login your mail box and follow it "
 | 
			
		||||
msgstr ""
 | 
			
		||||
"发送重置邮件成功, 请登录邮箱查看, 按照提示操作 (如果没收到,请等待3-5分钟)"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:127
 | 
			
		||||
#: users/views/login.py:128
 | 
			
		||||
msgid "Reset password success"
 | 
			
		||||
msgstr "重置密码成功"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:128
 | 
			
		||||
#: users/views/login.py:129
 | 
			
		||||
msgid "Reset password success, return to login page"
 | 
			
		||||
msgstr "重置密码成功,返回到登录页面"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:145 users/views/login.py:158
 | 
			
		||||
#: users/views/login.py:146 users/views/login.py:159
 | 
			
		||||
msgid "Token invalid or expired"
 | 
			
		||||
msgstr "Token错误或失效"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:154
 | 
			
		||||
#: users/views/login.py:155
 | 
			
		||||
msgid "Password not same"
 | 
			
		||||
msgstr "密码不一致"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:192
 | 
			
		||||
#: users/views/login.py:193
 | 
			
		||||
msgid "First login"
 | 
			
		||||
msgstr "首次登陆"
 | 
			
		||||
 | 
			
		||||
#: users/views/login.py:242
 | 
			
		||||
#: users/views/login.py:243
 | 
			
		||||
msgid "Login log list"
 | 
			
		||||
msgstr "登录日志"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,7 +110,6 @@ class StatusViewSet(viewsets.ModelViewSet):
 | 
			
		|||
 | 
			
		||||
    def handle_sessions(self):
 | 
			
		||||
        sessions_active = []
 | 
			
		||||
 | 
			
		||||
        for session_data in self.request.data.get("sessions", []):
 | 
			
		||||
            self.create_or_update_session(session_data)
 | 
			
		||||
            if not session_data["is_finished"]:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,6 +93,7 @@ class Session(models.Model):
 | 
			
		|||
    asset = models.CharField(max_length=1024, verbose_name=_("Asset"))
 | 
			
		||||
    system_user = models.CharField(max_length=128, verbose_name=_("System user"))
 | 
			
		||||
    login_from = models.CharField(max_length=2, choices=LOGIN_FROM_CHOICES, default="ST")
 | 
			
		||||
    remote_addr = models.CharField(max_length=15, verbose_name=_("Remote addr"), blank=True, null=True)
 | 
			
		||||
    is_finished = models.BooleanField(default=False)
 | 
			
		||||
    has_replay = models.BooleanField(default=False, verbose_name=_("Replay"))
 | 
			
		||||
    has_command = models.BooleanField(default=False, verbose_name=_("Command"))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,6 +71,7 @@
 | 
			
		|||
    <th class="text-center">{% trans 'User' %}</th>
 | 
			
		||||
    <th class="text-center">{% trans 'Asset' %}</th>
 | 
			
		||||
    <th class="text-center">{% trans 'System user' %}</th>
 | 
			
		||||
    <th class="text-center">{% trans 'Remote addr' %}</th>
 | 
			
		||||
    <th class="text-center">{% trans 'Terminal' %}</th>
 | 
			
		||||
    <th class="text-center">{% trans 'Command' %}</th>
 | 
			
		||||
    <th class="text-center">{% trans 'Date start' %}</th>
 | 
			
		||||
| 
						 | 
				
			
			@ -88,6 +89,7 @@
 | 
			
		|||
            <td class="text-center">{{ session.user }}</td>
 | 
			
		||||
            <td class="text-center">{{ session.asset }}</td>
 | 
			
		||||
            <td class="text-center">{{ session.system_user }}</td>
 | 
			
		||||
            <td class="text-center">{{ session.remote_addr|default:"" }}</td>
 | 
			
		||||
            <td class="text-center">{{ session.terminal.name }}</td>
 | 
			
		||||
            <td class="text-center">{{ session.id | get_session_command_amount }}</td>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@
 | 
			
		|||
                                            <td><b>{{ terminal.name }}</b></td>
 | 
			
		||||
                                        </tr>
 | 
			
		||||
                                        <tr>
 | 
			
		||||
                                            <td>{% trans 'Remote address' %}:</td>
 | 
			
		||||
                                            <td>{% trans 'Remote addr' %}:</td>
 | 
			
		||||
                                            <td><b>{{ terminal.remote_addr }}</b></td>
 | 
			
		||||
                                        </tr>
 | 
			
		||||
                                        <tr>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -128,7 +128,7 @@ class UserAuthApi(APIView):
 | 
			
		|||
        user_agent = request.data.get('HTTP_USER_AGENT', '')
 | 
			
		||||
 | 
			
		||||
        if not login_ip:
 | 
			
		||||
            login_ip = request.META.get("REMOTE_ADDR")
 | 
			
		||||
            login_ip = request.META.get('HTTP_X_REAL_IP') or request.META.get("REMOTE_ADDR")
 | 
			
		||||
 | 
			
		||||
        user, msg = check_user_valid(
 | 
			
		||||
            username=username, password=password,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue