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
917a24e8
Commit
917a24e8
authored
Dec 21, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add postfix_shell function. Add jumpserver.conf file.
parent
0b2a77fc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
jumpserver.conf
jumpserver.conf
+3
-0
jumpserver.py
jumpserver.py
+59
-0
No files found.
jumpserver.conf
0 → 100644
View file @
917a24e8
#coding: utf8
[
jumpserver
]
jumpserver.py
0 → 100644
View file @
917a24e8
#coding: utf8
import
socket
import
sys
import
os
import
select
import
time
try
:
import
termios
import
tty
except
ImportError
:
print
'Only postfix supported.'
sys
.
exit
()
CURRENT_DIR
=
os
.
path
.
abspath
(
'.'
)
LOG_DIR
=
os
.
path
.
join
(
CURRENT_DIR
,
'logs'
)
def
posix_shell
(
chan
,
user
,
host
):
"""
Use paramiko channel connect server and logging.
"""
today
=
time
.
strftime
(
'
%
Y
%
m
%
d'
)
today_log_dir
=
os
.
path
.
join
(
LOG_DIR
,
today
)
time_now
=
time
.
strftime
(
'
%
H
%
M
%
S'
)
log_filename
=
''
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
tty
.
setcbreak
(
sys
.
stdin
.
fileno
())
chan
.
settimeout
(
0.0
)
while
True
:
try
:
r
,
w
,
e
=
select
.
select
([
chan
,
sys
.
stdin
],
[],
[])
except
:
pass
if
chan
in
r
:
try
:
x
=
chan
.
recv
(
1024
)
if
len
(
x
)
==
0
:
break
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
flush
()
except
socket
.
timeout
:
pass
if
sys
.
stdin
in
r
:
x
=
os
.
read
(
sys
.
stdin
.
fileno
(),
1
)
if
len
(
x
)
==
0
:
break
chan
.
send
(
x
)
finally
:
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
old_tty
)
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