Jumpserver是一款由python编写开源的跳板机(堡垒机)系统,实现了跳板机应有的功能。基于ssh协议来管理,客户端无需安装agent。 特点: 完全开源,GPL授权 Python编写,支持再次开发 实现了跳板机基本功能,认证、授权、审计 集成了Ansible。
1、完全开源,也可以选择商业支持; 2、支持多种常用的操作系统; 3、提供用户会话记录功能,可以手动终端不明的会话记录; 4、支持录像回放功能,方便生产事故后的问题追溯; 5、所有密码通过系统管理,最终用户不需知道服务器的密码。终结了生产环境密码手工拷贝和传播的方式。
关闭防火墙和SELinux
服务器
作用
jumpserver
10.0.0.123
client
10.0.0.124
yum install git wegt -y
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecach
yum updata -y
yum -y install epel-release
yum install -y python36 python36-devel redis mariadb-server mariadb-devel mariadb
systemctl start mariadb redis
systemctl enable mariadb redis
mysql -uroot
create database jumpserver default charset 'utf8' collate 'utf8_bin';
grant all on jumpserver.* to 'jumpserver'@'10.0.0.%' identified by 'weakPassword';
flush privileges;
python3.6 -m venv /opt/py3
source /opt/py3/bin/activate
cd /opt && \
wget https://github.com/jumpserver/jumpserver/releases/download/v2.3.1/jumpserver-v2.3.1.tar.gz
tar xf jumpserver-v2.3.1.tar.gz
mv jumpserver-v2.3.1 jumpserver
cd /opt/jumpserver/requirements
yum install -y $(cat rpm_requirements.txt)
pip install wheel && \
pip install --upgrade pip setuptools && \
pip install -r requirements.txt
#################################
国内源,如果服务启动不成功用国内源
pip install wheel -i https://mirrors.aliyun.com/pypi/simple/
pip install --upgrade pip setuptools -i https://mirrors.aliyun.com/pypi/simple/
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
ps:确保已经载入 py3 虚拟环境, 中间如果遇到报错一般是依赖包没装全, 可以通过 搜索引擎 解决
pip install wheel -i https://mirrors.aliyun.com/pypi/simple/
pip install --upgrade pip setuptools -i https://mirrors.aliyun.com/pypi/simple/
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
cd /opt/jumpserver && \
cp config_example.yml config.yml && \
vi config.yml
https://suijimimashengcheng.51240.com/ 随机密码生成
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY:aumutGWrDOKyOwY0w22Pjg4c4RCZISjUjQAd3CB2oK7dZ7J4Bu #50位
BOOTSTRAP_TOKEN:KN9X8hHaWuNFQ5gTdjDK #20位
DEBUG: false
LOG_LEVEL: ERROR
SESSION_EXPIRE_AT_BROWSER_CLOSE: true
DB_ENGINE: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_USER: jumpserver
DB_PASSWORD: weakPassword
DB_NAME: jumpserver
HTTP_BIND_HOST: 0.0.0.0
HTTP_LISTEN_PORT: 8080
WS_LISTEN_PORT: 8070
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
REDIS_PASSWORD: ZhYnLrodpmPncovxJTnRyiBs
WINDOWS_SKIP_ALL_MANUAL_PASSWORD: True
cd /opt/jumpserver
./jms start -d
cd /opt && \
wget https://github.com/jumpserver/koko/releases/download/v2.3.1/koko-v2.3.1-linux-amd64.tar.gz
tar -xf koko-v2.3.1-linux-amd64.tar.gz
mv koko-v2.3.1-linux-amd64 koko
chown -R root:root koko
cd koko
mv kubectl /usr/local/bin/
wget https://download.jumpserver.org/public/kubectl.tar.gz
tar -xf kubectl.tar.gz
chmod 755 kubectl
mv kubectl /usr/local/bin/rawkubectl
rm -rf kubectl.tar.gz
cp config_example.yml config.yml
vi config.yml
# 项目名称, 会用来向Jumpserver注册, 识别而已, 不能重复
CORE_HOST: http://127.0.0.1:8080
BOOTSTRAP_TOKEN: KN9X8hHaWuNFQ5gTdjDK ####和**/opt/jumpserver/config.yml对应**
LOG_LEVEL: ERROR ####和/opt/jumpserver/config.yml对应
./koko -d后台运行
cd /opt && \
wget -O docker-guacamole-v2.3.1.tar.gz https://github.com/jumpserver/docker-guacamole/archive/master.tar.gz
mkdir /opt/docker-guacamole && \
tar -xf docker-guacamole-v2.3.1.tar.gz -C /opt/docker-guacamole --strip-components 1 && \
rm -rf /opt/docker-guacamole-v2.3.1.tar.gz && \
cd /opt/docker-guacamole && \
wget http://download.jumpserver.org/public/guacamole-server-1.2.0.tar.gz && \
tar -xf guacamole-server-1.2.0.tar.gz && \
wget http://download.jumpserver.org/public/ssh-forward.tar.gz && \
tar -xf ssh-forward.tar.gz -C /bin/ && \
chmod +x /bin/ssh-forward
cd /opt/docker-guacamole/guacamole-server-1.2.0
yum install cairo-devel libjpeg-turbo-devel libpng-devel uuid-devel ffmpeg-devel freerdp-devel pango-devel libssh2-devel libtelnet-devel libvncserver-devel libwebsockets-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel -y
./configure --with-init-dir=/etc/init.d && \
make && \
make install
yum install -y java-1.8.0-openjdk
mkdir -p /config/guacamole /config/guacamole/extensions /config/guacamole/record /config/guacamole/drive && \
chown daemon:daemon /config/guacamole/record /config/guacamole/drive && \
cd /config
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.38/bin/apache-tomcat-9.0.38.tar.gz
tar -xf apache-tomcat-9.0.38.tar.gz
mv apache-tomcat-9.0.38 tomcat9
rm -rf /config/tomcat9/webapps/*
sed -i 's/Connector port="8080"/Connector port="8081"/g' /config/tomcat9/conf/server.xml
echo "java.util.logging.ConsoleHandler.encoding = UTF-8" >> /config/tomcat9/conf/logging.properties
wget http://download.jumpserver.org/release/v2.3.1/guacamole-client-v2.3.1.tar.gz
tar -xf guacamole-client-v2.3.1.tar.gz
rm -rf guacamole-client-v2.3.1.tar.gz
cp guacamole-client-v2.3.1/guacamole-*.war /config/tomcat9/webapps/ROOT.war
cp guacamole-client-v2.3.1/guacamole-*.jar /config/guacamole/extensions/
mv /opt/docker-guacamole/guacamole.properties /config/guacamole/
rm -rf /opt/docker-guacamole
5.0设置 Guacamole 环境
export JUMPSERVER_SERVER=http://127.0.0.1:8080
echo "export JUMPSERVER_SERVER=http://127.0.0.1:8080" >> ~/.bashrc
export BOOTSTRAP_TOKEN=KN9X8hHaWuNFQ5gTdjDK #对应jumpserver/config.yml 文件
echo "export BOOTSTRAP_TOKEN=KN9X8hHaWuNFQ5gTdjDK" >> ~/.bashrc #对应jumpserver/config.yml 文件
export JUMPSERVER_KEY_DIR=/config/guacamole/data/keys
echo "export JUMPSERVER_KEY_DIR=/config/guacamole/data/keys" >> ~/.bashrc
export GUACAMOLE_HOME=/config/guacamole
echo "export GUACAMOLE_HOME=/config/guacamole" >> ~/.bashrc
export GUACAMOLE_LOG_LEVEL=ERROR
echo "export GUACAMOLE_LOG_LEVEL=ERROR" >> ~/.bashrc
export JUMPSERVER_ENABLE_DRIVE=true
echo "export JUMPSERVER_ENABLE_DRIVE=true" >> ~/.bashrc
/etc/init.d/guacd start
sh /config/tomcat9/bin/startup.sh
ps:环境变量说明
JUMPSERVER_SERVER 指 core 访问地址
BOOTSTRAP_TOKEN 为 Jumpserver/config.yml 里面的 BOOTSTRAP_TOKEN 值
JUMPSERVER_KEY_DIR 认证成功后 key 存放目录
GUACAMOLE_HOME 为 guacamole.properties 配置文件所在目录
GUACAMOLE_LOG_LEVEL 为生成日志的等级
JUMPSERVER_ENABLE_DRIVE 为 rdp 协议挂载共享盘
cd /opt
wget https://github.com/jumpserver/lina/releases/download/v2.3.1/lina-v2.3.1.tar.gz
tar -xf lina-v2.3.1.tar.gz
mv lina-v2.3.1 lina
useradd nginx -M -s/sbin/nologin
chown -R nginx:nginx lina
cd /opt
wget https://github.com/jumpserver/luna/releases/download/v2.3.1/luna-v2.3.1.tar.gz
tar -xf luna-v2.3.1.tar.gz
mv luna-v2.3.1 luna
chown -R nginx:nginx luna
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
yum install nginx -y
echo > /etc/nginx/conf.d/default.conf
vi /etc/nginx/conf.d/jumpserver.conf
server {
listen 80;
client\_max\_body\_size 100m; # 录像及文件上传大小限制
location /ui/ {
try\_files $uri / /index.html;
alias /opt/lina/;
}
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 /koko/ {
proxy\_pass http://localhost:5000;
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 /guacamole/ {
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 /ws/ {
proxy\_set\_header X-Real-IP $remote\_addr;
proxy\_set\_header Host $host;
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;
proxy\_pass http://localhost:8070;
proxy\_http\_version 1.1;
proxy\_buffering off;
proxy\_set\_header Upgrade $http\_upgrade;
proxy\_set\_header Connection "upgrade";
}
location /api/ {
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;
}
location /core/ {
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;
}
location / {
rewrite ^/(.\*)$ /ui/$1 last;
}
}
nginx -t
systemctl start nginx
服务全部启动后, 访问 JumpServer 服务器 nginx 代理的 80 端口, 不要通过8080端口访问 默认账号: admin 密码: admin
手机扫一扫
移动阅读更方便
你可能感兴趣的文章