Jumpserver堡垒机部署
jumpserver的介绍
为了保证服务器安全,加个堡垒机,所有ssh连接都通过堡垒机来完成,堡垒机也需要有身份认证,授权,访问控制,审计等功能。
Jumpserver 是一款由python编写开源的跳板机(堡垒机)系统,实现了跳板机应有的功能。基于ssh协议来管理,客户端无需安装agent。
支持常见系统:
CentOS, RedHat, Fedora, Amazon Linux,Debian,SUSE, Ubuntu,FreeBSD 其他ssh协议硬件设备
Jumpserver 后端主要技术是LDAP,配置了LDAP 集中认证服务器, 所有服务器的认证都是由ldap完成的。其做法是:每个用户一个密码,把密码加密放到了数据库中,当用户输入IP 从跳板机登陆服务器的时候,跳板机系统取出密码,并解密,通过pexpect 模块将密码发送过去,来完成登录。
架构图如下
Jumpserver 是完全开源的项目,安全,透明,免费,方便二次开发;因为jumpserver本身已包含大部分跳板机的功能,一些中小型企业可以直接安装并使用;
基于代码开源的情况,有技术实力的团队可以根据其源码进行适合自己的二次开发;
由于其拥有时尚的外观和直观的功能以及简单地安装配置等特色,是步入自动化运维的不二选择;其后端数据存储使用的是MySQL数据库,因此建议使用前先行配置及部署好MySQL数据库。
通过web端登录系统后界面如下:
特点介绍
Jumpserver拥有以下特点:
完全开源,GPL授权 Python编写,容易再次开发 实现了跳板机基本功能,认证、授权、审计 集成了Ansible,批量命令等 支持WebTerminal Bootstrap编写,界面美观 自动收集硬件信息 录像回放 命令搜索 实时监控 批量上传下载
基于其特点,Jumpserver能够实现跳板机常见需求,如授权、用户管理、服务器基本信息记录等,同时又可批量执行脚本等功能;其中录像回放、命令搜索、实时监控等特点,又能帮助运维人员回溯操作历史,方便查找操作痕迹,便于管理其他人员对服务器的操作控制。
部署Jumpserver环境
官网推荐安装环境
操作系统: Centos7
CPU: 64位双核处理器
内存: 4G DDR3
数据库:mysql 版本大于等于 5.6 mariadb 版本大于等于 5.5.6
1、搭建环境前期准备
[root@ansible ~]# systemctl stop firewalld
[root@ansible ~]# iptables -F
[root@ansible ~]# setenforce 0
[root@ansible ~]# hostname jumpserver
[root@ansible ~]# bash
2、准备Python3和Python虚拟环境
[root@jumpserver ~]# yum install wget gcc git -y
[root@jumpserver ~]# rz
上传epel-release-latest-7.noarch.rpm 源码包
[root@jumpserver ~]# rpm -ivh epel-release-latest-7.noarch.rpm
警告:epel-release-latest-7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:epel-release-7-11 ################################# [100%]
[root@jumpserver ~]# cd /etc/yum.repos.d/
[root@jumpserver yum.repos.d]# mv a/CentOS-Base.repo ./
[root@jumpserver yum.repos.d]# cd
安装 Python3.6
[root@jumpserver ~]# yum -y install python3.6 python36-devel python-pip
建立 Python 虚拟环境
因为 CentOS 7 自带的是 Python2,而 Yum 等工具依赖原来的 Python, 为了不扰乱原来的环境我们来使用 Python虚拟环境
[root@jumpserver ~]# cd /opt/
[root@jumpserver opt]# python3.6 -m venv py3
[root@jumpserver opt]# source /opt/py3/bin/activate
3、安装Jumpserver
下载或 Clone 项目
(py3) [root@jumpserver opt]# git clone --depth=1 https://github.com/jumpserver/jumpserver.git
正克隆到 'jumpserver'...
remote: Enumerating objects: 1210, done.
remote: Counting objects: 100% (1210/1210), done.
remote: Compressing objects: 100% (1083/1083), done.
remote: Total 1210 (delta 197), reused 633 (delta 65), pack-reused 0
接收对象中: 100% (1210/1210), 7.19 MiB | 65.00 KiB/s, done.
处理 delta 中: 100% (197/197), done.
安装依赖 RPM 包
(py3) [root@jumpserver opt]# cd /opt/jumpserver/requirements/
(py3) [root@jumpserver requirements]# yum -y install $(cat rpm_requirements.txt)
安装 Python 库依赖
(py3) [root@jumpserver requirements]# pip install --upgrade pip setuptools
(py3) [root@jumpserver requirements]# pip install -r requirements.txt
安装 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
(py3) [root@jumpserver requirements]# yum -y install redis
(py3) [root@jumpserver requirements]# systemctl start redis
(py3) [root@jumpserver requirements]# systemctl enable redis
4、安装 MySQL
(py3) [root@jumpserver requirements]# yum install mariadb mariadb-server mariadb-devel -y
(py3) [root@jumpserver requirements]# systemctl restart mariadb
(py3) [root@jumpserver requirements]# systemctl enable mariadb
创建数据库 Jumpserver 并授权,生成随机数据库密码
(py3) [root@jumpserver requirements]# DB_PASSWORD=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 24`
(py3) [root@jumpserver requirements]# echo -e "\033[31m 你的数据库密码是 $DB_PASSWORD \033[0m"
你的数据库密码是 VugcsJK6jq8wRpsAVUQTPvPs
(py3) [root@jumpserver requirements]# mysql -uroot -e "create database jumpserver default charset 'utf8'; grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by '$DB_PASSWORD'; flush privileges;"
5、修改 Jumpserver 配置文件
(py3) [root@jumpserver requirements]# cd /opt/jumpserver
(py3) [root@jumpserver jumpserver]# cp config_example.yml config.yml
生成随机SECRET_KEY
(py3) [root@jumpserver jumpserver]# SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`
(py3) [root@jumpserver jumpserver]# echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc
生成随机BOOTSTRAP_TOKEN
(py3) [root@jumpserver jumpserver]# BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16`
(py3) [root@jumpserver jumpserver]# echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc
修改配置文件内容:
(py3) [root@jumpserver jumpserver]# sed -i "s/SECRET_KEY:/SECRET_KEY: $SECRET_KEY/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/BOOTSTRAP_TOKEN:/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/# DEBUG: true/DEBUG: false/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/# LOG_LEVEL: DEBUG/LOG_LEVEL: ERROR/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/# SESSION_EXPIRE_AT_BROWSER_CLOSE: false/SESSION_EXPIRE_AT_BROWSER_CLOSE: true/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/DB_PASSWORD: /DB_PASSWORD: $DB_PASSWORD/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# echo -e "\033[31m 你的SECRET_KEY是 $SECRET_KEY \033[0m"
你的SECRET_KEY是 Un5Nkaf4WLyPwzm7lEIbOgvG8vrJvxU6F78zWr9LvKBMkONza6
(py3) [root@jumpserver jumpserver]# echo -e "\033[31m 你的BOOTSTRAP_TOKEN是 $BOOTSTRAP_TOKEN \033[0m"
你的BOOTSTRAP_TOKEN是 2lv07mBOr6hD6XwV
确认内容有没有错误
(py3) [root@jumpserver jumpserver]# vim config.yml
# SECURITY WARNING: keep the secret key used in production secret!
# 加密秘钥 生产环境中请修改为随机字符串,请勿外泄, 可使用命令生成
# $ cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 49;echo
SECRET_KEY: Un5Nkaf4WLyPwzm7lEIbOgvG8vrJvxU6F78zWr9LvKBMkONza6
# SECURITY WARNING: keep the bootstrap token used in production secret!
# 预共享Token coco和guacamole用来注册服务账号,不在使用原来的注册接受机制
BOOTSTRAP_TOKEN: 2lv07mBOr6hD6XwV
# Development env open this, when error occur display the full process track, Production disable it
# DEBUG 模式 开启DEBUG后遇到错误时可以看到更多日志
DEBUG: false
# DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/
# 日志级别
LOG_LEVEL: ERROR
# LOG_DIR:
# Session expiration setting, Default 24 hour, Also set expired on on browser close
# 浏览器Session过期时间,默认24小时, 也可以设置浏览器关闭则过期
# SESSION_COOKIE_AGE: 86400
SESSION_EXPIRE_AT_BROWSER_CLOSE: true
# Database setting, Support sqlite3, mysql, postgres ....
# 数据库设置
# See https://docs.djangoproject.com/en/1.10/ref/settings/#databases
# SQLite setting:
# 使用单文件sqlite数据库
# DB_ENGINE: sqlite3
# DB_NAME:
# MySQL or postgres setting like:
# 使用Mysql作为数据库
DB_ENGINE: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_USER: jumpserver
DB_PASSWORD:
DB_NAME: jumpserver
# When Django start it will bind this host and port
# ./manage.py runserver 127.0.0.1:8080
# 运行时绑定端口
HTTP_BIND_HOST: 0.0.0.0
HTTP_LISTEN_PORT: 8080
#WS_LISTEN_PORT: 8070
# Use Redis as broker for celery and web socket
# Redis配置
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
# REDIS_PASSWORD:
# REDIS_DB_CELERY: 3
# REDIS_DB_CACHE: 4
# Use OpenID authorization
# 使用OpenID 来进行认证设置
# BASE_SITE_URL: http://localhost:8080
# AUTH_OPENID: false # True or False
# AUTH_OPENID_SERVER_URL: https://openid-auth-server.com/
# AUTH_OPENID_REALM_NAME: realm-name
# AUTH_OPENID_CLIENT_ID: client-id
# AUTH_OPENID_CLIENT_SECRET: client-secret
# AUTH_OPENID_IGNORE_SSL_VERIFICATION: True
# AUTH_OPENID_SHARE_SESSION: True
#
# Use Radius authorization
# 使用Radius来认证
# AUTH_RADIUS: false
# RADIUS_SERVER: localhost
# RADIUS_PORT: 1812
# RADIUS_SECRET:
# LDAP/AD settings
# LDAP 搜索分页数量
# AUTH_LDAP_SEARCH_PAGED_SIZE: 1000
#
# 定时同步用户
# 启用 / 禁用
# AUTH_LDAP_SYNC_IS_PERIODIC: True
# 同步间隔 (单位: 时) (优先)
# AUTH_LDAP_SYNC_INTERVAL: 12
# Crontab 表达式
# AUTH_LDAP_SYNC_CRONTAB: * 6 * * *
#
# LDAP 用户登录时仅允许在用户列表中的用户执行 LDAP Server 认证
# AUTH_LDAP_USER_LOGIN_ONLY_IN_USERS: False
#
# LDAP 认证时如果日志中出现以下信息将参数设置为 0 (详情参见:https://www.python-ldap.org/en/latest/faq.html)
# In order to perform this operation a successful bind must be completed on the connection
# AUTH_LDAP_OPTIONS_OPT_REFERRALS: -1
# OTP settings
# OTP/MFA 配置
# OTP_VALID_WINDOW: 0
# OTP_ISSUER_NAME: Jumpserver
# Perm show single asset to ungrouped node
# 是否把未授权节点资产放入到 未分组 节点中
# PERM_SINGLE_ASSET_TO_UNGROUP_NODE: false
6、运行 Jumpserver
新版本更新了运行脚本,使用方式./jms start|stop|status all 后台运行添加 -d 参数
(py3) [root@jumpserver jumpserver]# ./jms start all -d
7、安装 SSH Server 和 WebSocket Server: Coco
下载或 Clone 项目
(py3) [root@jumpserver jumpserver]# cd /opt/
(py3) [root@jumpserver opt]# source /opt/py3/bin/activate
(py3) [root@jumpserver opt]# git clone --depth=1 https://github.com/jumpserver/coco.git
正克隆到 'coco'...
remote: Enumerating objects: 156, done.
remote: Counting objects: 100% (156/156), done.
remote: Compressing objects: 100% (134/134), done.
remote: Total 156 (delta 17), reused 106 (delta 12), pack-reused 0
接收对象中: 100% (156/156), 1.05 MiB | 42.00 KiB/s, done.
处理 delta 中: 100% (17/17), done.
安装依赖
(py3) [root@jumpserver opt]# cd /opt/coco/requirements
(py3) [root@jumpserver requirements]# yum -y install $(cat rpm_requirements.txt)
(py3) [root@jumpserver requirements]# pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
修改配置文件并运行
(py3) [root@jumpserver requirements]# cd /opt/coco/
(py3) [root@jumpserver coco]# cp config_example.yml config.yml
(py3) [root@jumpserver coco]# sed -i "s/BOOTSTRAP_TOKEN: <PleasgeChangeSameWithJumpserver>/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /opt/coco/config.yml
(py3) [root@jumpserver coco]# sed -i "s/# LOG_LEVEL: INFO/LOG_LEVEL: ERROR/g" /opt/coco/config.yml
(py3) [root@jumpserver coco]# vim config.yml
# 项目名称, 会用来向Jumpserver注册, 识别而已, 不能重复 # NAME: {{ Hostname }} # Jumpserver项目的url, api请求注册会使用 CORE_HOST: http://127.0.0.1:8080 # Bootstrap Token, 预共享秘钥, 用来注册coco使用的service account和terminal # 请和jumpserver 配置文件中保持一致,注册完成后可以删除 BOOTSTRAP_TOKEN: 2lv07mBOr6hD6XwV # 启动时绑定的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_FILE: data/keys/.access_key # 加密密钥 # SECRET_KEY: null # 设置日志级别 [DEBUG, INFO, WARN, ERROR, FATAL, CRITICAL] LOG_LEVEL: ERROR # 日志存放的目录 # 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,zh] # LANGUAGE_CODE: zh # SFTP的根目录, 可选 /tmp, Home其他自定义目录 # SFTP_ROOT: /tmp # SFTP是否显示隐藏文件 # SFTP_SHOW_HIDDEN_FILE: false # 是否复用和用户后端资产已建立的连接(用户不会复用其他用户的连接) # REUSE_CONNECTION: true # 是否强制删除文件夹:(default false) # FORCE_REMOVE_FOLDER: false # Telnet连接协商使用的终端类型 # TELNET_TTYPE: XTERM-256COLOR
新版本更新了运行脚本, 使用方式./cocod start|stop|status 后台运行请添加 -d 参数
(py3) [root@jumpserver coco]# ./cocod start -d
7、安装 Web Terminal 前端: Luna
Luna 已改为纯前端, 需要 Nginx 来运行访问
访问(https://github.com/jumpserver/luna/releases)下载对应版本的 release 包, 直接解压不需要编译
(py3) [root@jumpserver opt]# cd /opt/
(py3) [root@jumpserver opt]# wget https://demo.jumpserver.org/download/luna/1.4.9/luna.tar.gz
(py3) [root@jumpserver opt]# tar xf luna.tar.gz
(py3) [root@jumpserver opt]# chown -R root:root luna
8、安装 Windows 支持组件
安装依赖
(py3) [root@jumpserver opt]# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
(py3) [root@jumpserver opt]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
获取http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
准备中... ################################# [100%]
正在升级/安装...
1:nux-dextop-release-0-5.el7.nux ################################# [100%]
(py3) [root@jumpserver opt]# yum -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
(py3) [root@jumpserver opt]# yum -y localinstall --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
(py3) [root@jumpserver opt]# yum install -y java-1.8.0-openjdk libtool
(py3) [root@jumpserver opt]# yum install -y ffmpeg-devel freerdp-devel freerdp-plugins pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel ghostscript uuid-devel
(py3) [root@jumpserver opt]# rpm -q cairo-devel libjpeg-turbo-devel libpng-devel uuid-devel ffmpeg-devel freerdp-devel freerdp-plugins pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel ghostscript uuid-devel
(py3) [root@jumpserver opt]# ln -s /usr/local/lib/freerdp/*.so /usr/lib64/freerdp/
编译安装 guacamole 服务(这个包比较难下载)
(py3) [root@jumpserver opt]# git clone --depth=1 https://github.com/jumpserver/docker-guacamole.git
正克隆到 'docker-guacamole'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 24 (delta 0), reused 15 (delta 0), pack-reused 0
Unpacking objects: 100% (24/24), done.
(py3) [root@jumpserver opt]# cd /opt/docker-guacamole/
(py3) [root@jumpserver docker-guacamole]# tar -xf guacamole-server-1.0.0.tar.gz
(py3) [root@jumpserver docker-guacamole]# cd guacamole-server-1.0.0
(py3) [root@jumpserver guacamole-server-1.0.0]# autoreconf -fi
(py3) [root@jumpserver guacamole-server-1.0.0]# ./configure --with-init-dir=/etc/init.d
(py3) [root@jumpserver docker-guacamole]# make && make install
(py3) [root@jumpserver guacamole-server-1.0.0]# cd ..
(py3) [root@jumpserver docker-guacamole]# rm -rf guacamole-server-1.0.0
(py3) [root@jumpserver docker-guacamole]# ldconfig
配置 Tomcat
创建 guacamole 目录
(py3) [root@jumpserver docker-guacamole]# mkdir -p /config/guacamole /config/guacamole/lib /config/guacamole/extensions
(py3) [root@jumpserver docker-guacamole]# ln -sf /opt/docker-guacamole/guacamole-auth-jumpserver-0.9.14.jar
(py3) [root@jumpserver docker-guacamole]# /config/guacamole/extensions/guacamole-auth-jumpserver-0.9.14.jar /config/guacamole/extensions/guacamole-auth-jumpserver-0.9.14.jar
guacamole 配置文件
(py3) [root@jumpserver docker-guacamole]# ln -sf /opt/docker-guacamole/root/app/guacamole/guacamole.properties /config/guacamole/guacamole.properties
上传tomcat并部署
(py3) [root@jumpserver docker-guacamole]# cd /config/
(py3) [root@jumpserver config]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.40/bin/apache-tomcat-8.5.16.tar.gz
或者利用rz上传 apache-tomcat-8.5.16.tar.gz的源码包
(py3) [root@jumpserver config]# rz
(py3) [root@jumpserver config]# tar xf apache-tomcat-8.5.16.tar.gz
(py3) [root@jumpserver config]# rm -rf apache-tomcat-8.5.16.tar.gz
(py3) [root@jumpserver config]# mv apache-tomcat-8.5.16 tomcat8
(py3) [root@jumpserver config]# rm -rf /config/tomcat8/webapps/*
guacamole client
(py3) [root@jumpserver config]# ln -sf /opt/docker-guacamole/guacamole-0.9.14.war /config/tomcat8/webapps/ROOT.war
修改默认端口为 8081
(py3) [root@jumpserver config]# sed -i 's/Connector port="8080"/Connector port="8081"/g' /config/tomcat8/conf/server.xml
修改 log 等级为 WARNING
(py3) [root@jumpserver config]# sed -i 's/FINE/WARNING/g' /config/tomcat8/conf/logging.properties
(py3) [root@jumpserver config]# cd /config/
(py3) [root@jumpserver config]# wget https://demo.jumpserver.org/download/ssh-forward/v0.0.5/linux-amd64.tar.gz
(py3) [root@jumpserver config]# tar xf linux-amd64.tar.gz -C /bin/
(py3) [root@jumpserver config]# chmod +x /bin/ssh-forward
配置环境变量
勿多次执行以下环境设置,http://127.0.0.1:8080 指 jumpserver 访问地址
(py3) [root@jumpserver config]# export JUMPSERVER_SERVER=http://127.0.0.1:8080
(py3) [root@jumpserver config]# echo "export JUMPSERVER_SERVER=http://127.0.0.1:8080" >> ~/.bashrc
BOOTSTRAP_TOKEN 为 Jumpserver/config.yml 里面的 BOOTSTRAP_TOKEN
(py3) [root@jumpserver config]# export BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN
(py3) [root@jumpserver config]# echo "export BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc
(py3) [root@jumpserver config]# export JUMPSERVER_KEY_DIR=/config/guacamole/keys
(py3) [root@jumpserver config]# echo "export JUMPSERVER_KEY_DIR=/config/guacamole/keys" >> ~/.bashrc
(py3) [root@jumpserver config]# export GUACAMOLE_HOME=/config/guacamole
(py3) [root@jumpserver config]# echo "export GUACAMOLE_HOME=/config/guacamole" >> ~/.bashrc
启动 Guacamole
(py3) [root@jumpserver config]# /etc/init.d/guacd start
Starting guacd: guacd[23614]: INFO: Guacamole proxy daemon (guacd) version 1.0.0 started
SUCCESS
(py3) [root@jumpserver config]# sh /config/tomcat8/bin/startup.sh
9、配置 Nginx 整合各组件
安装 Nginx
(py3) [root@jumpserver config]# yum -y install yum-utils
(py3) [root@jumpserver config]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
获取http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
警告:/var/tmp/rpm-tmp.3iynMW: 头V4 RSA/SHA1 Signature, 密钥 ID 7bd9bf62: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:nginx-release-centos-7-0.el7.ngx ################################# [100%]
(py3) [root@jumpserver config]# yum makecache fast
(py3) [root@jumpserver config]# yum install -y nginx
(py3) [root@jumpserver config]# rm -rf /etc/nginx/conf.d/default.conf
(py3) [root@jumpserver config]# systemctl enable nginx
准备配置文件 修改 /etc/nginx/conf.d/jumpserver.conf
运行 Nginx
(py3) [root@jumpserver config]# vim /etc/nginx/conf.d/jumpserver.conf
server { # 代理端口, 以后将通过此端口进行访问, 不再通过8080端口 listen 80; # 修改成你的域名或者注释掉 # server_name demo.jumpserver.org; # 录像及文件上传大小限制 client_max_body_size 100m; location /luna/ { try_files $uri / /index.html; # luna 路径, 如果修改安装目录, 此处需要修改 alias /opt/luna/; } location /media/ { add_header Content-Encoding gzip; # 录像位置, 如果修改安装目录, 此处需要修改 root /opt/jumpserver/data/; } location /static/ { # 静态资源, 如果修改安装目录, 此处需要修改 root /opt/jumpserver/data/; } location /socket.io/ { # 如果coco安装在别的服务器, 请填写它的ip proxy_pass http://localhost:5000/socket.io/; 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/ { # 如果coco安装在别的服务器, 请填写它的ip 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/ { # 如果guacamole安装在别的服务器, 请填写它的ip proxy_pass http://localhost:8081/; 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 / { # 如果jumpserver安装在别的服务器, 请填写它的ip proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
(py3) [root@jumpserver config]# nginx -t
(py3) [root@jumpserver config]# systemctl start nginx
(py3) [root@jumpserver config]# systemctl enable nginx
10、开始使用 Jumpserver
浏览器访问http://192.168.200.111,默认账号: admin 密码: admin