Docker mounted stepping stones (Jumpserver)

Notes as follows:

docker run --name jms_all -d \
-v /data/jump/mysql:/var/lib/mysql \
-v /data/jump/jumpserver:/opt/jumpserver/data/media \
-p 80:80 -p 2222:2222 -e SECRET_KEY=$SECRET_KEY -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_all:latest

Official documents docker way

Jumpserver encapsulates an All in one Docker, quick start. The mirror integrated components required to support the use of external Database and Redis

Tips: not recommended for use in production, because all software is packaged in a Docker, not Docker best practices

Quick Start

  • Enter as root
  • Environmental transport and check to see if an upgrade SECRET_KEY consistent with the previous set, not randomly generated, otherwise all database fields are not decrypt the encrypted

Generating a random encryption keys, leakage do

$ 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
$ 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

$ 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:1.4.8

macOS generating a random key can use the following commands

$ 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

access

  • Browser access: HTTP: / / <container where the server ip>
  • SSH access: ssh -p 2222 <container where the server ip>
  • XShell and other tools to add the connection is connected, the default ssh port 2222
  • The default administrator account admin password admin

External Database Requirements

  • mysql version 5.6 or greater required
  • mariadb version 5.5.6 or greater required
  • Database coding requirements uft8

Create a database

  • Create a database command line

mysql

$ create database jumpserver default charset 'utf8';
$ grant all on jumpserver.* to 'jumpserver'@'%' identified by 'weakPassword';

Additional environment variables

  • 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 =
  • VOLUME /opt/jumpserver/data/media
  • VOLUME /var/lib/mysql

$ 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:1.4.8

Warehouse Address

Guess you like

Origin www.cnblogs.com/happyeric/p/11432833.html