Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
d047ff3b
Commit
d047ff3b
authored
Feb 06, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into tree
parents
274cb740
6edd3f6c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
49 additions
and
32 deletions
+49
-32
README.md
README.md
+14
-2
forms.py
apps/assets/forms.py
+2
-2
user.py
apps/assets/models/user.py
+2
-0
serializers.py
apps/assets/serializers.py
+1
-1
tasks.py
apps/assets/tasks.py
+11
-8
asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+5
-5
cluster_assets.html
apps/assets/templates/assets/cluster_assets.html
+5
-5
user_asset_list.html
apps/assets/templates/assets/user_asset_list.html
+3
-6
api.py
apps/common/api.py
+1
-1
forms.py
apps/common/forms.py
+5
-2
django.mo
apps/i18n/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/i18n/zh/LC_MESSAGES/django.po
+0
-0
No files found.
README.md
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
d047ff3b
No preview for this file type
apps/i18n/zh/LC_MESSAGES/django.po
View file @
d047ff3b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment