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
8017b1b4
Commit
8017b1b4
authored
Nov 17, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决jperm key dir 和 ansible api问题
parent
375a2431
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
14 deletions
+7
-14
ansible_api.py
jperm/ansible_api.py
+2
-3
utils.py
jperm/utils.py
+3
-5
api.py
jumpserver/api.py
+1
-4
settings.py
jumpserver/settings.py
+1
-1
views.py
jumpserver/views.py
+0
-1
No files found.
jperm/ansible_api.py
View file @
8017b1b4
...
...
@@ -19,7 +19,6 @@ API_DIR = os.path.dirname(os.path.abspath(__file__))
ANSIBLE_DIR
=
os
.
path
.
join
(
API_DIR
,
'playbooks'
)
class
AnsibleError
(
StandardError
):
"""
the base AnsibleError which contains error(required),
...
...
@@ -115,7 +114,7 @@ class Command(MyInventory):
super
(
Command
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
results
=
''
def
run
(
self
,
command
,
module_name
=
"command"
,
timeout
=
5
,
forks
=
10
,
group
=
'my_group
'
):
def
run
(
self
,
command
,
module_name
=
"command"
,
timeout
=
5
,
forks
=
10
,
pattern
=
'*
'
):
"""
run command from andible ad-hoc.
command : 必须是一个需要执行的命令字符串, 比如
...
...
@@ -128,7 +127,7 @@ class Command(MyInventory):
module_args
=
command
,
timeout
=
timeout
,
inventory
=
self
.
inventory
,
subset
=
group
,
pattern
=
pattern
,
forks
=
forks
)
self
.
results
=
hoc
.
run
()
...
...
jperm/utils.py
View file @
8017b1b4
...
...
@@ -4,7 +4,7 @@ import random
import
os.path
from
paramiko.rsakey
import
RSAKey
from
os
import
chmod
,
m
kdir
from
os
import
chmod
,
m
akedirs
from
uuid
import
uuid4
from
jumpserver.settings
import
KEY_DIR
...
...
@@ -45,8 +45,8 @@ def gen_keys():
:return: 返回目录名(uuid)
"""
key_basename
=
"key-"
+
uuid4
()
.
hex
key_path_dir
=
os
.
path
.
join
(
KEY_DIR
,
key_basename
)
m
kdir
(
key_path_dir
,
0700
)
key_path_dir
=
os
.
path
.
join
(
KEY_DIR
,
'role_key'
,
key_basename
)
m
akedirs
(
key_path_dir
,
0775
)
key
=
RSAKey
.
generate
(
2048
)
private_key
=
os
.
path
.
join
(
key_path_dir
,
'id_rsa'
)
...
...
@@ -62,8 +62,6 @@ def gen_keys():
return
key_path_dir
if
__name__
==
"__main__"
:
print
gen_keys
()
...
...
jumpserver/api.py
View file @
8017b1b4
...
...
@@ -14,10 +14,8 @@ from django.core.paginator import Paginator, EmptyPage, InvalidPage
from
django.http
import
HttpResponse
,
Http404
from
django.template
import
RequestContext
from
juser.models
import
User
,
UserGroup
from
jlog.models
import
Log
from
jasset.models
import
Asset
,
AssetGroup
# from jlog.models import Log
from
jlog.models
import
Log
,
TtyLog
from
django.core.exceptions
import
ObjectDoesNotExist
,
MultipleObjectsReturned
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
render_to_response
from
django.core.mail
import
send_mail
...
...
@@ -414,4 +412,3 @@ def my_render(template, data, request):
CRYPTOR
=
PyCrypt
(
KEY
)
logger
=
set_log
(
LOG_LEVEL
)
KEY_DIR
=
os
.
path
.
join
(
BASE_DIR
,
'keys'
)
jumpserver/settings.py
View file @
8017b1b4
...
...
@@ -18,7 +18,7 @@ config = ConfigParser.ConfigParser()
BASE_DIR
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)))
config
.
read
(
os
.
path
.
join
(
BASE_DIR
,
'jumpserver.conf'
))
KEY_DIR
=
os
.
path
.
join
(
BASE_DIR
,
'
role_
keys'
)
KEY_DIR
=
os
.
path
.
join
(
BASE_DIR
,
'keys'
)
DB_HOST
=
config
.
get
(
'db'
,
'host'
)
DB_PORT
=
config
.
getint
(
'db'
,
'port'
)
...
...
jumpserver/views.py
View file @
8017b1b4
...
...
@@ -15,7 +15,6 @@ from jumpserver.api import *
from
jumpserver.models
import
Setting
from
django.contrib.auth
import
authenticate
,
login
,
logout
from
django.contrib.auth.decorators
import
login_required
from
settings
import
BASE_DIR
from
jlog.models
import
Log
...
...
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