Browse Source

fix 日志记录名称

pull/26/head
ibuler 9 years ago
parent
commit
c78ab8edf7
  1. 5
      connect.py
  2. 1
      docs/__init__.py
  3. 36
      docs/developer_doc.txt
  4. 9
      docs/initial_data.yaml
  5. 17
      docs/requirements.txt
  6. 13
      docs/zzjumpserver.sh
  7. 3
      run_websocket.py
  8. 3
      templates/jasset/group_list.html
  9. 2
      templates/jlog/log_exec.html
  10. 2
      templates/jlog/log_file.html
  11. 2
      templates/jlog/log_offline.html
  12. 2
      templates/jlog/log_online.html
  13. 2
      templates/juser/change_info.html
  14. 54
      templates/nav_bar_header.html

5
connect.py

@ -498,7 +498,8 @@ class Nav(object):
6) 输入 \033[32mE/e\033[0m 批量执行命令.
7) 输入 \033[32mU/u\033[0m 批量上传文件.
8) 输入 \033[32mD/d\033[0m 批量下载文件.
9) 输入 \033[32mQ/q\033[0m 退出.
9) 输入 \033[32mH/h\033[0m 帮助.
0) 输入 \033[32mQ/q\033[0m 退出.
"""
print textwrap.dedent(msg)
@ -763,6 +764,8 @@ def main():
nav.upload()
elif option in ['D', 'd']:
nav.download()
elif option in ['H', 'h']:
nav.print_nav()
elif option in ['Q', 'q', 'exit']:
sys.exit()
else:

1
docs/__init__.py

@ -1 +0,0 @@
__author__ = 'Hudie'

36
docs/developer_doc.txt

@ -1,36 +0,0 @@
# coding: utf8
Jumpserver开发者文档
开发规范:
1. 遵守PE8规范 1) 命名规范 2) 导入模块规范 3) 空行规范 4) 长度规范
2. 缩进统一4个空格
3. 变量命名明了易懂多个单词下划线隔开
4. 注释到位
框架说明:
1. 项目名称 Jumpserver
2. APP:
juser 用户管理
jasset 资产管理(设备管理)
jpermission 授权管理
jlog 日志管理
3. connect.py 用户登录入口程序
4. logs 日志保存目录
5. jumpserver.conf 配置文件
6. docs 文档目录
7. static 静态文件目录
8. templates 模板目录
connect.py逻辑说明:
用户登录系统,运行该脚本,p调用get_user_host函数查看有权限的服务器ip
输入部分IP,verify_connect匹配该部分ip,如果是匹配到多个,就显示ip
匹配到0了就显示没有权限或者主机,
匹配到1个则继续
查询该服务器是否支持ldap 如果是,获得ldap用户密码登陆
如果否,查询授权表,查看该服务器授权的系统用户,并返回对应账号密码,登陆
connect函数是登陆函数,采用paramiko 使用channel登陆,posix_shell 来完成交互,并记录日志
signal模块来完成窗口改变导致的tty大小随之改变
PyCrypt是对称加密类

9
docs/initial_data.yaml

@ -1,9 +0,0 @@
- model: juser.user
pk: 5000
fields:
username: admin
name: admin
password: pbkdf2_sha256$20000$jBIDGPB2j5JT$orxqGgzzjzykColYm1BswPjgHOiERjZkcgkuVIkD2Hc=
email: admin@jumpserver.org
role: SU
is_active: 1

17
docs/requirements.txt

@ -1,17 +0,0 @@
#sphinx-me==0.3
django==1.6
pycrypto==2.6.1
paramiko==1.16.0
ecdsa==0.13
MySQL-python==1.2.5
#django-uuidfield==0.5.0
psutil==3.3.0
xlsxwriter==0.7.7
xlrd==0.9.4
django-bootstrap-form==3.2
tornado==4.3
ansible==1.9.4
pyinotify==0.9.6
passlib==1.6.5
argparse==1.4.0
django_crontab==0.6.0

13
docs/zzjumpserver.sh

@ -1,13 +0,0 @@
#!/bin/bash
if [ "$USER" == "admin" ] || [ "$USER" == "root" ] || [ "$USER" == "" ];then
echo ""
else
python /opt/jumpserver/connect.py
if [ $USER == 'guanghongwei' ];then
echo
else
exit 3
echo
fi
fi

3
run_websocket.py

@ -361,6 +361,9 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self.log.end_time = datetime.datetime.now()
self.log.save()
self.log_time_f.close()
print "1"
self.ssh.close()
print "2"
self.close()
except AttributeError:
pass

3
templates/jasset/group_list.html

@ -57,11 +57,10 @@
<td class="text-center" name="id" value="{{ asset_group.id }}" data-editable='false'>
<input name="id" value="{{ asset_group.id }}" type="checkbox" class="i-checks">
</td>
<td class="text-center"> {{ asset_group.name }} </td>
<td class="text-center"><a href="{% url 'asset_list' %}?group_id={{ asset_group.id }}">{{ asset_group.name }} </a> </td>
<td class="text-center"> <a href="{% url 'asset_list' %}?group_id={{ asset_group.id }}">{{ asset_group.asset_set.count }}</a> </td>
<td class="text-center"> {{ asset_group.comment }} </td>
<td class="text-center">
<a href="{% url 'asset_list' %}?group_id={{ asset_group.id }}" class="btn btn-xs btn-info">详情</a>
<a href="{% url 'asset_group_edit' %}?id={{ asset_group.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="{% url 'asset_group_del' %}?id={{ asset_group.id }}" class="btn btn-xs btn-danger group_del">删除</a>
</td>

2
templates/jlog/log_exec.html

@ -30,7 +30,7 @@
<div class="panel-options">
<ul class="nav nav-tabs">
<li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 登录历史</a></li>
<li class="active"><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
<div class="" style="float: right">

2
templates/jlog/log_file.html

@ -30,7 +30,7 @@
<div class="panel-options">
<ul class="nav nav-tabs">
<li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 登录历史</a></li>
<li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li class="active"><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
<div class="" style="float: right">

2
templates/jlog/log_offline.html

@ -53,7 +53,7 @@
<div class="panel-options">
<ul class="nav nav-tabs">
<li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li class="active"><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li class="active"><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 登录历史</a></li>
<li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
</ul>

2
templates/jlog/log_online.html

@ -68,7 +68,7 @@
<div class="panel-options">
<ul class="nav nav-tabs">
<li class="active"><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 登录历史</a></li>
<li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
<div class="" style="float: right">

2
templates/juser/change_info.html

@ -52,7 +52,7 @@
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="ssh_key_pwd" class="col-sm-2 control-label">SSH密钥</label>
<div class="col-sm-8">
<div class="col-sm-8" style="border: none">
<a value="{% url 'key_gen' %}?uuid={{ user.uuid }}" id="regen_ssh_key" class="form-control"> 重新生成</a>
<span class="help-block m-b-none">
重新生成密钥,需要重新下载并导入

54
templates/nav_bar_header.html

@ -15,61 +15,9 @@
</li>
<li class="dropdown">
<a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
<i class="fa fa-envelope"></i> <span class="label label-warning">{{ apply_info.count }}</span>
<span class="m-r-sm text-muted welcome-message">帮助</span>
</a>
<ul class="dropdown-menu dropdown-messages">
{% if apply_info %}
{% for apply in apply_info %}
<li>
<div class="dropdown-messages-box">
<a href="" class="pull-left">
<img alt="image" class="img-circle" src="/static/img/a4.jpg">
</a>
<div class="media-body">
{# <small class="pull-right text-navy">{{ apply.date_add|naturaltime }}</small>#}
{# <strong>{{ apply.applyer }}</strong><br>#}
{# <small class="text-muted">主机组: {{ apply.bisgroup|ast_to_list }}</small><br/>#}
{# <small class="text-muted">主机: {{ apply.asset|ast_to_list }}</small><br/>#}
{# <small class="text-muted">申请时间: {{ apply.date_add|date:"Y-m-d H:i:s" }}</small>#}
</div>
</div>
</li>
<li class="divider"></li>
{% endfor %}
<li>
<div class="text-center link-block">
<a href="">
<i class="fa fa-envelope"></i> <strong>Read All Messages</strong>
</a>
</div>
</li>
{% else %}
<li>
<div class="text-center link-block">
<i class="fa fa-envelope"></i> <strong>(暂无申请)</strong>
</div>
</li>
{% endif %}
</ul>
</li>
{# <li class="dropdown open">#}
{# <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" aria-expanded="true">#}
{# <i class="fa fa-bell"></i> <span class="label label-primary">0</span>#}
{# </a>#}
{# <ul class="dropdown-menu dropdown-alerts">#}
{# <li>#}
{# <a href="mailbox.html">#}
{# <div>#}
{# <i class="fa fa-envelope"></i> <strong>(暂无告警)</strong>#}
{# <i class="fa fa-envelope fa-fw"></i> You have 16 messages#}
{# <span class="pull-right text-muted small">4 minutes ago</span>#}
{# </div>#}
{# </a>#}
{# </li>#}
{# <li class="divider"></li>#}
{##}
{# </ul>#}
{# </li>#}
<li>
<a href="{% url 'logout' %}">
<i class="fa fa-sign-out"></i> Log out

Loading…
Cancel
Save