基于docker搭建jumpserver堡垒机_项目管理_非技术区_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 非技术区 > 项目管理 > 基于docker搭建jumpserver堡垒机

基于docker搭建jumpserver堡垒机

 2017/9/5 17:08:51  Poke  程序员俱乐部  我要评论(0)
  • 摘要:一、环境信息1、jumpserver192.168.137.129CentOS6.4kernel版本为3.10.5-3.el6.x86_642、客户机192.168.137.129,192.168.137.1303、jiaxiangkong/jumpserver_docker:0.3.2二、在129上准备基本环境[root@localhost~]#yuminstall-yepel-release[root@localhost~]#yuminstall
  • 标签:Server

一、环境信息

  1、jumpserver 192.168.137.129 CentOS6.4   kernel版本为 3.10.5-3.el6.x86_64

  2、客户机 192.168.137.129,192.168.137.130

  3、jiaxiangkong/jumpserver_docker:0.3.2

二、在129上准备基本环境

  [root@localhost ~]# yum install -y epel-release

  [root@localhost ~]# yum install -y curl

  [root@localhost ~]# service iptables stop

  [root@localhost ~]# 关闭selinux(具体百度)

  升级内核到3.10.0以上(rpm包下载:http://pan.baidu.com/s/1cGrccQ)

  [root@localhost ~]# uname -r
  3.10.5-3.el6.x86_64

  安装docker

  [root@localhost ~]# yum install device-mapper-event-libs

  [root@localhost ~]# yum install -y https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

  [root@localhost ~]# docker -v
  Docker version 1.7.1, build 786b29d

三、安装mysql数据库

  [root@localhost ~]# yum install -y mysql

  [root@localhost ~]# service mysqld start

  [root@localhost ~]# mysql -e "create database jumpserver charset='utf8';"

  [root@localhost ~]# mysql -e "grant all on jumpserver.* to 'jumpserver'@'192.168.137.129' identified by 'jumpserver';"

  [root@localhost ~]# mysql -e "flush privileges;"

  [root@localhost ~]# mysql -e "show databases;"

四、安装jumpserver

  4.1拉取镜像

  [root@localhost ~]# docker pull jiaxiangkong/jumpserver_docker:0.3.2

  

  4.2、配置启动脚本并启动

  class="code_img_closed" src="/Upload/Images/2017090517/0015B68B3C38AA5B.gif" alt="">
 1 #!/bin/bash
 2 docker stop jms && docker rm jms
 3 docker run      --name jms \
 4                 -p 2222:22 \
 5                 -p 8888:80 \
 6                 -v /data/jms/script:/data/jms/script \
 7                 -v /data/jms/config/passwd:/etc/passwd \
 8                 -v /data/jms/config/shadow:/etc/shadow \
 9                 -v /data/jms/tty:/data/logs/tty \
10                 -v /data/jms/role_key:/data/keys/role_key \
11                 -v /etc/localtime:/etc/localtime:ro \
12                 -e USE_MYSQL=1 \
13                 -e MYSQL_ENGINE=mysql \
14                 -e MYSQL_HOST=192.168.137.129 \
15                 -e MYSQL_PORT=3306 \
16                 -e MYSQL_USER=jumpserver \
17                 -e MYSQL_PASS=jumpserver \
18                 -e MYSQL_NAME=jumpserver \
19                 -e USE_MAIL=true \
20                 -e MAIL_ENABLED=1 \
21                 -e MAIL_HOST=smtp.126.com \
22                 -e MAIL_PORT=25 \
23                 -e MAIL_USER=888888@126.com \
24                 -e MAIL_PASS=888888 \
25                 -e MAIL_USE_TLS=False \
26                 -e MAIL_USE_SSL=False \
27                 --restart=always \
28                 -d  jiaxiangkong/jumpserver_docker:0.3.2
29 docker exec -ti jms /bin/sh /data/jms/script/input_ip.sh
start_jms.sh

  其中passwd和shadow为容器的原始文件,可以在http://pan.baidu.com/s/1cGrccQ下载,这里挂载到宿主机是为了数据的保存

  [root@localhost ~]# docker ps
  CONTAINER ID        IMAGE                                  COMMAND                CREATED             STATUS              PORTS                                        NAMES
  020843b328ca        jiaxiangkong/jumpserver_docker:0.3.2   "/bin/sh -c /run.sh"   22 hours ago        Up 3 hours          0.0.0.0:2222->22/tcp, 0.0.0.0:8888->80/tcp   jms

  4.3、访问 192.168.137.129:8888,密码默认都是admin

  

  

  跳板机到这里基本算是安装完成了。就写到这里吧

 

参考链接:https://github.com/jumpserver/jumpserver/wiki/Docker-镜像

 

发表评论
用户名: 匿名