JumpServer堡垒机安装

小辉助手 Jumpserver评论34,7971字数 1046阅读3分29秒阅读模式

JumpServer简介

JumpServer 是全球首款完全开源的堡垒机, 使用 GNU GPL v2.0 开源协议, 是符合 4A 的专业运维审计系统。

JumpServer 使用 Python / Django 进行开发, 遵循 Web 2.0 规范, 配备了业界领先的 Web Terminal 解决方案, 交互界面美观、用户体验好。

JumpServer 采纳分布式架构, 支持多机房跨区域部署, 中心节点提供 API, 各机房部署登录节点, 可横向扩展、无并发访问限制。

JumpServer 现已支持管理 SSH、 Telnet、 RDP、 VNC 协议资产。

极速安装

说明

全新安装的 Centos7 (7.x)

需要连接 互联网

使用 root 用户执行

下载

[root@localhost ~]# cd /opt

[root@localhost ~]# yum -y install wget git

[root@localhost ~]# git clone --depth=1 https://github.com/jumpserver/setuptools.git

[root@localhost ~]# cd setuptools

[root@localhost ~]# cp config_example.conf config.conf

[root@localhost ~]# vi config.conf

# 以下设置默认情况下不需要修改

# 需要安装的版本
Version=1.5.9

# Jms 加密配置
SECRET_KEY=
BOOTSTRAP_TOKEN=

# 数据库 配置, 如果 数据库 安装在其他的服务器, 请修改下面设置
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=jumpserver
DB_PASSWORD=
DB_NAME=jumpserver

# Redis 配置, 如果 Redis 安装在其他的服务器, 请修改下面设置
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=

# 服务端口设置, 如果云服务器未备案请修改 http_port 端口为其他端口
http_port=80
ssh_port=2222

# 服务安装目录
install_dir=/opt

Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1`
Docker_IP=`ip addr | grep docker.* | grep inet | awk '{print $2}' | head -n 1`

安装

[root@localhost ~]# ./jmsctl.sh install

升级

[root@localhost ~]# cd /opt/setuptools

[root@localhost ~]# git pull

[root@localhost ~]# ./jmsctl.sh upgrade

帮助

[root@localhost ~]# ./jmsctl.sh -h

如果网络有问题无法连接到 github

[root@localhost ~]# wget -O /opt/setuptools.tar.gz http://demo.jumpserver.org/download/setuptools.tar.gz

[root@localhost ~]# cd /opt

[root@localhost ~]# tar -xf setuptools.tar.gz

[root@localhost ~]# cd setuptools

[root@localhost ~]# git pull

[root@localhost ~]# ./jmsctl.sh -h

Docker安装

JumpServer封装了一个 All in one Docker, 可以快速启动。该镜像集成了所需要的组件, 支持使用外置Database和Redis

快速启动

  • 使用 root 身份输入
  • 环境迁移和更新升级请检查SECRET_KEY是否与之前设置一致, 不能随机生成, 否则数据库所有加密的字段均无法解密

[root@localhost ~]# if [ "$SECRET_KEY" = "" ]; then SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`; echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc; echo $SECRET_KEY; else echo $SECRET_KEY; fi

[root@localhost ~]# if [ "$BOOTSTRAP_TOKEN" = "" ]; then BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16`; echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc; echo $BOOTSTRAP_TOKEN; else echo $BOOTSTRAP_TOKEN; fi

[root@localhost ~]# docker run --name jms_all -d -p 80:80 -p 2222:2222 -e SECRET_KEY=$SECRET_KEY -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_all:latest

# macOS 生成随机 key 可以用下面的命令

$ if [ "$SECRET_KEY" = "" ]; then SECRET_KEY=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 50`; echo "SECRET_KEY=$SECRET_KEY" >> ~/.bash_profile; echo $SECRET_KEY; else echo $SECRET_KEY; fi

$ if [ "$BOOTSTRAP_TOKEN" = "" ]; then BOOTSTRAP_TOKEN=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 16`; echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bash_profile; echo $BOOTSTRAP_TOKEN; else echo $BOOTSTRAP_TOKEN; fi

访问

  • 浏览器访问:http://<容器所在服务器IP>
  • SSH访问:ssh -p 2222 <容器所在服务器IP>
  • XShell等工具请添加connection连接, 默认ssh端口2222
  • 默认管理员账户admin密码admin

外置数据库要求

  • mysql 版本需要大于等于 5.6
  • mariadb 版本需要大于等于 5.5.6
  • 数据库编码要求 uft8

创建数据库

# mysql

mysql> create database jumpserver default charset 'utf8' collate 'utf8_bin';

mysql> grant all on jumpserver.* to 'jumpserver'@'%' identified by 'weakPassword';

额外环境变量

  • SECRET_KEY = **
  • BOOTSTRAP_TOKEN = **
  • DB_HOST = mysql_host
  • DB_PORT = 3306
  • DB_USER = jumpserver
  • DB_PASSWORD = weakPassword
  • DB_NAME = jumpserver
  • REDIS_HOST = 127.0.0.1
  • REDIS_PORT = 6379
  • REDIS_PASSWORD = xxx
  • VOLUME /opt/jumpserver/data/media
  • VOLUME /var/lib/mysql

# Install

[root@localhost ~]# docker run --name jms_all -d \

-v /opt/jumpserver:/opt/jumpserver/data/media \

-p 80:80 \

-p 2222:2222 \

-e SECRET_KEY=xxxxxx \

-e BOOTSTRAP_TOKEN=xxx \

-e DB_HOST=192.168.x.x \

-e DB_PORT=3306 \

-e DB_USER=root \

-e DB_PASSWORD=xxx \

-e DB_NAME=jumpserver \

-e REDIS_HOST=192.168.x.x \

-e REDIS_PORT=6379 \

-e REDIS_PASSWORD=xxx \

jumpserver/jms_all:latest

Docker-Compose安装

.env的变量用在docker-compose里面, 可以自己看下可能还有一些未能检测到的问题, 尽量自己调试一遍后再使用

[root@localhost ~]# git clone https://github.com/jumpserver/Dockerfile.git

[root@localhost ~]# cd Dockerfile

[root@localhost ~]# cat .env

[root@localhost ~]# docker-compose up

官方文档:https://docs.jumpserver.org/zh/docs/step_by_step.html

若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!

继续阅读
微信号
微信扫一扫,加我!
weinxin
微信公众号
微信扫一扫,关注我!
weinxin
小辉助手
  • 本文由 小辉助手 发表于 2020年4月30日 13:50:23
  • 声明:本站所有文章,如无特殊说明或标注,本站文章均为原创。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。转载请务必保留本文链接:https://www.yangxinghui.cn/785.html
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

拖动滑块以完成验证