Code Monkey home page Code Monkey logo

coco's Introduction

JumpServer

An open-source PAM tool (Bastion Host)

English · 简体中文


What is JumpServer?

JumpServer is an open-source Privileged Access Management (PAM) tool that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

JumpServer Overview

Quickstart

Prepare a clean Linux Server ( 64 bit, >= 4c8g )

curl -sSL https://github.com/jumpserver/jumpserver/releases/latest/download/quick_start.sh | bash

Access JumpServer in your browser at http://your-jumpserver-ip/

  • Username: admin
  • Password: ChangeMe

Screenshots

JumpServer Console JumpServer Audits
JumpServer Workbench JumpServer Settings
JumpServer SSH JumpServer RDP
JumpServer K8s JumpServer DB

Components

JumpServer consists of multiple key components, which collectively form the functional framework of JumpServer, providing users with comprehensive capabilities for operations management and security control.

Project Status Description
Lina Lina release JumpServer Web UI
Luna Luna release JumpServer Web Terminal
KoKo Koko release JumpServer Character Protocol Connector
Lion Lion release JumpServer Graphical Protocol Connector
Chen Chen release JumpServer Web DB
Razor Chen JumpServer EE RDP Proxy Connector
Tinker Tinker JumpServer EE Remote Application Connector (Windows)
Panda Panda JumpServer EE Remote Application Connector (Linux)
Magnus Magnus JumpServer EE Database Proxy Connector

Contributing

Welcome to submit PR to contribute. Please refer to CONTRIBUTING.md for guidelines.

Security

JumpServer is a mission critical product. Please refer to the Basic Security Recommendations for installation and deployment. If you encounter any security-related issues, please contact us directly:

License

Copyright (c) 2014-2024 飞致云 FIT2CLOUD, All rights reserved.

Licensed under The GNU General Public License version 3 (GPLv3) (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.gnu.org/licenses/gpl-3.0.html

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an " AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

coco's People

Contributors

baijiangjie avatar ccl0326 avatar ibuler avatar jeffguorg avatar lastimac avatar leeeirc avatar liuzheng avatar vkill avatar xionghui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coco's Issues

ValueError: filedescriptor out of range in select()

长时间使用了之后会出现:

Exception in thread Thread-1141:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/tangcaijun/workspace/coco/coco/app.py", line 133, in process_request
    InteractiveServer(self, ssh_interface.user_service).run()
  File "/home/tangcaijun/workspace/coco/coco/interactive.py", line 289, in run
    self.dispatch()
  File "/home/tangcaijun/workspace/coco/coco/interactive.py", line 108, in dispatch
    option = self.get_input()
  File "/home/tangcaijun/workspace/coco/coco/interactive.py", line 65, in get_input
    r, w, x = select.select([g.client_channel], [], [])
ValueError: filedescriptor out of range in select()

select 只能监听 1024 个sock,超过会报这个错误。

这里暴露了两个问题:

  1. 我在使用中并没有同时打开1024个以上的sock,经调试发现用户退出后,select并没有close并释放sock
  2. 因为select库的1024的限制,在大型一些的应用场景中有可能会超出该限制,推荐换成使用selectors而不用select(官方也是这么推荐的)

参考

SSH 连到Jumpserver 终端 会显示Windows资产问题

如标题描述,Windows资产会混杂显示到jumpserver ssh终端,

有无让Windows 不显示到ssh 终端列表到方法???COCO 版本1.3.3

用户是肯定需要混合授权Windows+Linux资产的。

以及ssh 终端列表 是否可以按资产目录树分层显示,进入一层节点才显示节点下的资产列表。

coco 更新到最新的版本 无法启动 'Config' object has no attribute 'config'

Traceback (most recent call last):
File "./cocod", line 16, in
from coco import Coco
File "/opt/coco/coco/init.py", line 5, in
from .app import Coco
File "/opt/coco/coco/app.py", line 13, in
from .sshd import SSHServer
File "/opt/coco/coco/sshd.py", line 12, in
from coco.interface import SSHInterface
File "/opt/coco/coco/interface.py", line 11, in
from .ctx import app_service
File "/opt/coco/coco/ctx.py", line 21, in
app_service = AppService(config)
File "/opt/py3/lib/python3.6/site-packages/jms/service.py", line 33, in init
super().init(app.config['CORE_HOST'])
AttributeError: 'Config' object has no attribute 'config'

coco卡死

使用xshell登录跳板机的资产。tail -f命令输出大量日志后ctrl+c退出时,终端卡死。

安装jumpserver1.3.3和coco1.3.3 ,jms库如何升级

Traceback (most recent call last):
File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/coco/coco/proxy.py", line 54, in proxy
if system_user.login_mode == MANUAL_LOGIN and not system_user.username:
AttributeError: 'SystemUser' object has no attribute 'login_mode'

jms/models.py

class SystemUser(Decoder):
id = 0
name = ""
username = ""
protocol = "ssh"
auth_method = "P"
comment = ""
password = ""
priority = 0
private_key = None

def __str__(self):
    return self.username

def __repr__(self):
    return self.username

coco登录卡住 bug

image
卡在该步骤不能动弹

coco 日志

2018-03-01 14:52:36 [app INFO] New client <xxx.xxx from x.x.x.x:51453> join, total 1 now
2018-03-01 14:52:36 [sshd INFO] Request type pty, dispatch to interactive mode
2018-03-01 14:52:36 [interface INFO] Check channel shell request: 0
Exception in thread Thread-8:
Traceback (most recent call last):
File "/opt/python364/Lib/threading.py", line 916, in _bootstrap_inner
self.run()
File "/opt/python364/Lib/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/etc/jumpapp/coco/coco/sshd.py", line 90, in handle_chan
self.dispatch(client)
File "/etc/jumpapp/coco/coco/sshd.py", line 96, in dispatch
InteractiveServer(self.app, client).interact()
File "/etc/jumpapp/coco/coco/interactive.py", line 310, in interact
rv = self.dispatch(opt)
File "/etc/jumpapp/coco/coco/interactive.py", line 147, in dispatch
self.search_and_proxy(opt)
File "/etc/jumpapp/coco/coco/interactive.py", line 287, in search_and_proxy
if asset.platform == "Windows":
AttributeError: 'Asset' object has no attribute 'platform'

2018-03-01 14:54:53 [transport INFO] Disconnect (code 11): disconnected by user

2018-03-05 luna登录,coco报错

image

Bug: coco登陆后,快速输入 g+数字 卡死

原因是异步获取节点信息还没有回来, 此时self.nodes不存在。interactive.py> display_node_assets方法没有判断数据是否回来,直接访问了self.nodes导致线程崩溃。 建议加上判断,没有回来手动拉取一下。

    def display_node_assets(self, _id):                                                                                                                                                       
        """
        fix-Bug: 如果异步节点(node)数据还没有返回,手动获取。解决用户直接输入g?
        """
        if self.nodes is None:
            self.get_user_nodes()

        if _id > len(self.nodes) or _id <= 0:
            self.client.send(wr(warning("没有匹配分组,请重新输入")))
            self.display_nodes()
            return

        self.search_result = self.nodes[_id - 1].assets_granted
        self.display_search_result()

sftp无法进入包含中文名文件的目录

paramiko默认使用utf8,自己在使用paramiko的时候,如果遇到此问题,只要修改py3compat.py,增加gbk解码即可,但是此修改对 jumpserver sftp无效,不知什么原因。报错如下:

错误:	Directory /log: received failure with description 'Failure'
错误:	读取目录列表失败

注:log目录底下的中文文件名是 GBK 编码。
有人遇到同样问题吗?帮忙分析一下,谢谢。

terminal输入tab后无法删除

在1.3.1-2版本使用的coco中,通过terminal登录,在输入主机名时输入了tab键后无法删除tab造成的空格及开始输入的内容。使用control+w 也无法删除到行首。对于linux终端,不让使用tab键体验不是很好。

coco无法使用tunnel

Check channel direct tcpip request
Secsh channel 0 (direct-tcpip) opene
没有看到其他错误,实际没有连接指定ip,建议考虑这个功能,最好是能够在用户管理中控制某个用户允许使用tunnel

ssh到jumpserver,不显示任何资产,web terminal 时常连接失败

  XX, 欢迎使用Jumpserver开源跳板机系统  

    1) 输入 ID 直接登录 或 输入部分 IP,主机名,备注 进行搜索登录(如果唯一).
    2) 输入 / + IP, 主机名 or 备注 搜索. 如: /ip
    3) 输入 p 显示您有权限的主机.
    4) 输入 g 显示您有权限的节点
    5) 输入 g + 组ID 显示节点下主机. 如: g1
    6) 输入 h 帮助.
    0) 输入 q 退出.

Opt> p

ID   Hostname IP               LoginAs Comment                                                                                                     

总共: 0 匹配: 0

Opt> 

coco登陆后显示有权限的主机卡死

系统:CentOS Linux release 7.4.1708 (Core)
jumpserver:v0.5.0
coco:dev
coco注册后,通过coco登录跳板机,输入p,查询有权限的主机,结果卡死,用luna可以正常登录主机。

wx20180306-224540 2x

coco日志:

127.0.0.1 - - [06/Mar/2018 22:45:25] "GET /socket.io/?EIO=3&transport=polling&t=M3znSqt&sid=1d2713d09fj64bc2a7205c016ad4e183 HTTP/1.1" 200 - 
2018-03-06 22:45:26 [recorder DEBUG] <Session command recorder 1> queue size: 0                                                             
2018-03-06 22:45:31 [recorder DEBUG] <Session command recorder 1> queue size: 0
2018-03-06 22:45:33 [interactive DEBUG] b'p'                                   
2018-03-06 22:45:33 [interactive DEBUG] b'\r'                                  
Exception in thread Thread-125:                                                
Traceback (most recent call last):                                             
  File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner                                                                
    self.run()                                                                                                                              
  File "/usr/local/lib/python3.6/threading.py", line 864, in run               
    self._target(*self._args, **self._kwargs)                                  
  File "/opt/coco/coco/sshd.py", line 90, in handle_chan                       
    self.dispatch(client)                                                      
  File "/opt/coco/coco/sshd.py", line 96, in dispatch
    InteractiveServer(self.app, client).interact()
  File "/opt/coco/coco/interactive.py", line 310, in interact
    rv = self.dispatch(opt)
  File "/opt/coco/coco/interactive.py", line 137, in dispatch
    self.display_assets()
  File "/opt/coco/coco/interactive.py", line 178, in display_assets
    self.search_and_display('')
  File "/opt/coco/coco/interactive.py", line 231, in search_and_display
    self.display_search_result()
  File "/opt/coco/coco/interactive.py", line 219, in display_search_result
    comment_length = self.request.meta["width"] - len(header.format(fake_asset, id_max_length))
KeyError: 'width'

2018-03-06 22:45:36 [recorder DEBUG] <Session command recorder 1> queue size: 0

【BUG】'AppService' object has no attribute 'check_user_with_token'

版本1.3.1

Wed May 30 10:17:36 2018
Coco version 1.3.1, more see https://www.jumpserver.org
Quit the server with CONTROL-C.
Starting ssh server at 0.0.0.0:2222
Starting websocket server at 0.0.0.0:5000
2018-05-30 10:17:36 [recorder WARNING] Failed push replay file: None, try again 1
2018-05-30 10:17:49 [httpd DEBUG] On connect event trigger
2018-05-30 10:17:50 [httpd ERROR] 'AppService' object has no attribute 'check_user_with_token'
Traceback (most recent call last):
  File "/opt/py3/lib/python3.6/site-packages/flask_socketio/__init__.py", line 624, in _handle_event
    ret = handler()
  File "/opt/coco/coco/httpd.py", line 116, in on_connect
    super().on_connect()
  File "/opt/coco/coco/httpd.py", line 23, in on_connect
    self.current_user = self.get_current_user()
  File "/opt/coco/coco/httpd.py", line 36, in get_current_user
    user = app_service.check_user_with_token(token)
  File "/opt/py3/lib/python3.6/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'AppService' object has no attribute 'check_user_with_token'

另外一个错误:

Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/coco/coco/sshd.py", line 104, in handle_chan
    self.dispatch(client)
  File "/opt/coco/coco/sshd.py", line 111, in dispatch
    InteractiveServer(client).interact()
  File "/opt/coco/coco/interactive.py", line 271, in interact
    rv = self.dispatch(opt)
  File "/opt/coco/coco/interactive.py", line 86, in dispatch
    self.search_and_proxy(opt)
  File "/opt/coco/coco/interactive.py", line 254, in search_and_proxy
    self.proxy(asset)
  File "/opt/coco/coco/interactive.py", line 264, in proxy
    forwarder.proxy(asset, system_user)
  File "/opt/coco/coco/proxy.py", line 58, in proxy
    session.bridge()
  File "/opt/coco/coco/session.py", line 134, in bridge
    self.close()
  File "/opt/coco/coco/session.py", line 167, in close
    self.post_bridge()
  File "/opt/coco/coco/session.py", line 105, in post_bridge
    self._replay_recorder.session_end(self.id)
  File "/opt/coco/coco/recorder.py", line 58, in session_end
    self.upload_replay(session_id)
  File "/opt/coco/coco/recorder.py", line 77, in upload_replay
    self.upload_replay(session_id, times-1)
  File "/opt/coco/coco/recorder.py", line 77, in upload_replay
    self.upload_replay(session_id, times-1)
  File "/opt/coco/coco/recorder.py", line 77, in upload_replay
    self.upload_replay(session_id, times-1)
  File "/opt/coco/coco/recorder.py", line 70, in upload_replay
    self.storage = jms_storage.JMSReplayStorage(app_service)
  File "/opt/py3/lib/python3.6/site-packages/jms_storage/jms.py", line 9, in __init__
    self.client = config.get("SERVICE")
  File "/opt/py3/lib/python3.6/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'AppService' object has no attribute 'get'

2018-05-31 15:05:26 [recorder DEBUG] Send 2 commands to server
2018-05-31 15:05:26 [app INFO] Remove session: 4cce39fa-91e3-43af-8681-098d99c91b74

sz命令乱码

使用sz命令下载文件,xshell窗口显示乱码

我使用jumpserver连接到主机认证可以通过,但是连接成功后,无法输入任何,一输入就报错

2017-06-19 00:09:25 [connectionpool DEBUG] "POST /api/applications/v1/terminal/heatbeat/ HTTP/1.1" 201 28
Exception in thread Thread-22:
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 804, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.7/threading.py", line 757, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/yh/sync/source_read/jump-django/coco/coco/app.py", line 133, in process_request
InteractiveServer(self).run()
File "/home/yh/sync/source_read/jump-django/coco/coco/interactive.py", line 294, in run
self.dispatch()
File "/home/yh/sync/source_read/jump-django/coco/coco/interactive.py", line 127, in dispatch
return self.search_and_proxy(option=option, from_result=twice)
File "/home/yh/sync/source_read/jump-django/coco/coco/interactive.py", line 268, in search_and_proxy
self.return_to_proxy(asset, system_user)
File "/home/yh/sync/source_read/jump-django/coco/coco/interactive.py", line 285, in return_to_proxy
proxy_server.proxy()
File "/home/yh/sync/source_read/jump-django/coco/coco/proxy.py", line 205, in proxy
if self.is_finish_input(client_data):
File "/home/yh/sync/source_read/jump-django/coco/coco/proxy.py", line 63, in is_finish_input
if chr(char) in self.ENTER_CHAR:
TypeError: an integer is required

2017-06-19 00:09:29 [transport DEBUG] EOF in transport thread

请问用户的公钥保存在哪个文件夹下?

由于使用了HA的架构,有两台服务器需要同步用户的公钥文件夹,好像和以前的不同了?coco下的keys文件夹不见了,急需知道在那个文件夹下,否则新建用户后公钥会出错,谢谢。

coco v1.4.3 启动卡死,也不报错

conf.py为默认

# ./cocod restart -d



^C^CTraceback (most recent call last):
  File "./cocod", line 16, in <module>
    from coco import Coco
  File "/opt/coco/coco/__init__.py", line 5, in <module>
    from .app import Coco
  File "/opt/coco/coco/app.py", line 13, in <module>
    from .sshd import SSHServer
  File "/opt/coco/coco/sshd.py", line 12, in <module>
    from coco.interface import SSHInterface
  File "/opt/coco/coco/interface.py", line 11, in <module>
    from .ctx import app_service
  File "/opt/coco/coco/ctx.py", line 22, in <module>
    app_service.initial()
  File "/opt/py3/lib/python3.6/site-packages/jms/service.py", line 56, in initial
    self.load_access_key()
  File "/opt/py3/lib/python3.6/site-packages/jms/service.py", line 67, in load_access_key
    self.register_and_save()
  File "/opt/py3/lib/python3.6/site-packages/jms/service.py", line 112, in register_and_save
    self.wait_for_accept(uuid, token)
  File "/opt/py3/lib/python3.6/site-packages/jms/service.py", line 102, in wait_for_accept
    time.sleep(3)
  File "/opt/py3/lib/python3.6/site-packages/eventlet/greenthread.py", line 36, in sleep
    hub.switch()
  File "/opt/py3/lib/python3.6/site-packages/eventlet/hubs/hub.py", line 297, in switch
    return self.greenlet.switch()
  File "/opt/py3/lib/python3.6/site-packages/eventlet/hubs/hub.py", line 349, in run
    self.wait(sleep_time)
  File "/opt/py3/lib/python3.6/site-packages/eventlet/hubs/poll.py", line 76, in wait
    time.sleep(seconds)
KeyboardInterrupt

replay文件gzip close后没有在/opt/coco/logs/下写入文件?

2018-07-31 03:48:09 [session INFO] Server close the connection
2018-07-31 03:48:09 [session INFO] Close the session: 6f1b4d2a-768e-461e-9686-52241f9fd501
2018-07-31 03:48:09 [recorder WARNING] self.file is <_io.TextIOWrapper name='/opt/coco/logs/6f1b4d2a-768e-461e-9686-52241f9fd501.replay.gz' encoding='ANSI_X3.4-1968'>, self.file_path is /opt/coco/logs/6f1b4d2a-768e-461e-9686-52241f9fd501.replay.gz
2018-07-31 03:48:09 [recorder WARNING] self.file_path is /opt/coco/logs/6f1b4d2a-768e-461e-9686-52241f9fd501.replay.gz, target is 2018-07-31/6f1b4d2a-768e-461e-9686-52241f9fd501.replay.gz

交互中出现大段中文时会卡死

echo "即表示您与阿里云已达成协议并同意接受本服务条款的全部约定内容。如若双方盖章文本与网络页面点击确认或以其他方式选择接受之服务条款文本"

例如上述操作

最开始是curl返回的body中含有一段中文假死

注: 中文如果是手输不会报错, 粘贴会报错

超时自动断开机制

能不能在连接上堡垒机以后多长时间内没有交互的话自动断开连接, 或者我想自己开发的话,该修改哪一部分?这个项目的代码目前还没有完全看明白.

状态保持bug

通过xhell终端登陆跳板机连上国外机房的服务器在几分钟不操作后界面就会进入僵死状态(键入命令无反应),但是通过后台日志查看连接是没有断开的,很是无解,请问这是问题出在哪里啊

coco启动时显示数据库缺少terminal.command_storage字段

jumpserver能正常启动,但是数据库terminal表缺少command_storage字段,导致coco无法启动

Traceback:

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py" in execute
296. return Database.Cursor.execute(self, query, params)

The above exception (no such column: terminal.command_storage) was the direct cause of the following exception:

File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)

File "/opt/py3/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/contextlib.py" in inner
52. return func(*args, **kwds)

File "/opt/py3/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
54. return view_func(*args, **kwargs)

File "/opt/py3/lib/python3.6/site-packages/rest_framework/viewsets.py" in view
103. return self.dispatch(request, *args, **kwargs)

File "/opt/py3/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
483. response = self.handle_exception(exc)

File "/opt/py3/lib/python3.6/site-packages/rest_framework/views.py" in handle_exception
443. self.raise_uncaught_exception(exc)

File "/opt/py3/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
480. response = handler(request, *args, **kwargs)

File "/opt/jumpserver/apps/terminal/api.py" in create
46. terminal = get_object_or_none(Terminal, name=name, is_deleted=False)

File "/opt/jumpserver/apps/common/utils.py" in get_object_or_none
46. obj = model.objects.get(**kwargs)

File "/opt/py3/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py" in get
393. num = len(clone)

File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py" in len
250. self._fetch_all()

File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py" in _fetch_all
1183. self._result_cache = list(self._iterable_class(self))

File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py" in iter
54. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)

File "/opt/py3/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
1061. cursor.execute(sql, params)

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
100. return super().execute(sql, params)

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
77. return executor(sql, params, many, context)

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)

File "/opt/py3/lib/python3.6/site-packages/django/db/utils.py" in exit
89. raise dj_exc_value.with_traceback(traceback) from exc_value

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)

File "/opt/py3/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py" in execute
296. return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /api/terminal/v1/terminal/
Exception Value: no such column: terminal.command_storage

可否增加ssh -D 以及-L的支持

登录 coco 跳板机后,再登录目标主机, 可否加上 -D/-L的支持。

现在报

channel 4: open failed: administratively prohibited:

coco的登录限制

使用的是lastest--jumpserver:coco配置

登录是否支持密码认证

PASSWORD_AUTH = False

我关闭了PASSWORD验证,为什么还可以直接用账户密码登录??
是否需要设置其他的
启用MFA验证每次登录终端感觉比较麻烦

app模块socket是否考虑用epoll

self.sock = sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((host, port))
sock.listen(5)

这块不用epoll网络模型,会不会有性能问题?
另外,我们现在基于coco来改,可否用在线上?

AppService使用不合理

导入后 app service 后会自动执行部分设置,感觉挺别扭的。

service如果作为 app的属性,初始化app时再初始化 service, 这在使用celery完成一些任务时会有问题,

celery的task可能要依赖app service, 所以celery运行时 app service要配置完成

Unknown exception: '_AppCtxGlobals' object has no attribute 'user_service'

过一段时间,coco通过ssh就连接不上。看日志,报错如下,应该是运行一段时间后,对象g的属性user_service就不见了。:

2017-08-17 10:07:57 [interface DEBUG] Start check auth
2017-08-17 10:07:57 [transport ERROR] Unknown exception: '_AppCtxGlobals' object has no attribute 'user_service'
2017-08-17 10:07:57 [transport ERROR] Traceback (most recent call last):
2017-08-17 10:07:57 [transport ERROR]   File "/data/prd/coco/env/lib/python3.6/site-packages/paramiko/transport.py", line 1860, in run
2017-08-17 10:07:57 [transport ERROR]     handler(self.auth_handler, m)
2017-08-17 10:07:57 [transport ERROR]   File "/data/prd/coco/env/lib/python3.6/site-packages/paramiko/auth_handler.py", line 461, in _parse_userauth_request
2017-08-17 10:07:57 [transport ERROR]     username, key)
2017-08-17 10:07:57 [transport ERROR]   File "/data/prd/coco/coco/interface.py", line 93, in check_auth_publickey
2017-08-17 10:07:57 [transport ERROR]     if self.check_auth(username, public_key=public_key_s):
2017-08-17 10:07:57 [transport ERROR]   File "/data/prd/coco/coco/interface.py", line 64, in check_auth
2017-08-17 10:07:57 [transport ERROR]     user, token = g.user_service.login(data)
2017-08-17 10:07:57 [transport ERROR]   File "/data/prd/coco/env/lib/python3.6/site-packages/werkzeug/local.py", line 347, in __getattr__
2017-08-17 10:07:57 [transport ERROR]     return getattr(self._get_current_object(), name)
2017-08-17 10:07:57 [transport ERROR] AttributeError: '_AppCtxGlobals' object has no attribute 'user_service'
2017-08-17 10:07:57 [transport ERROR]

coco startup failed

issue on commit:134dc0cc9d4a0c8bdfdf30b350aed3d8e420f462


> (jump) jumper@ubnt:~/coco$ ./cocod start


Traceback (most recent call last):
  File "./cocod", line 11, in <module>
    from coco import Coco
  File "/home/jumper/coco/coco/__init__.py", line 5, in <module>
    from .app import Coco
  File "/home/jumper/coco/coco/app.py", line 18, in <module>
    from .sshd import SSHServer
  File "/home/jumper/coco/coco/sshd.py", line 12, in <module>
    from .interface import SSHInterface
  File "/home/jumper/coco/coco/interface.py", line 11, in <module>
    from .ctx import app_service
  File "/home/jumper/coco/coco/ctx.py", line 21, in <module>
    app_service = AppService(config)
  File "/home/jumper/jump/lib/python3.6/site-packages/jms/service.py", line 33, in __init__
    super().__init__(app.config['CORE_HOST'])
AttributeError: 'Config' object has no attribute 'config'

ssh到jumpserver后,按p卡死

用xshaell连接到jumpserver后,按p后无反应,少量资产的系统就无问题,但多资产(几百)的系统就卡死了

coco 长时间跑会占用多少内存

昨天coco因为oom被kill 了。

Dec 21 04:53:05 sh-0000034 kernel: python invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 Dec 21 04:53:06 sh-0000034 kernel: python cpuset=/ mems_allowed=0 Dec 21 04:53:06 sh-0000034 kernel: CPU: 1 PID: 22620 Comm: python Not tainted 3.10.0-514.26.2.el7.x86_64 #1 Dec 21 04:53:06 sh-0000034 kernel: Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Dec 21 04:53:06 sh-0000034 kernel: ffff880014833ec0 00000000bda4767f ffff8800149df938 ffffffff81687133 Dec 21 04:53:06 sh-0000034 kernel: ffff8800149df9c8 ffffffff816820de ffffffff810eb0dc ffff8800895cbc90 Dec 21 04:53:06 sh-0000034 kernel: ffff8800895cbca8 0000000000000202 ffff880014833ec0 ffff8800149df9b8 Dec 21 04:53:06 sh-0000034 kernel: Call Trace: Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81687133>] dump_stack+0x19/0x1b Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff816820de>] dump_header+0x8e/0x225 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff810eb0dc>] ? ktime_get_ts64+0x4c/0xf0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff8113d22f>] ? delayacct_end+0x8f/0xb0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81184d0e>] oom_kill_process+0x24e/0x3c0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff811847ad>] ? oom_unkillable_task+0xcd/0x120 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81184856>] ? find_lock_task_mm+0x56/0xc0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81093c0e>] ? has_capability_noaudit+0x1e/0x30 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81185546>] out_of_memory+0x4b6/0x4f0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81682be7>] __alloc_pages_slowpath+0x5d7/0x725 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff8118b655>] __alloc_pages_nodemask+0x405/0x420 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff811cf9ca>] alloc_pages_current+0xaa/0x170 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81180be7>] __page_cache_alloc+0x97/0xb0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81183760>] filemap_fault+0x170/0x410 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffffa01c1016>] ext4_filemap_fault+0x36/0x50 [ext4] Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff811ac83c>] __do_fault+0x4c/0xc0 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff811accd3>] do_read_fault.isra.42+0x43/0x130 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff811b1461>] handle_mm_fault+0x6b1/0x1000 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81692cc4>] __do_page_fault+0x154/0x450 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff81692ff5>] do_page_fault+0x35/0x90 Dec 21 04:53:06 sh-0000034 kernel: [<ffffffff8168f208>] page_fault+0x28/0x30

[ws ERROR] Unexpected error occur: 'AppService' object has no attribute 'get_system_user_cmd_filter_rules'

jumpserver/coco/luna 版本:1.4.3

Python 版本:3.6.6

问题简述

WEB Terminal 登录资产不成功,coco日志报错。

报错如下

2018-10-17 12:28:53 [transport DEBUG] userauth is OK
2018-10-17 12:28:53 [transport INFO] Authentication (publickey) successful!
2018-10-17 12:28:53 [transport DEBUG] Switching on outbound compression ...
2018-10-17 12:28:53 [transport DEBUG] Switching on inbound compression ...
2018-10-17 12:28:53 [channel DEBUG] [chan 0] Max packet in: 32768 bytes
2018-10-17 12:28:53 [transport DEBUG] Received global request "[email protected]"
2018-10-17 12:28:53 [transport DEBUG] Rejecting "[email protected]" global request from server.
2018-10-17 12:28:53 [channel DEBUG] [chan 0] Max packet out: 32768 bytes
2018-10-17 12:28:53 [transport DEBUG] Secsh channel 0 opened.
2018-10-17 12:28:53 [channel DEBUG] [chan 0] Sesch channel 0 request ok
2018-10-17 12:28:53 [channel DEBUG] [chan 0] Sesch channel 0 request ok
2018-10-17 12:28:53 [ws ERROR] Unexpected error occur: 'AppService' object has no attribute 'get_system_user_cmd_filter_rules'

最新的master版本报错,登录不上

2018-04-27 11:17:29 [sshd INFO] Get ssh request from 10.3.2.2: 54166
2018-04-27 11:17:29 [transport INFO] Connected (version 2.0, client OpenSSH_7.6)
2018-04-27 11:17:30 [transport INFO] Auth rejected (none).
2018-04-27 11:17:30 [transport INFO] Auth rejected (publickey).
2018-04-27 11:17:34 [transport ERROR] Unknown exception: unconverted data remains: +0000
2018-04-27 11:17:34 [transport ERROR] Traceback (most recent call last):
2018-04-27 11:17:34 [transport ERROR] File "/usr/local/lib/python3.6/site-packages/paramiko/transport.py", line 1908, in run
2018-04-27 11:17:34 [transport ERROR] handler(self.auth_handler, m)
2018-04-27 11:17:34 [transport ERROR] File "/usr/local/lib/python3.6/site-packages/paramiko/auth_handler.py", line 471, in _parse_userauth_request
2018-04-27 11:17:34 [transport ERROR] username, password)
2018-04-27 11:17:34 [transport ERROR] File "/etc/jumpapp/coco/coco/interface.py", line 61, in check_auth_password
2018-04-27 11:17:34 [transport ERROR] return paramiko.AUTH_FAILED
2018-04-27 11:17:34 [transport ERROR] File "/etc/jumpapp/coco/coco/interface.py", line 82, in validate_auth
2018-04-27 11:17:34 [transport ERROR] logger.warning("Password and public key auth <%s> failed, reject it" % username)
2018-04-27 11:17:34 [transport ERROR] File "/usr/local/lib/python3.6/site-packages/jms/users.py", line 38, in authenticate
2018-04-27 11:17:34 [transport ERROR] File "/usr/local/lib/python3.6/site-packages/jms/models.py", line 18, in from_json
2018-04-27 11:17:34 [transport ERROR] self = cls()
2018-04-27 11:17:34 [transport ERROR] File "/usr/local/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
2018-04-27 11:17:34 [transport ERROR] tt, fraction = _strptime(data_string, format)
2018-04-27 11:17:34 [transport ERROR] File "/usr/local/lib/python3.6/_strptime.py", line 365, in _strptime
2018-04-27 11:17:34 [transport ERROR] data_string[found.end():])
2018-04-27 11:17:34 [transport ERROR] ValueError: unconverted data remains: +0000
2018-04-27 11:17:34 [transport ERROR]

coco登录错误:Permission denied (publickey).

coco注册之后,使用命令:ssh -p 2222 USERNAME@IP登录时总是报错:
(py3) ➜ coco git:(master) ✗ ssh -p 2222 [email protected]
Permission denied (publickey).
(py3) ➜ coco git:(master) ✗ cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
(py3) ➜ coco git:(master) ✗
(py3) ➜ coco git:(master) ✗ ls keys/ -al
total 8
drwxr-xr-x. 2 seven wheel 61 11月 21 11:24 .
drwxr-xr-x. 8 seven wheel 242 11月 21 11:23 ..
-rw-r--r--. 1 seven wheel 73 11月 21 11:24 .access_key
-rw-r--r--. 1 seven wheel 0 9月 5 13:32 .gitkeep
-rw-r--r--. 1 seven wheel 1679 11月 21 11:18 host_rsa_key
(py3) ➜ coco git:(master)
另外请教:
keys/host_rsa_key这个私钥是干什么用的?我试了一下,它并不是自动生成的,而且它不在.gitignore中。

字段名称不一致问题

#7 之前提了一个merge, 修改了proxy.py文件中的变量名, 从is_failed改成了was_faild, 后来发现ProxyLog这个model里面依然使用is_failed字段, 是不是也应该改成was_failed.

def send_proxy_log(self, data):
    """
    :param data: 格式如下
    data = {
        "user": "username",
        "asset": "name",
        "system_user": "web",
        "login_type": "ST",
        "was_failed": False,
        "date_start": timestamp,
    }
    """
    assert isinstance(data.get('date_start'), (int, float))
    data['date_start'] = timestamp_to_datetime_str(data['date_start'])
    data['was_failed'] = 1 if data.get('was_failed') else 0

    r, content = self.post('send-proxy-log', data=data, use_auth=True)
    if r.status_code != 201:
        logging.warning('Send proxy log failed: %s' % content)
        return None
    else:
        return content['id']

def finish_proxy_log(self, data):
    """ 退出登录资产后, 需要汇报结束 时间等

    :param data: 格式如下
    data = {
        "proxy_log_id": 123123,
        "date_finished": timestamp,
    }
    """
    assert isinstance(data.get('date_finished'), (int, float))
    data['date_finished'] = timestamp_to_datetime_str(data['date_finished'])
    data['was_failed'] = 1 if data.get('was_failed') else 0
    data['is_finished'] = 1
    proxy_log_id = data.get('proxy_log_id') or 0
    r, content = self.patch('finish-proxy-log', pk=proxy_log_id, data=data)

    if r.status_code != 200:
        logging.warning('Finish proxy log failed: %s' % proxy_log_id)
        return False
    return True

AttributeError: 'Asset' object has no attribute 'protocol'

2018-07-25 15:49:16 [models DEBUG] Proxy <coco.models.WSProxy object at 0x7f49b0c5cdd8> closed
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/coco/coco/proxy.py", line 47, in proxy
if asset.protocol != system_user.protocol:
AttributeError: 'Asset' object has no attribute 'protocol'

开始以为是没升级sdk,因为环境不支持连外网,我手工更新了jumpserver-python-sdk-0.0.44.tar.gz,通过python setup.py install。

然后还是不行。

jumpserver coco lua都升级1.3.3了

COCO无法分布式部署

理论上讲COCO可以支持分布式部署
我尝试了下出现
2018-03-06 02:24:38 [service DEBUG] Initial app service
2018-03-06 02:24:38 [service DEBUG] Load access key
2018-03-06 02:24:38 [service INFO] No access key found, register it
2018-03-06 02:24:38 [service INFO] "Terminal was not accepted yet"
2018-03-06 02:24:41 [service INFO] "Terminal was not accepted yet"
2018-03-06 02:24:44 [service INFO] "Terminal was not accepted yet"
2018-03-06 02:24:47 [service INFO] "Terminal was not accepted yet"
2018-03-06 02:24:50 [service DEBUG] Set app service auth: ba69968e-396c-4893-a342-0b254ddd6aa0
2018-03-06 02:24:50 [service ERROR] Connect server error or access key is invalid, remove ./keys/.access_key run again
2018-03-06 02:24:53 [service ERROR] Connect server error or access key is invalid, remove ./keys/.access_key run again
2018-03-06 02:24:56 [service ERROR] Connect server error or access key is invalid, remove ./keys/.access_key run again

删除access_key后还是无法成功运行
请问有什么方法吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.