Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
c13956a4
Commit
c13956a4
authored
Sep 03, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'github/dev' into dev
parents
412b7f02
2df44d0b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
9 deletions
+15
-9
app.py
coco/app.py
+1
-0
connection.py
coco/connection.py
+5
-4
proxy.py
coco/proxy.py
+5
-3
conf_example.py
conf_example.py
+3
-0
rpm_requirements.txt
requirements/rpm_requirements.txt
+1
-2
No files found.
coco/app.py
View file @
c13956a4
...
...
@@ -54,6 +54,7 @@ class Coco:
'HEARTBEAT_INTERVAL'
:
5
,
'MAX_CONNECTIONS'
:
500
,
'ADMINS'
:
''
,
'SSH_TIMEOUT'
:
15
,
'COMMAND_STORAGE'
:
{
'TYPE'
:
'server'
},
# server
'REPLAY_STORAGE'
:
{
'TYPE'
:
'server'
},
}
...
...
coco/connection.py
View file @
c13956a4
...
...
@@ -10,11 +10,11 @@ import telnetlib
import
paramiko
from
paramiko.ssh_exception
import
SSHException
from
.ctx
import
app_service
from
.ctx
import
app_service
,
current_app
from
.utils
import
get_logger
,
get_private_key_fingerprint
,
net_input
logger
=
get_logger
(
__file__
)
TIMEOUT
=
10
BUF_SIZE
=
1024
MANUAL_LOGIN
=
'manual'
AUTO_LOGIN
=
'auto'
...
...
@@ -46,7 +46,8 @@ class SSHConnection:
ssh
.
connect
(
asset
.
ip
,
port
=
asset
.
port
,
username
=
system_user
.
username
,
password
=
system_user
.
password
,
pkey
=
system_user
.
private_key
,
timeout
=
TIMEOUT
,
compress
=
True
,
auth_timeout
=
TIMEOUT
,
timeout
=
current_app
.
config
[
'SSH_TIMEOUT'
],
compress
=
True
,
auth_timeout
=
current_app
.
config
[
'SSH_TIMEOUT'
],
look_for_keys
=
False
,
sock
=
sock
)
except
(
paramiko
.
AuthenticationException
,
...
...
@@ -111,7 +112,7 @@ class SSHConnection:
username
=
gateway
.
username
,
password
=
gateway
.
password
,
pkey
=
gateway
.
private_key_obj
,
timeout
=
TIMEOUT
)
timeout
=
current_app
.
config
[
'SSH_TIMEOUT'
]
)
except
(
paramiko
.
AuthenticationException
,
paramiko
.
BadAuthenticationType
,
SSHException
):
...
...
coco/proxy.py
View file @
c13956a4
...
...
@@ -16,7 +16,6 @@ from .utils import wrap_with_line_feed as wr, wrap_with_warning as warning, \
logger
=
get_logger
(
__file__
)
TIMEOUT
=
10
BUF_SIZE
=
4096
MANUAL_LOGIN
=
'manual'
AUTO_LOGIN
=
'auto'
...
...
@@ -156,8 +155,11 @@ class ProxyServer:
self
.
client
.
send
(
'Connecting to {}@{} {:.1f}'
.
format
(
system_user
,
asset
,
delay
)
)
while
self
.
connecting
and
delay
<
TIMEOUT
:
self
.
client
.
send
(
'
\x08\x08\x08
{:.1f}'
.
format
(
delay
)
.
encode
())
while
self
.
connecting
and
delay
<
current_app
.
config
[
'SSH_TIMEOUT'
]:
if
0
<=
delay
<
10
:
self
.
client
.
send
(
'
\x08\x08\x08
{:.1f}'
.
format
(
delay
)
.
encode
())
else
:
self
.
client
.
send
(
'
\x08\x08\x08\x08
{:.1f}'
.
format
(
delay
)
.
encode
())
time
.
sleep
(
0.1
)
delay
+=
0.1
thread
=
threading
.
Thread
(
target
=
func
)
...
...
conf_example.py
View file @
c13956a4
...
...
@@ -66,5 +66,8 @@ class Config:
"TYPE"
:
"server"
}
# SSH connection timeout (default 15 seconds)
# SSH_TIMEOUT = 15
config
=
Config
()
requirements/rpm_requirements.txt
View file @
c13956a4
libffi-devel sshpass
\ No newline at end of file
libffi-devel sshpass krb5-devel
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