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
9f6291c7
Commit
9f6291c7
authored
Nov 01, 2018
by
wojiushixiaobai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文档
parent
7144fdfb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
623 deletions
+30
-623
distributed_04.rst
docs/distributed_04.rst
+0
-9
quickinstall.rst
docs/quickinstall.rst
+1
-2
setup_by_centos7.rst
docs/setup_by_centos7.rst
+29
-177
setup_by_local.rst
docs/setup_by_local.rst
+0
-435
No files found.
docs/distributed_04.rst
View file @
9f6291c7
...
@@ -45,17 +45,8 @@
...
@@ -45,17 +45,8 @@
$ python3.6 -m venv /opt/py3
$ python3.6 -m venv /opt/py3
$ source /opt/py3/bin/activate
$ source /opt/py3/bin/activate
# 配置 autoenv
$ git clone git://github.com/kennethreitz/autoenv.git
$ echo 'source /opt/autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
# 下载 Jumpserver
# 下载 Jumpserver
$ git clone https://github.com/jumpserver/jumpserver.git
$ git clone https://github.com/jumpserver/jumpserver.git
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env
$ cd /opt/jumpserver && git checkout master && git pull
# 首次进入 jumpserver 文件夹会有提示,按 y 即可
# Are you sure you want to allow this? (y/N) y
# 安装依赖 RPM 包
# 安装依赖 RPM 包
$ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
$ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
...
...
docs/quickinstall.rst
View file @
9f6291c7
一站式、分布式
、组件离线安装
一站式、分布式
安装文档
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
可用于生产环境参考安装文档
可用于生产环境参考安装文档
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
:maxdepth: 1
:maxdepth: 1
在线安装文档 <setup_by_centos7.rst>
在线安装文档 <setup_by_centos7.rst>
组件离线安装文档 <setup_by_local.rst>
分布式部署文档(基于CentOS 7)
分布式部署文档(基于CentOS 7)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
docs/setup_by_centos7.rst
View file @
9f6291c7
...
@@ -60,6 +60,14 @@ CentOS 7 安装文档
...
@@ -60,6 +60,14 @@ CentOS 7 安装文档
> flush privileges;
> flush privileges;
# 安装 Nginx ,用作代理服务器整合 Jumpserver 与各个组件
# 安装 Nginx ,用作代理服务器整合 Jumpserver 与各个组件
$ vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
$ yum -y install nginx
$ yum -y install nginx
$ systemctl enable nginx
$ systemctl enable nginx
...
@@ -74,29 +82,16 @@ CentOS 7 安装文档
...
@@ -74,29 +82,16 @@ CentOS 7 安装文档
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,载入环境后默认以下所有命令均在该虚拟环境中运行
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,载入环境后默认以下所有命令均在该虚拟环境中运行
(py3) [root@localhost py3]
(py3) [root@localhost py3]
# 自动载入 Python3 虚拟环境
# 下载 Jumpserver
$ cd /opt
$ git clone https://github.com/kennethreitz/autoenv.git
$ echo 'source /opt/autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
# 下载 Jumpserver 与 Coco
$ cd /opt/
$ cd /opt/
$ git clone https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master && git pull
$ git clone https://github.com/jumpserver/jumpserver.git
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 jumpserver 目录时将自动载入 python 虚拟环境
$ cd /opt/
$ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master && git pull
$ echo "source /opt/py3/bin/activate" > /opt/coco/.env # 进入 coco 目录时将自动载入 python 虚拟环境
# 安装依赖 RPM 包
# 安装依赖 RPM 包
$ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
$ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
$ yum -y install $(cat /opt/coco/requirements/rpm_requirements.txt)
# 安装 Python 库依赖
# 安装 Python 库依赖
$ pip install --upgrade pip
$ pip install --upgrade pip
$ pip install -r /opt/jumpserver/requirements/requirements.txt
$ pip install -r /opt/jumpserver/requirements/requirements.txt
$ pip install -r /opt/coco/requirements/requirements.txt
::
::
...
@@ -106,8 +101,6 @@ CentOS 7 安装文档
...
@@ -106,8 +101,6 @@ CentOS 7 安装文档
$ cp config_example.py config.py
$ cp config_example.py config.py
$ vi config.py
$ vi config.py
# 注意对齐,不要直接复制本文档的内容,实际内容以文件为准,本文仅供参考
**注意: 配置文件是 Python 格式,不要用 TAB,而要用空格**
**注意: 配置文件是 Python 格式,不要用 TAB,而要用空格**
::
::
...
@@ -195,161 +188,41 @@ CentOS 7 安装文档
...
@@ -195,161 +188,41 @@ CentOS 7 安装文档
::
::
# 生成数据库表结构和初始化数据
$ cd /opt/jumpserver/utils
$ bash make_migrations.sh
# 修改 Coco 配置文件
# 运行 Jumpserver
$ cd /opt/coco
$ cd /opt/jumpserver
$ mkdir keys logs
$ ./jms start all # 后台运行使用 -d 参数./jms start all -d
$ cp conf_example.py conf.py
# 新版本更新了运行脚本,使用方式./jms start|stop|status|restart all 后台运行请添加 -d 参数
$ vi conf.py
# 注意对齐,不要直接复制本文档的内容
**注意: 配置文件是 Python 格式,不要用 TAB,而要用空格**
::
::
#!/usr/bin/env python3
# 安装 docker 部署 coco 与 guacamole
# -*- coding: utf-8 -*-
$ yum install -y yum-utils device-mapper-persistent-data lvm2
#
$ yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
$ yum makecache fast
import os
$ yum -y install docker-ce
$ systemctl start docker
BASE_DIR = os.path.dirname(__file__)
$ systemctl enable docker
class Config:
"""
Coco config file, coco also load config from server update setting below
"""
# 项目名称, 会用来向Jumpserver注册, 识别而已, 不能重复
# NAME = "localhost"
NAME = "coco"
# Jumpserver项目的url, api请求注册会使用, 如果Jumpserver没有运行在127.0.0.1:8080,请修改此处
# CORE_HOST = os.environ.get("CORE_HOST") or 'http://127.0.0.1:8080'
CORE_HOST = 'http://127.0.0.1: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 = 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_LEVEL = 'WARN'
# 日志存放的目录
# LOG_DIR = os.path.join(BASE_DIR, 'logs')
# Session录像存放目录
# 注意,<Jumpserver_url> 请自行修改成 jumpserver 对外的访问地址,如 192.168.100.100:8080
# SESSION_DIR = os.path.join(BASE_DIR, 'sessions')
$ docker run --name jms_coco -d -p 2222:2222 -p 5000:5000 -e CORE_HOST=http://<Jumpserver_url> wojiushixiaobai/coco:1.4.3
$ docker run --name jms_guacamole -d -p 8081:8081 -e JUMPSERVER_SERVER=http://<Jumpserver_url> wojiushixiaobai/guacamole:1.4.3
# 资产显示排序方式, ['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()
::
::
# 安装 Web Terminal 前端: Luna 需要 Nginx 来运行访问 访问(https://github.com/jumpserver/luna/releases)下载对应版本的 release 包,直接解压,不需要编译
# 安装 Web Terminal 前端: Luna 需要 Nginx 来运行访问 访问(https://github.com/jumpserver/luna/releases)下载对应版本的 release 包,直接解压,不需要编译
$ cd /opt
$ cd /opt
$ wget https://github.com/jumpserver/luna/releases/download/1.4.3/luna.tar.gz
$ wget https://github.com/jumpserver/luna/releases/download/1.4.3/luna.tar.gz
$ tar xvf luna.tar.gz
$ tar xvf luna.tar.gz
$ chown -R root:root luna
$ chown -R root:root luna
# 安装 Windows 支持组件(如果不需要管理 windows 资产,可以直接跳过这一步)
$ yum -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
$ rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
$ rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
$ yum install -y git gcc java-1.8.0-openjdk libtool
$ yum install -y cairo-devel libjpeg-turbo-devel libpng-devel uuid-devel
$ yum install -y ffmpeg-devel freerdp-devel pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel ghostscript
$ ln -s /usr/local/lib/freerdp/guacsnd.so /usr/lib64/freerdp/
$ ln -s /usr/local/lib/freerdp/guacdr.so /usr/lib64/freerdp/
$ ln -s /usr/local/lib/freerdp/guacai.so /usr/lib64/freerdp/
$ ln -s /usr/local/lib/freerdp/guacsvc.so /usr/lib64/freerdp/
$ cd /opt
$ git clone https://github.com/jumpserver/docker-guacamole.git
$ cd /opt/docker-guacamole/
$ tar -xf guacamole-server-0.9.14.tar.gz
$ cd guacamole-server-0.9.14
$ autoreconf -fi
$ ./configure --with-init-dir=/etc/init.d
$ make && make install
$ cd ..
$ rm -rf guacamole-server-0.9.14.tar.gz guacamole-server-0.9.14
$ ldconfig
$ mkdir -p /config/guacamole /config/guacamole/lib /config/guacamole/extensions # 创建 guacamole 目录
$ cp /opt/docker-guacamole/guacamole-auth-jumpserver-0.9.14.jar /config/guacamole/extensions/guacamole-auth-jumpserver-0.9.14.jar
$ cp /opt/docker-guacamole/root/app/guacamole/guacamole.properties /config/guacamole/ # guacamole 配置文件
$ cd /config
$ wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34.tar.gz
$ tar xf apache-tomcat-8.5.34.tar.gz
$ rm -rf apache-tomcat-8.5.34.tar.gz
$ mv apache-tomcat-8.5.34 tomcat8
$ rm -rf /config/tomcat8/webapps/*
$ cp /opt/docker-guacamole/guacamole-0.9.14.war /config/tomcat8/webapps/ROOT.war # guacamole client
$ sed -i 's/Connector port="8080"/Connector port="8081"/g' `grep 'Connector port="8080"' -rl /config/tomcat8/conf/server.xml` # 修改默认端口为 8081
$ sed -i 's/FINE/WARNING/g' `grep 'FINE' -rl /config/tomcat8/conf/logging.properties` # 修改 log 等级为 WARNING
$ export JUMPSERVER_SERVER=http://127.0.0.1:8080 # http://127.0.0.1:8080 指 jumpserver 访问地址
$ echo "export JUMPSERVER_SERVER=http://127.0.0.1:8080" >> ~/.bashrc
$ export JUMPSERVER_ENABLE_DRIVE=true
$ echo "export JUMPSERVER_ENABLE_DRIVE=true " >> ~/.bashrc
$ export JUMPSERVER_KEY_DIR=/config/guacamole/keys
$ echo "export JUMPSERVER_KEY_DIR=/config/guacamole/keys" >> ~/.bashrc
$ export GUACAMOLE_HOME=/config/guacamole
$ echo "export GUACAMOLE_HOME=/config/guacamole" >> ~/.bashrc
::
::
# 配置 Nginx 整合各组件
# 配置 Nginx 整合各组件
$ rm -rf /etc/nginx/conf.d/default.conf
$ vim /etc/nginx/conf.d/jumpserver.conf
$ vim /etc/nginx/conf.d/jumpserver.conf
server {
server {
...
@@ -411,26 +284,8 @@ CentOS 7 安装文档
...
@@ -411,26 +284,8 @@ CentOS 7 安装文档
}
}
}
}
::
# 生成数据库表结构和初始化数据
$ cd /opt/jumpserver/utils
$ bash make_migrations.sh
# 运行 Jumpserver
$ cd /opt/jumpserver
$ ./jms start all # 后台运行使用 -d 参数./jms start all -d
# 新版本更新了运行脚本,使用方式./jms start|stop|status|restart all 后台运行请添加 -d 参数
# 运行 Coco
::
$ cd /opt/coco
$ ./cocod start # 后台运行使用 -d 参数./cocod start -d
# 新版本更新了运行脚本,使用方式./cocod start|stop|status|restart 后台运行请添加 -d 参数
# 运行 Guacamole
$ /etc/init.d/guacd start
$ sh /config/tomcat8/bin/startup.sh
# 运行 Nginx
# 运行 Nginx
$ nginx -t # 确保配置没有问题, 有问题请先解决
$ nginx -t # 确保配置没有问题, 有问题请先解决
...
@@ -452,8 +307,5 @@ CentOS 7 安装文档
...
@@ -452,8 +307,5 @@ CentOS 7 安装文档
# sftp默认上传的位置在资产的 /tmp 目录下
# sftp默认上传的位置在资产的 /tmp 目录下
# windows拖拽上传的位置在资产的 Guacamole RDP上的 G 目录下
# windows拖拽上传的位置在资产的 Guacamole RDP上的 G 目录下
# 其他的ssh及sftp客户端这里就不多做说明,自行搜索使用
后续的使用请参考 `快速入门 <admin_create_asset.html>`_
后续的使用请参考 `快速入门 <admin_create_asset.html>`_
如遇到问题可参考 `FAQ <faq.html>`_
如遇到问题可参考 `FAQ <faq.html>`_
docs/setup_by_local.rst
deleted
100644 → 0
View file @
7144fdfb
CentOS 7 组件离线安装文档
--------------------------------------------
说明
~~~~~~~
- 请用新的服务器进行安装
- 本文档适用于网络较差的环境,非完全离线安装(仅提供一些因为网络问题无法下载或者下载慢的组件)
- 安装过程中遇到问题可参考 `安装过程中常见的问题 <faq_install.html>`_
百度云盘:https://pan.baidu.com/s/1FmD-cQp_TsT1OI_U5eFLUw
开始安装
~~~~~~~~~~~~
::
# 把下载的压缩包上传到要安装的服务器任意目录,然后在该目录执行下面命令
$ tar xf Python-3.6.1.tar.xz -C /opt
$ tar xf jumpserver.tar.gz -C /opt
$ tar xf coco.tar.gz -C /opt
$ tar xf luna.tar.gz -C /opt
$ tar xf package.tar.gz -C /opt
$ tar xf autoenv.tar.gz -C /opt
$ mv guacamole.tar /opt
# yum update -y
# 防火墙 与 selinux 设置说明,如果已经关闭了 防火墙 和 Selinux 的用户请跳过设置
$ systemctl start firewalld
$ firewall-cmd --zone=public --add-port=80/tcp --permanent # Jumpserver 对外端口
$ firewall-cmd --zone=public --add-port=2222/tcp --permanent # 用户SSH登录端口 coco
--permanent 永久生效,没有此参数重启后失效
$ firewall-cmd --reload # 重新载入规则
$ setsebool -P httpd_can_network_connect 1 # 设置 selinux 允许 http 访问
$ mkdir -p /opt/guacamole/key
$ chcon -Rt svirt_sandbox_file_t /opt/guacamole/key # 设置 selinux 允许容器对目录读写
# 修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文
$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
$ export LC_ALL=zh_CN.UTF-8
$ echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf
# 安装依赖包
$ yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git
# 安装 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
$ yum -y install redis
$ systemctl enable redis
$ systemctl start redis
# 安装 MySQL,如果不使用 Mysql 可以跳过相关 Mysql 安装和配置,支持sqlite3, mysql, postgres等
$ yum -y install mariadb mariadb-devel mariadb-server # centos7下叫mariadb,用法与mysql一致
$ systemctl enable mariadb
$ systemctl start mariadb
# 创建数据库 Jumpserver 并授权
$ mysql -uroot
> create database jumpserver default charset 'utf8';
> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'weakPassword';
> flush privileges;
# 安装 Nginx ,用作代理服务器整合 Jumpserver 与各个组件
$ yum -y install nginx
$ systemctl enable nginx
# 编译 Python3.6.1
$ cd /opt/Python-3.6.1
$ ./configure && make && make install
# 配置并载入 Python3 虚拟环境
$ cd /opt
$ python3 -m venv py3 # py3 为虚拟环境名称,可自定义
$ source /opt/py3/bin/activate # 退出虚拟环境可以使用 deactivate 命令
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,载入环境后默认以下所有命令均在该虚拟环境中运行
(py3) [root@localhost py3]
# 自动载入 Python3 虚拟环境
$ cd /opt
$ echo 'source /opt/autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
# 升级 Jumpserver 与 Coco
$ cd /opt/jumpserver && git checkout master && git pull
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 jumpserver 目录时将自动载入 python 虚拟环境
$ cd /opt/coco && git checkout master && git pull
$ echo "source /opt/py3/bin/activate" > /opt/coco/.env # 进入 coco 目录时将自动载入 python 虚拟环境
# 安装依赖 RPM 包
$ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
$ yum -y install $(cat /opt/coco/requirements/rpm_requirements.txt)
# 安装 Python 库依赖
$ pip install --no-index --find-links="/opt/package/" --upgrade pip
$ pip install -r /opt/jumpserver/requirements/requirements.txt --no-index --find-links="/opt/package/jumpserver/"
$ pip install -r /opt/coco/requirements/requirements.txt --no-index --find-links="/opt/package/coco/"
::
# 修改 Jumpserver 配置文件
$ cd /opt/jumpserver
$ cp config_example.py config.py
$ vi config.py
# 注意对齐,不要直接复制本文档的内容,实际内容以文件为准,本文仅供参考
**注意: 配置文件是 Python 格式,不要用 TAB,而要用空格**
::
"""
jumpserver.config
~~~~~~~~~~~~~~~~~
Jumpserver project setting file
:copyright: (c) 2014-2017 by Jumpserver Team
:license: GPL v2, see LICENSE for more details.
"""
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class Config:
# Use it to encrypt or decrypt data
# Jumpserver 使用 SECRET_KEY 进行加密,请务必修改以下设置
# SECRET_KEY = os.environ.get('SECRET_KEY') or '2vym+ky!997d5kkcc64mnz06y1mmui3lut#(^wd=%s_qj$1%x'
SECRET_KEY = '请随意输入随机字符串(推荐字符大于等于 50位)'
# Django security setting, if your disable debug model, you should setting that
ALLOWED_HOSTS = ['*']
# DEBUG 模式 True为开启 False为关闭,默认开启,生产环境推荐关闭
# 注意:如果设置了DEBUG = False,访问8080端口页面会显示不正常,需要搭建 nginx 代理才可以正常访问
DEBUG = os.environ.get("DEBUG") or False
# 日志级别,默认为DEBUG,可调整为INFO, WARNING, ERROR, CRITICAL,默认INFO
LOG_LEVEL = os.environ.get("LOG_LEVEL") or 'WARNING'
LOG_DIR = os.path.join(BASE_DIR, 'logs')
# 使用的数据库配置,支持sqlite3, mysql, postgres等,默认使用sqlite3
# See https://docs.djangoproject.com/en/1.10/ref/settings/#databases
# 默认使用SQLite3,如果使用其他数据库请注释下面两行
# DB_ENGINE = 'sqlite3'
# DB_NAME = os.path.join(BASE_DIR, 'data', 'db.sqlite3')
# 如果需要使用mysql或postgres,请取消下面的注释并输入正确的信息,本例使用mysql做演示(mariadb也是mysql)
DB_ENGINE = os.environ.get("DB_ENGINE") or 'mysql'
DB_HOST = os.environ.get("DB_HOST") or '127.0.0.1'
DB_PORT = os.environ.get("DB_PORT") or 3306
DB_USER = os.environ.get("DB_USER") or 'jumpserver'
DB_PASSWORD = os.environ.get("DB_PASSWORD") or 'weakPassword'
DB_NAME = os.environ.get("DB_NAME") or 'jumpserver'
# Django 监听的ip和端口,生产环境推荐把0.0.0.0修改成127.0.0.1,这里的意思是允许x.x.x.x访问,127.0.0.1表示仅允许自身访问
# ./manage.py runserver 127.0.0.1:8080
HTTP_BIND_HOST = '127.0.0.1'
HTTP_LISTEN_PORT = 8080
# Redis 相关设置
REDIS_HOST = os.environ.get("REDIS_HOST") or '127.0.0.1'
REDIS_PORT = os.environ.get("REDIS_PORT") or 6379
REDIS_PASSWORD = os.environ.get("REDIS_PASSWORD") or ''
REDIS_DB_CELERY = os.environ.get('REDIS_DB') or 3
REDIS_DB_CACHE = os.environ.get('REDIS_DB') or 4
def __init__(self):
pass
def __getattr__(self, item):
return None
class DevelopmentConfig(Config):
pass
class TestConfig(Config):
pass
class ProductionConfig(Config):
pass
# Default using Config settings, you can write if/else for different env
config = DevelopmentConfig()
::
# 修改 Coco 配置文件
$ cd /opt/coco
$ mkdir keys logs
$ cp conf_example.py conf.py
$ vi conf.py
# 注意对齐,不要直接复制本文档的内容
**注意: 配置文件是 Python 格式,不要用 TAB,而要用空格**
::
#!/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"
NAME = "coco"
# Jumpserver项目的url, api请求注册会使用, 如果Jumpserver没有运行在127.0.0.1:8080,请修改此处
# CORE_HOST = os.environ.get("CORE_HOST") or 'http://127.0.0.1:8080'
CORE_HOST = 'http://127.0.0.1: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 = 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_LEVEL = 'WARN'
# 日志存放的目录
# 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()
::
# 配置 Web Terminal 前端: Luna 需要 Nginx 来运行访问
$ cd /opt
$ chown -R root:root luna
# 安装 Windows 支持组件
$ yum remove docker-latest-logrotate docker-logrotate docker-selinux dockdocker-engine
$ yum install -y yum-utils device-mapper-persistent-data lvm2
# 国外使用 docker 官方源
$ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 国内请使用阿里云镜像源
$ yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
$ rpm --import http://mirrors.aliyun.com/docker-ce/linux/centos/gpg
$ yum makecache fast
$ yum install docker-ce
$ systemctl enable docker
$ systemctl start docker
$ docker load < /opt/guacamole.tar
::
# 配置 Nginx 整合各组件
$ vim /etc/nginx/conf.d/jumpserver.conf
server {
listen 80;
server_name demo.jumpserver.org; # 修改成你的域名
client_max_body_size 100m; # 录像及文件上传大小限制
location /luna/ {
try_files $uri / /index.html;
alias /opt/luna/; # luna 路径,如果修改安装目录,此处需要修改
}
location /media/ {
add_header Content-Encoding gzip;
root /opt/jumpserver/data/; # 录像位置,如果修改安装目录,此处需要修改
}
location /static/ {
root /opt/jumpserver/data/; # 静态资源,如果修改安装目录,此处需要修改
}
location /socket.io/ {
proxy_pass http://localhost:5000/socket.io/; # 如果coco安装在别的服务器, 请填写它的ip
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}
location /coco/ {
proxy_pass http://localhost:5000/coco/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}
location /guacamole/ {
proxy_pass http://localhost:8081/; # 如果docker安装在别的服务器, 请填写它的ip
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}
location / {
proxy_pass http://localhost:8080; # 如果jumpserver安装在别的服务器, 请填写它的ip
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
::
# 生成数据库表结构和初始化数据
$ cd /opt/jumpserver/utils
$ bash make_migrations.sh
# 运行 Jumpserver
$ cd /opt/jumpserver
$ ./jms start all # 后台运行使用 -d 参数./jms start all -d
# 新版本更新了运行脚本,使用方式./jms start|stop|status|restart all 后台运行请添加 -d 参数
# 运行 Coco
$ cd /opt/coco
$ cp conf_example.py conf.py
$ ./cocod start # 后台运行使用 -d 参数./cocod start -d
# 新版本更新了运行脚本,使用方式./cocod start|stop|status|restart 后台运行请添加 -d 参数
# 运行 Guacamole
# 注意:这里需要修改下 http://<填写jumpserver的url地址> 例: http://192.168.244.144 不能使用 127.0.0.1
$ docker run --name jms_guacamole -d \
-p 8081:8080 -v /opt/guacamole/key:/config/guacamole/key \
-e JUMPSERVER_KEY_DIR=/config/guacamole/key \
-e JUMPSERVER_SERVER=http://<填写jumpserver的url地址> \
jumpserver/guacamole:latest
# docker 重启容器的方法docker restart jms_guacamole
# 运行 Nginx
$ nginx -t # 确保配置没有问题, 有问题请先解决
$ systemctl start nginx
# 访问 http://192.168.244.144 (注意,没有 :8080,通过 nginx 代理端口进行访问)
# 默认账号: admin 密码: admin 到会话管理-终端管理 接受 Coco Guacamole 等应用的注册
# 测试连接
$ ssh -p2222 admin@192.168.244.144
$ sftp -P2222 admin@192.168.244.144
密码: admin
# 如果是用在 Windows 下,Xshell Terminal 登录语法如下
$ ssh admin@192.168.244.144 2222
$ sftp admin@192.168.244.144 2222
密码: admin
如果能登陆代表部署成功
# sftp默认上传的位置在资产的 /tmp 目录下
# windows拖拽上传的位置在资产的 Guacamole RDP上的 G 目录下
后续的使用请参考 `快速入门 <admin_create_asset.html>`_
如遇到问题可参考 `FAQ <faq.html>`_
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