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
a766b091
Unverified
Commit
a766b091
authored
Nov 15, 2018
by
老广
Committed by
GitHub
Nov 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from jumpserver/dev
Dev
parents
ef2ddabb
d9bedff2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
3 deletions
+99
-3
Dockerfile
Dockerfile
+21
-0
interactive.py
coco/interactive.py
+5
-3
conf_docker.py
conf_docker.py
+73
-0
No files found.
Dockerfile
0 → 100644
View file @
a766b091
FROM
registry.fit2cloud.com/public/python:v3
MAINTAINER
Jumpserver Team <ibuler@qq.com>
COPY
requirements /opt/coco/requirements
WORKDIR
/opt/coco
RUN
yum
-y
install
epel-release
RUN
cd
requirements
&&
yum
-y
install
$(
cat
rpm_requirements.txt
)
RUN
cd
requirements
&&
pip
install
$(
egrep
"jumpserver|jms"
requirements.txt |
tr
'\n'
' '
)
&&
pip
install
-r
requirements.txt
-i
https://mirrors.ustc.edu.cn/pypi/web/simple
ENV
LANG=zh_CN.UTF-8
ENV
LC_ALL=zh_CN.UTF-8
COPY
. /opt/coco
VOLUME
/opt/coco/logs
VOLUME
/opt/coco/keys
RUN
cp
conf_docker.py conf.py
EXPOSE
2222
CMD
python run_server.py
coco/interactive.py
View file @
a766b091
...
...
@@ -180,8 +180,8 @@ class InteractiveServer:
return
self
.
nodes_tree
.
show
(
key
=
lambda
node
:
node
.
identifier
)
self
.
client
.
send
(
wr
(
title
(
_
(
"Node: [ ID.Name(Asset amount) ]"
)),
before
=
1
))
self
.
client
.
send
(
wr
(
self
.
nodes_tree
.
_reader
.
replace
(
'
\n
'
,
'
\r\n
'
),
before
=
1
))
self
.
client
.
send
(
wr
(
title
(
_
(
"Node: [ ID.Name(Asset amount) ]"
)),
before
=
0
))
self
.
client
.
send
(
wr
(
self
.
nodes_tree
.
_reader
.
replace
(
'
\n
'
,
'
\r\n
'
),
before
=
0
))
prompt
=
_
(
"Tips: Enter g+NodeID to display the host under the node, such as g1"
)
self
.
client
.
send
(
wr
(
title
(
prompt
),
before
=
1
))
...
...
@@ -242,10 +242,12 @@ class InteractiveServer:
def
construct_nodes_tree
(
self
):
self
.
nodes_tree
=
Tree
()
root
=
'ROOT_ALL_ORG_NODE'
self
.
nodes_tree
.
create_node
(
tag
=
''
,
identifier
=
root
,
parent
=
None
)
for
index
,
node
in
enumerate
(
self
.
nodes
):
tag
=
"{}.{}({})"
.
format
(
index
+
1
,
node
.
name
,
node
.
assets_amount
)
key
=
node
.
key
parent_key
=
key
[:
node
.
key
.
rfind
(
':'
)]
or
None
parent_key
=
key
[:
node
.
key
.
rfind
(
':'
)]
or
root
self
.
nodes_tree
.
create_node
(
tag
=
tag
,
identifier
=
key
,
data
=
node
,
parent
=
parent_key
)
def
get_user_nodes_async
(
self
):
...
...
conf_docker.py
0 → 100644
View file @
a766b091
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
BASE_DIR
=
os
.
path
.
dirname
(
__file__
)
class
Config
:
"""
Coco config file
"""
# 默认的名字
NAME
=
os
.
environ
.
get
(
"NAME"
)
or
None
# Jumpserver项目的url, api请求注册会使用
CORE_HOST
=
os
.
environ
.
get
(
"CORE_HOST"
)
or
'http://core:8080'
# 启动时绑定的ip, 默认 0.0.0.0
BIND_HOST
=
'0.0.0.0'
# 监听的SSH端口号, 默认2222
SSHD_PORT
=
2222
# 监听的HTTP/WS端口号,默认5000
HTTPD_PORT
=
5000
# 项目使用的ACCESS KEY, 默认会注册,并保存到 ACCESS_KEY_STORE中,
# 如果有需求, 可以写到配置文件中, 格式 access_key_id:access_key_secret
ACCESS_KEY
=
os
.
environ
.
get
(
"ACCESS_KEY"
)
or
None
# ACCESS KEY 保存的地址, 默认注册后会保存到该文件中
# ACCESS_KEY_STORE = os.path.join(BASE_DIR, 'keys', '.access_key')
# 加密密钥
SECRET_KEY
=
os
.
environ
.
get
(
"SECRET_KEY"
)
or
'SKdfm239LSKdfj())_23jK*^2'
# 设置日志级别 ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'CRITICAL']
LOG_LEVEL
=
os
.
environ
.
get
(
"LOG_LEVEL"
)
or
'DEBUG'
# 日志存放的目录
LOG_DIR
=
os
.
environ
.
get
(
"LOG_DIR"
)
or
os
.
path
.
join
(
BASE_DIR
,
'logs'
)
# Session录像存放目录
SESSION_DIR
=
os
.
environ
.
get
(
"SESSION_DIR"
)
or
os
.
path
.
join
(
BASE_DIR
,
'sessions'
)
# 资产显示排序方式, ['ip', 'hostname']
ASSET_LIST_SORT_BY
=
os
.
environ
.
get
(
"SESSION_DIR"
)
or
'ip'
# 登录是否支持密码认证
SSH_PASSWORD_AUTH
=
bool
(
os
.
environ
.
get
(
"SSH_PASSWORD_AUTH"
))
if
os
.
environ
.
get
(
"SSH_PASSWORD_AUTH"
)
else
True
# 登录是否支持秘钥认证
SSH_PUBLIC_KEY_AUTH
=
bool
(
os
.
environ
.
get
(
"SSH_PUBLIC_KEY_AUTH"
))
if
os
.
environ
.
get
(
"SSH_PUBLIC_KEY_AUTH"
)
else
True
# 和Jumpserver 保持心跳时间间隔
HEARTBEAT_INTERVAL
=
int
(
os
.
environ
.
get
(
"HEARTBEAT_INTERVAL"
))
if
os
.
environ
.
get
(
"HEARTBEAT_INTERVAL"
)
else
5
# Admin的名字,出问题会提示给用户
ADMINS
=
os
.
environ
.
get
(
"ADMINS"
)
or
''
COMMAND_STORAGE
=
{
"TYPE"
:
"server"
}
class
ConfigDocker
(
Config
):
pass
config
=
ConfigDocker
()
\ No newline at end of file
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