Centos7 installs jumpserver fortress

Keywords: Web Server Docker Nginx yum MariaDB

1. Firewall Selinux settings

echo -e "\033[31m 1. firewall Selinux Set up \033[0m"  \
&& if [ "$(systemctl status firewalld | grep running)" != "" ]; then firewall-cmd --zone=public --add-port=80/tcp --permanent; firewall-cmd --zone=public --add-port=2222/tcp --permanent; firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.17.0.0/16" port protocol="tcp" port="8080" accept"; firewall-cmd --reload; fi   \
&& if [ "$(getenforce)" != "Disabled" ]; then setsebool -P httpd_can_network_connect 1; fi

2. Deployment of application environment

echo -e "\033[31m 2. Deployment environment \033[0m" \
  && yum update -y \
  && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  && yum -y install kde-l10n-Chinese \
  && localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8 \
  && export LC_ALL=zh_CN.UTF-8 \
  && echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf \
  && yum -y install wget gcc epel-release git \
  && yum install -y yum-utils device-mapper-persistent-data lvm2 \
  && yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo \
  && yum makecache fast \
  && rpm --import https://mirrors.aliyun.com/docker-ce/linux/centos/gpg \
  && echo -e "[nginx-stable]\nname=nginx stable repo\nbaseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/\ngpgcheck=1\nenabled=1\ngpgkey=https://nginx.org/keys/nginx_signing.key" > /etc/yum.repos.d/nginx.repo \
  && rpm --import https://nginx.org/keys/nginx_signing.key \
  && yum -y install redis mariadb mariadb-devel mariadb-server MariaDB-shared nginx docker-ce \
  && systemctl enable redis mariadb nginx docker \
  && systemctl start redis mariadb \
  && yum -y install python36 python36-devel \
  && python3.6 -m venv /opt/py3

Change docker's default file path

[root@jumpserver-218 tmp]# vim /usr/lib/systemd/system/docker.service
.
.
.
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -g "/data/docker" -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
.
.
.
[root@jumpserver-218 tmp]# systemctl daemon-reload

[root@jumpserver-218 tmp]# service docker restart

3. Download components

echo -e "\033[31m 3. Download components \033[0m" \
  && cd /data \
  && if [ ! -d "/data/jumpserver" ]; then git clone --depth=1 https://github.com/jumpserver/jumpserver.git; fi \
  && if [ ! -f "/data/luna.tar.gz" ]; then wget https://demo.jumpserver.org/download/luna/1.5.2/luna.tar.gz; tar xf luna.tar.gz; chown -R root:root luna; fi \
  && yum -y install $(cat /data/jumpserver/requirements/rpm_requirements.txt) \
  && echo -e "[easy_install]\nindex_url = https://mirrors.aliyun.com/pypi/simple/" > ~/.pydistutils.cfg \
  && source /opt/py3/bin/activate \
  && pip install --upgrade pip setuptools -i https://mirrors.aliyun.com/pypi/simple/ \
  && pip install -r /data/jumpserver/requirements/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ \
  && curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io \
  && systemctl restart docker \
  && docker pull jumpserver/jms_koko:1.5.2 \
  && docker pull jumpserver/jms_guacamole:1.5.2 \
  && rm -rf /etc/nginx/conf.d/default.conf \
  && wget -O /etc/nginx/conf.d/jumpserver.conf https://demo.jumpserver.org/download/nginx/conf.d/jumpserver.conf

4. Processing configuration files

echo -e "\033[31m 4. Processing configuration files \033[0m"  
&& source ~/.bashrc  
&& if [ "$DB_PASSWORD" = "" ]; then DB_PASSWORD=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 24`; fi  
&& if [ "$SECRET_KEY" = "" ]; then SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`; echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc; 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; fi  
&& if [ "$Server_IP" = "" ]; then Server_IP=`ip addr | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1`; fi  
&& if [ ! -d "/var/lib/mysql/jumpserver" ]; then 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;"; fi  
&& if [ ! -f "/data/jumpserver/config.yml" ]; then cp /data/jumpserver/config_example.yml /data/jumpserver/config.yml; sed -i "s/SECRET_KEY:/SECRET_KEY: $SECRET_KEY/g" /data/jumpserver/config.yml; sed -i "s/BOOTSTRAP_TOKEN:/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /data/jumpserver/config.yml; sed -i "s/# DEBUG: true/DEBUG: false/g" /data/jumpserver/config.yml; sed -i "s/# LOG_LEVEL: DEBUG/LOG_LEVEL: ERROR/g" /data/jumpserver/config.yml; sed -i "s/# SESSION_EXPIRE_AT_BROWSER_CLOSE: false/SESSION_EXPIRE_AT_BROWSER_CLOSE: true/g" /data/jumpserver/config.yml; sed -i "s/DB_PASSWORD: /DB_PASSWORD: $DB_PASSWORD/g" /data/jumpserver/config.yml; fi

5. Start Jumpserver

echo -e "\033[31m 5. start-up Jumpserver \033[0m"  
&& systemctl start nginx  
&& cd /data/jumpserver  
&& ./jms start -d  
&& docker run --name jms_koko -d -p 2222:2222 -p 127.0.0.1:5000:5000 -e CORE_HOST=<http://$Server_IP:8080> -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN --restart=always jumpserver/jms_koko:1.5.2  
&& docker run --name jms_guacamole -d -p 127.0.0.1:8081:8081 -e JUMPSERVER_SERVER=<http://$Server_IP:8080> -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN --restart=always jumpserver/jms_guacamole:1.5.2  
&& echo -e "\033[31m Your database password is $DB_PASSWORD \033[0m"  
&& echo -e "\033[31m Your SECRET_KEY yes $SECRET_KEY \033[0m"  
&& echo -e "\033[31m Your BOOTSTRAP_TOKEN yes $BOOTSTRAP_TOKEN \033[0m"  
&& echo -e "\033[31m Your server IP yes $Server_IP \033[0m"  
&& echo -e "\033[31m Open Browser Access <http://Server_IP > User name: admin password: admin[0m“
echo -e "\033[31m 6. Self configuring \033[0m"  
&& if [ ! -f "/usr/lib/systemd/system/jms.service" ]; then wget -O /usr/lib/systemd/system/jms.service <https://demo.jumpserver.org/download/shell/centos/jms.service>; chmod 755 /usr/lib/systemd/system/jms.service; systemctl enable jms; fi

Change the path in the jms.service file to opt to data

[root@jumpserver-218 tmp]# vim /usr/lib/systemd/system/jms.service [Unit] Description=jms After=network.target mariadb.service redis.service docker.service Wants=mariadb.service redis.service docker.service

[Service] Type=forking Environment="PATH=/opt/py3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin" ExecStart=/data/jumpserver/jms start all -d ExecReload= ExecStop=/data/jumpserver/jms stop

[Install] WantedBy=multi-user.target

[root@jumpserver-218 tmp]# systemctl daemon-reload

[root@jumpserver-218 tmp]# systemctl restart jms.service

Step 1: Create a user or user group

Step 2: Create a user or user group

Step 3: Create administrative users

Step 4: Create System Users

for windows system users

Step 5: Adding asset hosts

Step 6: Configure or add permission policies

Step 7: Configure permission policy to add system users

Step 8: web Terminal Testing

Step 9: Use of web terminal in test windows system

The call is required as shown by the arrow: shift Ctrl Alt on the keypad at the same time

Figure 1 - > Shared Storage Disk, Figure 2 - > Clipboard (web terminals can only copy from inside to outside, to copy text from outside, you need to paste it into cipboard)

It's like automatically mounting to window s for shared storage

Audit session video:

Posted by mr_badger on Fri, 11 Oct 2019 11:18:37 -0700