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
216163f4
Commit
216163f4
authored
Sep 25, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stash
parent
d3e9c8c9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
12 deletions
+113
-12
config_example.py
config_example.py
+0
-0
__init__.py
terminal/__init__.py
+0
-0
config_example.py
terminal/config_example.py
+93
-0
.gitkeep
terminal/logs/.gitkeep
+0
-0
ssh_server.py
terminal/ssh_server.py
+5
-12
utils.py
terminal/utils.py
+8
-0
web_server.py
terminal/web_server.py
+7
-0
No files found.
config
-
example.py
→
config
_
example.py
View file @
216163f4
File moved
ssh_server
/__init__.py
→
terminal
/__init__.py
View file @
216163f4
File moved
terminal/config_example.py
0 → 100644
View file @
216163f4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import
logging
import
os
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__name__
))
LOG_LEVEL_CHOICES
=
{
'debug'
:
logging
.
DEBUG
,
'info'
:
logging
.
INFO
,
'warning'
:
logging
.
WARNING
,
'error'
:
logging
.
ERROR
,
'critical'
:
logging
.
CRITICAL
}
class
Config
:
LOG_LEVEL
=
''
LOG_DIR
=
os
.
path
.
join
(
BASE_DIR
,
'logs'
)
LOGGING
=
{
'version'
:
1
,
'formatters'
:
{
'verbose'
:
{
'format'
:
'
%(levelname)
s
%(asctime)
s
%(module)
s
%(process)
d
%(thread)
d
%(message)
s'
},
'main'
:
{
'datefmt'
:
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
'format'
:
'
%(asctime)
s [
%(module)
s
%(levelname)
s]
%(message)
s'
,
},
'simple'
:
{
'format'
:
'
%(levelname)
s
%(message)
s'
},
},
'handlers'
:
{
'null'
:
{
'level'
:
'DEBUG'
,
'class'
:
'logging.NullHandler'
,
},
'console'
:
{
'level'
:
'DEBUG'
,
'class'
:
'logging.StreamHandler'
,
'formatter'
:
'main'
},
'file'
:
{
'level'
:
'DEBUG'
,
'class'
:
'logging.FileHandler'
,
'formatter'
:
'main'
,
'filename'
:
os
.
path
.
join
(
PROJECT_DIR
,
'logs'
,
'jumpserver.log'
)
},
},
'loggers'
:
{
'django'
:
{
'handlers'
:
[
'null'
],
'propagate'
:
False
,
'level'
:
LOG_LEVEL
,
},
'django.request'
:
{
'handlers'
:
[
'console'
,
'file'
],
'level'
:
LOG_LEVEL
,
'propagate'
:
False
,
},
'django.server'
:
{
'handlers'
:
[
'console'
,
'file'
],
'level'
:
LOG_LEVEL
,
'propagate'
:
False
,
},
'jumpserver'
:
{
'handlers'
:
[
'console'
,
'file'
],
'level'
:
LOG_LEVEL
,
},
'jumpserver.users.api'
:
{
'handlers'
:
[
'console'
,
'file'
],
'level'
:
LOG_LEVEL
,
},
'jumpserver.users.view'
:
{
'handlers'
:
[
'console'
,
'file'
],
'level'
:
LOG_LEVEL
,
}
}
}
def
__init__
(
self
):
pass
def
__getattr__
(
self
,
item
):
return
None
if
__name__
==
'__main__'
:
pass
terminal/logs/.gitkeep
0 → 100644
View file @
216163f4
ssh_server/
server.py
→
terminal/ssh_
server.py
View file @
216163f4
...
...
@@ -37,14 +37,7 @@ from users.utils import ssh_key_gen, check_user_is_valid
logger
=
get_logger
(
__name__
)
class
SSHService
(
paramiko
.
ServerInterface
):
# data = (b'AAAAB3NzaC1yc2EAAAABIwAAAIEAyO4it3fHlmGZWJaGrfeHOVY7RWO3P9M7hp'
# b'fAu7jJ2d7eothvfeuoRFtJwhUmZDluRdFyhFY/hFAh76PJKGAusIqIQKlkJxMC'
# b'KDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iT'
# b'UWT10hcuO4Ks8=')
# good_pub_key = paramiko.RSAKey(data=decodebytes(data))
# host_key = paramiko.RSAKey(filename='test_rsa.key')
class
SSHServerInterface
(
paramiko
.
ServerInterface
):
host_key_path
=
os
.
path
.
join
(
BASE_DIR
,
'host_rsa_key'
)
def
__init__
(
self
):
...
...
@@ -138,10 +131,10 @@ class SSHServer:
logger
.
warning
(
'(Failed to load moduli -- gex will be unsupported.)'
)
raise
transport
.
add_server_key
(
SSHServ
i
ce
.
get_host_key
())
s
ervice
=
SSHServi
ce
()
transport
.
add_server_key
(
SSHServ
erInterfa
ce
.
get_host_key
())
s
sh_interface
=
SSHServerInterfa
ce
()
try
:
transport
.
start_server
(
server
=
s
ervi
ce
)
transport
.
start_server
(
server
=
s
sh_interfa
ce
)
except
paramiko
.
SSHException
:
print
(
'*** SSH negotiation failed.'
)
return
...
...
@@ -158,7 +151,7 @@ class SSHServer:
channel
.
send
(
'We are on fire all the time! Hooray! Candy corn for everyone!
\r\n
'
)
channel
.
send
(
'Happy birthday to Robot Dave!
\r\n\r\n
'
)
server_channel
=
self
.
connect
()
if
not
s
ervi
ce
.
event
.
is_set
():
if
not
s
sh_interfa
ce
.
event
.
is_set
():
print
(
'*** Client never asked for a shell.'
)
return
server_data
=
[]
...
...
terminal/utils.py
0 → 100644
View file @
216163f4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import
logging
terminal/web_server.py
0 → 100644
View file @
216163f4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
if
__name__
==
'__main__'
:
pass
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