Unverified Commit 60545fcd authored by 老广's avatar 老广 Committed by GitHub

[Update] 修改配置文件格式 (#171)

parent ada52cc9
......@@ -9,3 +9,4 @@ conf.py
host_rsa_key
sessions/*
coco.pid
config.yml
......@@ -9,7 +9,7 @@ import threading
import json
import signal
from .config import config
from .conf import config
from .sshd import SSHServer
from .httpd import HttpServer
from .tasks import TaskHandler
......
This diff is collapsed.
......@@ -14,7 +14,7 @@ except ImportError:
import paramiko
from .service import app_service
from .config import config
from .conf import config
from .utils import get_logger, get_private_key_fingerprint
logger = get_logger(__file__)
......
......@@ -6,7 +6,7 @@ from flask_socketio import SocketIO
from flask import Flask
from coco.utils import get_logger
from coco.config import config
from coco.conf import config
from coco.httpd.ws import ProxyNamespace, ElfinderNamespace
logger = get_logger(__file__)
......
......@@ -10,7 +10,7 @@ from ..models import Connection, WSProxy
from ..proxy import ProxyServer
from ..utils import get_logger
from ..service import app_service
from ..config import config
from ..conf import config
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
logger = get_logger(__file__)
......
......@@ -11,7 +11,7 @@ import time
from treelib import Tree
from . import char
from .config import config
from .conf import config
from .utils import wrap_with_line_feed as wr, wrap_with_title as title, \
wrap_with_warning as warning, is_obj_attr_has, is_obj_attr_eq, \
sort_assets, ugettext as _, get_logger, net_input, format_with_zh, \
......
......@@ -7,7 +7,7 @@ import threading
from collections import Iterable
from .utils import get_logger
from .config import config
from .conf import config
from .service import app_service
logger = get_logger(__file__)
......
......@@ -5,7 +5,7 @@
import os
import logging
from logging.config import dictConfig
from .config import config as app_config
from .conf import config as app_config
def create_logger():
......
......@@ -9,7 +9,7 @@ from .session import Session
from .models import Server, TelnetServer
from .connection import SSHConnection, TelnetConnection
from .service import app_service
from .config import config
from .conf import config
from .utils import wrap_with_line_feed as wr, wrap_with_warning as warning, \
get_logger, net_input, ugettext as _, ignore_error
......
......@@ -12,7 +12,7 @@ from copy import deepcopy
import jms_storage
from .config import config
from .conf import config
from .utils import get_logger, Singleton
from .struct import MemoryQueue
from .service import app_service
......
......@@ -2,7 +2,7 @@
#
from jms.service import AppService
from .config import config
from .conf import config
inited = False
......
......@@ -8,7 +8,7 @@ from paramiko.sftp import SFTP_PERMISSION_DENIED, SFTP_NO_SUCH_FILE, \
SFTP_FAILURE, SFTP_EOF, SFTP_CONNECTION_LOST
from coco.utils import get_logger
from .config import config
from .conf import config
from .service import app_service
from .connection import SSHConnection
......
......@@ -14,7 +14,7 @@ from coco.interface import SSHInterface
from coco.interactive import InteractiveServer
from coco.models import Connection
from coco.sftp import SFTPServer
from coco.config import config
from coco.conf import config
logger = get_logger(__file__)
BACKLOG = 5
......
......@@ -17,7 +17,7 @@ import paramiko
import pyte
from . import char
from .config import config
from .conf import config
BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
......
......@@ -25,9 +25,8 @@ for d in dirs:
from coco import Coco
try:
from conf import config
from coco.conf import config
except ImportError:
print("Please prepare config file `cp conf_example.py conf.py`")
sys.exit(1)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os
BASE_DIR = os.path.dirname(__file__)
class Config:
"""
Coco config file, coco also load config from server update setting below
"""
# 项目名称, 会用来向Jumpserver注册, 识别而已, 不能重复
# NAME = "localhost"
# Jumpserver项目的url, api请求注册会使用
# CORE_HOST = os.environ.get("CORE_HOST") or 'http://127.0.0.1:8080'
# Bootstrap Token, 预共享秘钥, 用来注册coco使用的service account和terminal
# 请和jumpserver 配置文件中保持一致,注册完成后可以删除
# BOOTSTRAP_TOKEN = "PleaseChangeMe"
# 启动时绑定的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 = None
# ACCESS KEY 保存的地址, 默认注册后会保存到该文件中
# ACCESS_KEY_STORE = os.path.join(BASE_DIR, 'keys', '.access_key')
# 加密密钥
# SECRET_KEY = None
# 设置日志级别 ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'CRITICAL']
# LOG_LEVEL = 'INFO'
# 日志存放的目录
# LOG_DIR = os.path.join(BASE_DIR, 'logs')
# Session录像存放目录
# SESSION_DIR = os.path.join(BASE_DIR, 'sessions')
# 资产显示排序方式, ['ip', 'hostname']
# ASSET_LIST_SORT_BY = 'ip'
# 登录是否支持密码认证
# PASSWORD_AUTH = True
# 登录是否支持秘钥认证
# PUBLIC_KEY_AUTH = True
# SSH白名单
# ALLOW_SSH_USER = 'all' # ['test', 'test2']
# SSH黑名单, 如果用户同时在白名单和黑名单,黑名单优先生效
# BLOCK_SSH_USER = []
# 和Jumpserver 保持心跳时间间隔
# HEARTBEAT_INTERVAL = 5
# Admin的名字,出问题会提示给用户
# ADMINS = ''
COMMAND_STORAGE = {
"TYPE": "server"
}
REPLAY_STORAGE = {
"TYPE": "server"
}
# SSH连接超时时间 (default 15 seconds)
# SSH_TIMEOUT = 15
# 语言 = en
LANGUAGE_CODE = 'zh'
config = Config()
# 项目名称, 会用来向Jumpserver注册, 识别而已, 不能重复
# NAME: {{ Hostname }}
# Jumpserver项目的url, api请求注册会使用
CORE_HOST: http://127.0.0.1:8080
# Bootstrap Token, 预共享秘钥, 用来注册coco使用的service account和terminal
# 请和jumpserver 配置文件中保持一致,注册完成后可以删除
BOOTSTRAP_TOKEN: <ChangeIT>
# 启动时绑定的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: null
# ACCESS KEY 保存的地址, 默认注册后会保存到该文件中
# ACCESS_KEY_STORE: keys/.access_key
# 加密密钥
# SECRET_KEY: null
# 设置日志级别 ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'CRITICAL']
# LOG_LEVEL: INFO
# 日志存放的目录
# LOG_DIR: logs
# SSH白名单
# ALLOW_SSH_USER: 'all'
# SSH黑名单, 如果用户同时在白名单和黑名单,黑名单优先生效
# BLOCK_SSH_USER:
# -
# 和Jumpserver 保持心跳时间间隔
# HEARTBEAT_INTERVAL: 5
# Admin的名字,出问题会提示给用户
# ADMINS: ''
# SSH连接超时时间 (default 15 seconds)
# SSH_TIMEOUT: 15
# 语言 = en
# LANGUAGE_CODE: zh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment