Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
d047ff3b
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d047ff3b
编写于
2月 06, 2018
作者:
baltery
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into tree
上级
274cb740
6edd3f6c
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
295 addition
and
281 deletion
+295
-281
README.md
README.md
+14
-2
apps/assets/forms.py
apps/assets/forms.py
+2
-2
apps/assets/models/user.py
apps/assets/models/user.py
+2
-0
apps/assets/serializers.py
apps/assets/serializers.py
+1
-1
apps/assets/tasks.py
apps/assets/tasks.py
+11
-8
apps/assets/templates/assets/asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+5
-5
apps/assets/templates/assets/cluster_assets.html
apps/assets/templates/assets/cluster_assets.html
+5
-5
apps/assets/templates/assets/user_asset_list.html
apps/assets/templates/assets/user_asset_list.html
+3
-6
apps/common/api.py
apps/common/api.py
+1
-1
apps/common/forms.py
apps/common/forms.py
+5
-2
apps/i18n/zh/LC_MESSAGES/django.mo
apps/i18n/zh/LC_MESSAGES/django.mo
+0
-0
apps/i18n/zh/LC_MESSAGES/django.po
apps/i18n/zh/LC_MESSAGES/django.po
+246
-249
未找到文件。
README.md
浏览文件 @
d047ff3b
...
...
@@ -24,9 +24,16 @@ Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互
*
Python 3.6
*
Django 1.11
###
Install 安装
###
快速启动
[
详细安装
](
https://github.com/jumpserver/jumpserver/wiki/v0.5.0-%E5%9F%BA%E4%BA%8E-CentOS7
)
```
$ docker run -p 8080:80 -p 2222:2222 jumpserver/jumpserver:0.5.0-beta2
```
更多见
[
Dockerfile
](
https://github.com/jumpserver/Dockerfile.git
)
### 详细安装步骤
[
文档
](
https://github.com/jumpserver/jumpserver/wiki/v0.5.0-%E5%9F%BA%E4%BA%8E-CentOS7
)
### Usage 使用
...
...
@@ -70,6 +77,11 @@ demo使用了开发者模式,并发只能为1
参见 https://github.com/jumpserver/jumpserver/milestone/2
### SDK
-
python: https://github.com/jumpserver/jumpserver-python-sdk
-
java: https://github.com/KaiJunYan/jumpserver-java-sdk.git
### Docs 开发者文档
...
...
apps/assets/forms.py
浏览文件 @
d047ff3b
...
...
@@ -127,7 +127,7 @@ class AssetBulkUpdateForm(forms.ModelForm):
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)}
),
'labels'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select lab
le
s'
)}
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select lab
el
s'
)}
),
}
...
...
@@ -308,7 +308,7 @@ class SystemUserForm(PasswordAndKeyAuthForm):
auto_generate_key
=
self
.
cleaned_data
.
get
(
'auto_generate_key'
,
False
)
private_key
,
public_key
=
super
().
gen_keys
()
if
not
self
.
instance
and
auto_generate_key
:
if
auto_generate_key
:
logger
.
info
(
'Auto generate key and set system user auth'
)
system_user
.
auto_gen_auth
()
else
:
...
...
apps/assets/models/user.py
浏览文件 @
d047ff3b
...
...
@@ -212,8 +212,10 @@ class AdminUser(AssetUser):
class
SystemUser
(
AssetUser
):
SSH_PROTOCOL
=
'ssh'
RDP_PROTOCOL
=
'rdp'
PROTOCOL_CHOICES
=
(
(
SSH_PROTOCOL
,
'ssh'
),
(
RDP_PROTOCOL
,
'rdp'
),
)
cluster
=
models
.
ManyToManyField
(
'assets.Cluster'
,
blank
=
True
,
verbose_name
=
_
(
"Cluster"
))
...
...
apps/assets/serializers.py
浏览文件 @
d047ff3b
...
...
@@ -297,7 +297,7 @@ class LabelSerializer(serializers.ModelSerializer):
@
staticmethod
def
get_asset_count
(
obj
):
return
obj
.
asset
_count
return
obj
.
asset
s
.
count
()
def
get_field_names
(
self
,
declared_fields
,
info
):
fields
=
super
().
get_field_names
(
declared_fields
,
info
)
...
...
apps/assets/tasks.py
浏览文件 @
d047ff3b
...
...
@@ -314,8 +314,10 @@ def get_push_system_user_tasks(system_user):
if
system_user
.
username
==
"root"
:
return
[]
tasks
=
[
{
tasks
=
[]
if
system_user
.
password
:
tasks
.
append
({
'name'
:
'Add user {}'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'user'
,
...
...
@@ -324,8 +326,9 @@ def get_push_system_user_tasks(system_user):
encrypt_password
(
system_user
.
password
,
salt
=
"K3mIlKK"
),
),
}
},
{
})
if
system_user
.
public_key
:
tasks
.
append
({
'name'
:
'Set {} authorized key'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'authorized_key'
,
...
...
@@ -333,8 +336,9 @@ def get_push_system_user_tasks(system_user):
system_user
.
username
,
system_user
.
public_key
)
}
},
{
})
if
system_user
.
sudo
:
tasks
.
append
({
'name'
:
'Set {} sudo setting'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'lineinfile'
,
...
...
@@ -345,8 +349,7 @@ def get_push_system_user_tasks(system_user):
system_user
.
sudo
,
)
}
}
]
})
return
tasks
...
...
apps/assets/templates/assets/asset_group_detail.html
浏览文件 @
d047ff3b
...
...
@@ -50,7 +50,6 @@
<th>
{% trans 'Hostname' %}
</th>
<th>
{% trans 'IP' %}
</th>
<th>
{% trans 'Port' %}
</th>
<th>
{% trans 'Type' %}
</th>
<th>
{% trans 'Alive' %}
</th>
<th>
{% trans 'Action' %}
</th>
</tr>
...
...
@@ -166,22 +165,23 @@ function initTable() {
var
detail_btn
=
'
<a href="{% url "assets:asset-detail" pk=DEFAULT_PK %}" data-aid="
'
+
rowData
.
id
+
'
">
'
+
cellData
+
'
</a>
'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'
{{ DEFAULT_PK }}
'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
3
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'
<i class="fa fa-times text-danger"></i>
'
)
}
else
{
$
(
td
).
html
(
'
<i class="fa fa-check text-navy"></i>
'
)
}
}},
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'
<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>
'
.
replace
(
'
{{ DEFAULT_PK }}
'
,
rowData
.
id
);
var
del_btn
=
'
<a class="btn btn-xs btn-danger m-l-xs btn-leave-group" data-aid="{{ DEFAULT_PK }}">{% trans "Remove" %}</a>
'
.
replace
(
'
{{ DEFAULT_PK }}
'
,
rowData
.
id
);
$
(
td
).
html
(
update_btn
+
del_btn
)
}}
],
ajax_url
:
'
{% url "api-assets:asset-list" %}?asset_group_id={{ asset_group.id }}
'
,
columns
:
[{
data
:
"
hostname
"
},
{
data
:
"
ip
"
},
{
data
:
"
port
"
},
{
data
:
"
get_type_display
"
},
{
data
:
"
is_connective
"
},
{
data
:
"
id
"
}],
columns
:
[
{
data
:
"
hostname
"
},
{
data
:
"
ip
"
},
{
data
:
"
port
"
},
{
data
:
"
is_connective
"
},
{
data
:
"
id
"
}],
op_html
:
$
(
'
#actions
'
).
html
()
};
jumpserver
.
initServerSideDataTable
(
options
);
...
...
apps/assets/templates/assets/cluster_assets.html
浏览文件 @
d047ff3b
...
...
@@ -51,7 +51,6 @@
<th>
{% trans 'Hostname' %}
</th>
<th>
{% trans 'IP' %}
</th>
<th>
{% trans 'Port' %}
</th>
<th>
{% trans 'Type' %}
</th>
<th>
{% trans 'Alive' %}
</th>
<th>
{% trans 'Action' %}
</th>
</tr>
...
...
@@ -159,21 +158,22 @@ function initTable() {
var
detail_btn
=
'
<a href="{% url "assets:asset-detail" pk=DEFAULT_PK %}" data-aid="
'
+
rowData
.
id
+
'
">
'
+
cellData
+
'
</a>
'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'
{{ DEFAULT_PK }}
'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
3
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'
<i class="fa fa-times text-danger"></i>
'
)
}
else
{
$
(
td
).
html
(
'
<i class="fa fa-check text-navy"></i>
'
)
}
}},
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'
<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>
'
.
replace
(
'
{{ DEFAULT_PK }}
'
,
rowData
.
id
);
$
(
td
).
html
(
update_btn
)
}}
],
ajax_url
:
'
{% url "api-assets:asset-list" %}?cluster_id={{ cluster.id }}
'
,
columns
:
[{
data
:
"
hostname
"
},
{
data
:
"
ip
"
},
{
data
:
"
port
"
},
{
data
:
"
get_type_display
"
},
{
data
:
"
is_connective
"
},
{
data
:
"
id
"
}],
columns
:
[
{
data
:
"
hostname
"
},
{
data
:
"
ip
"
},
{
data
:
"
port
"
},
{
data
:
"
is_connective
"
},
{
data
:
"
id
"
}],
op_html
:
$
(
'
#actions
'
).
html
()
};
jumpserver
.
initServerSideDataTable
(
options
);
...
...
apps/assets/templates/assets/user_asset_list.html
浏览文件 @
d047ff3b
...
...
@@ -19,8 +19,6 @@
<th
class=
"text-center"
>
{% trans 'Hostname' %}
</th>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'Port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Type' %}
</th>
<th
class=
"text-center"
>
{% trans 'Env' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hardware' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Connective' %}
</th>
...
...
@@ -44,14 +42,14 @@ function initTable() {
var
detail_btn
=
'
<a href="{{ the_url }}">
'
+
cellData
+
'
</a>
'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'
{{ DEFAULT_PK }}
'
,
rowData
.
id
));
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'
<i class="fa fa-times text-danger"></i>
'
)
}
else
{
$
(
td
).
html
(
'
<i class="fa fa-check text-navy"></i>
'
)
}
}},
{
targets
:
8
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
==
'
Unknown
'
){
$
(
td
).
html
(
'
<i class="fa fa-circle text-warning"></i>
'
)
}
else
if
(
!
cellData
)
{
...
...
@@ -68,8 +66,7 @@ function initTable() {
ajax_url
:
'
{% url "api-assets:user-asset-list" %}
'
,
columns
:
[
{
data
:
"
id
"
},
{
data
:
"
hostname
"
},
{
data
:
"
ip
"
},
{
data
:
"
port
"
},
{
data
:
"
get_type_display
"
},
{
data
:
"
get_env_display
"
},
{
data
:
"
hardware_info
"
},
{
data
:
"
is_active
"
},
{
data
:
"
is_connective
"
}
{
data
:
"
hardware_info
"
},
{
data
:
"
is_active
"
},
{
data
:
"
is_connective
"
}
],
op_html
:
$
(
'
#actions
'
).
html
()
};
...
...
apps/common/api.py
浏览文件 @
d047ff3b
...
...
@@ -88,7 +88,7 @@ class LDAPTestingAPI(APIView):
user
[
attr
]
=
getattr
(
entry
,
mapping
)
users
.
append
(
user
)
if
len
(
users
)
>
0
:
return
Response
({
"msg"
:
"Match {} s users"
.
format
(
len
(
users
))})
return
Response
({
"msg"
:
_
(
"Match {} s users"
)
.
format
(
len
(
users
))})
else
:
return
Response
({
"error"
:
"Have user but attr mapping error"
},
status
=
401
)
else
:
...
...
apps/common/forms.py
浏览文件 @
d047ff3b
...
...
@@ -117,7 +117,8 @@ class LDAPSettingForm(BaseForm):
label
=
_
(
"User OU"
),
initial
=
'ou=tech,dc=jumpserver,dc=org'
)
AUTH_LDAP_SEARCH_FILTER
=
forms
.
CharField
(
label
=
_
(
"User search filter"
),
initial
=
'(cn=%(user)s)'
label
=
_
(
"User search filter"
),
initial
=
'(cn=%(user)s)'
,
help_text
=
_
(
"User search filter must contain ([cn,uid,sAMAccountName,...]=%(user)s)"
)
)
AUTH_LDAP_USER_ATTR_MAP
=
DictField
(
label
=
_
(
"User attr map"
),
...
...
@@ -125,13 +126,15 @@ class LDAPSettingForm(BaseForm):
"username"
:
"cn"
,
"name"
:
"sn"
,
"email"
:
"mail"
})
}),
help_text
=
_
(
"User attr map present how to map LDAP user attr to jumpserver, username,name,email is jumpserver attr"
)
)
# AUTH_LDAP_GROUP_SEARCH_OU = CONFIG.AUTH_LDAP_GROUP_SEARCH_OU
# AUTH_LDAP_GROUP_SEARCH_FILTER = CONFIG.AUTH_LDAP_GROUP_SEARCH_FILTER
AUTH_LDAP_START_TLS
=
forms
.
BooleanField
(
label
=
_
(
"Use SSL"
),
initial
=
False
,
required
=
False
)
AUTH_LDAP
=
forms
.
BooleanField
(
label
=
_
(
"Enable LDAP auth"
),
initial
=
False
)
class
TerminalSettingForm
(
BaseForm
):
...
...
apps/i18n/zh/LC_MESSAGES/django.mo
浏览文件 @
d047ff3b
无法预览此类型文件
apps/i18n/zh/LC_MESSAGES/django.po
浏览文件 @
d047ff3b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录