您好,登錄后才能下訂單哦!
博文大綱:
一、Jumpserver簡(jiǎn)介
二、安裝Jumpserver準(zhǔn)備環(huán)境
三、配置Python 3環(huán)境
四、安裝Jumpserver
五、安裝mariadb、redis并配置jumpserver
六、安裝coco組件并配置
七、安裝guacamole及l(fā)una
八、安裝nginx
九、客戶端訪問(wèn)測(cè)試
Jumpserver是全球首款完全開(kāi)源的堡壘機(jī),使用GNU GPL v2.0開(kāi)源協(xié)議,是符合4A的專業(yè)運(yùn)維審計(jì)系統(tǒng)。
Jumpserver 使用 Python / Django 進(jìn)行開(kāi)發(fā), 遵循 Web 2.0 規(guī)范, 配備了業(yè)界領(lǐng)先的 Web Terminal 解決方案, 交互界面美觀、用戶體驗(yàn)好。
Jumpserver 采納分布式架構(gòu), 支持多機(jī)房跨區(qū)域部署, 中心節(jié)點(diǎn)提供 API, 各機(jī)房部署登錄節(jié)點(diǎn), 可橫向擴(kuò)展、無(wú)并發(fā)訪問(wèn)限制。
Jumpserver 現(xiàn)已支持管理 SSH、 Telnet、 RDP、 VNC 協(xié)議資產(chǎn)。
Jumpserver的特點(diǎn):
- 完全開(kāi)源;
- Python編寫(xiě),易于二次開(kāi)發(fā);
- 實(shí)現(xiàn)跳板機(jī)的基本功能、認(rèn)證、授權(quán)、審計(jì);
- 集成了Ansiable,實(shí)現(xiàn)批量操作命令等;
- 支持web終端;
- Bootstrap編寫(xiě),界面美觀;
- 自動(dòng)收集硬件信息;
- 錄像回放、命令搜索、實(shí)時(shí)監(jiān)控;
下載所需軟件包
- 硬件配置:2個(gè)CPU核心、4G內(nèi)存、50G硬盤(pán)(最低);
- 操作系統(tǒng):Linux 發(fā)行版 x86_64;
- python環(huán)境3.6.x以上;
- 數(shù)據(jù)庫(kù):msyq或者mariadb,l版本必須是5.6以上;
- Redis;
- Jumpserver:管理后臺(tái),管理員可以通過(guò)Web頁(yè)面進(jìn)行資產(chǎn)管理、用戶管理、資產(chǎn)授權(quán)等操作;用戶可以通過(guò)Web頁(yè)面進(jìn)行資產(chǎn)登錄、文件管理等操作;
- koko:提供SSH Server 和 Web Terminal Server 。用戶可以使用自己的賬戶通過(guò) SSH 或者 Web Terminal 訪問(wèn) SSH 協(xié)議和 Telnet 協(xié)議資產(chǎn);
- Luna:提供Web Terminal Server前端頁(yè)面,用戶使用Web Termina方式登錄所需組件;
- Guacamole:為 RDP 協(xié)議和 VNC 協(xié)議資產(chǎn)組件, 用戶可以通過(guò) Web Terminal 來(lái)連接 RDP 協(xié)議和 VNC 協(xié)議資產(chǎn)(常用于windows服務(wù)器);
如圖:
- Jumpserver默認(rèn)Web端口為8080/tcp、默認(rèn)WS端口為8070/tcp;配置文件為jumpserver/config.yml;
- koko默認(rèn)SSH端口為2222/tcp、默認(rèn)為Web Terninal端口為5000/tcp;配置文件為koko/config.yml;
- Guacamole默認(rèn)端口為 8081/tcp; 配置文件為/config/tomcat9/conf/server.xml
- Nginx默認(rèn)端口為 80/tcp;
- Redis默認(rèn)端口為 6379/tcp;
- Mysql/mariadb默認(rèn)端口為 3306/tcp;
[root@jumpserver ~]# localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
[root@jumpserver ~]# export LC_ALL=zh_CN.UTF-8
[root@jumpserver ~]# echo 'LC_ALL=zh_CN.UTF-8' > /etc/locale.conf
[root@jumpserver ~]# yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git
//下載所需依賴
[root@jumpserver ~]# tar xf Python-3.6.1.tar.xz -C /usr/src
[root@jumpserver ~]# cd /usr/src/Python-3.6.1/
[root@jumpserver Python-3.6.1]# ./configure && make && make install
//編譯安裝python 3環(huán)境
[root@jumpserver Python-3.6.1]# cd /opt
[root@jumpserver opt]# python3 -m venv py3
[root@jumpserver opt]# source /opt/py3/bin/activate
(py3) [root@jumpserver opt]#
//出現(xiàn)這樣的字符表示在python 3虛擬環(huán)境成功
(py3) [root@jumpserver opt]# unzip autoenv.zip
(py3) [root@jumpserver opt]# echo "source /opt/autoenv/activate.sh" >> /root/.bashrc
(py3) [root@jumpserver opt]# source /root/.bashrc
//使用autoenv設(shè)置為自動(dòng)載入python 3的虛擬環(huán)境
(py3) [root@jumpserver opt]# unzip jumpserver.zip
(py3) [root@jumpserver opt]# echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env
(py3) [root@jumpserver opt]# cd jumpserver/
autoenv:
autoenv: WARNING:
autoenv: This is the first time you are about to source /opt/jumpserver/.env:
autoenv:
autoenv: --- (begin contents) ---------------------------------------
autoenv: source /opt/py3/bin/activate$
autoenv:
autoenv: --- (end contents) -----------------------------------------
autoenv:
autoenv: Are you sure you want to allow this? (y/N) y //輸入“y”表示自動(dòng)載入python3環(huán)境
(py3) [root@jumpserver jumpserver]# cd requirements/
(py3) [root@jumpserver requirements]# yum -y install $(cat rpm_requirements.txt)
//安裝所需依賴
(py3) [root@jumpserver requirements]# pip install --upgrade pip
(py3) [root@jumpserver requirements]# pip install wheel
(py3) [root@jumpserver requirements]# pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
//安裝python所需依賴
安裝mariadb
(py3) [root@jumpserver requirements]# yum -y install mariadb mariadb-devel mariadb-server
(py3) [root@jumpserver requirements]# systemctl start mariadb
(py3) [root@jumpserver requirements]# mysqladmin -u root password 123.com
(py3) [root@jumpserver requirements]# mysql -u root -p123.com
MariaDB [(none)]> create database jumpserver default charset 'utf8' ;
MariaDB [(none)]> grant all on jumpserver.* to jumpserver@127.0.0.1 identified by '123.com';
MariaDB [(none)]> flush privileges;
(py3) [root@jumpserver requirements]# ss -lnt | grep 3306
LISTEN 0 50 *:3306 *:*
安裝redis
(py3) [root@jumpserver requirements]# yum -y install redis
(py3) [root@jumpserver requirements]# systemctl start redis
(py3) [root@jumpserver requirements]# ss -lnt | grep 6379
LISTEN 0 128 127.0.0.1:6379 *:*
配置jumpserver
(py3) [root@jumpserver ~]# cd /opt/jumpserver/
(py3) [root@jumpserver jumpserver]# cp config_example.yml config.yml
#生成秘鑰令牌
(py3) [root@jumpserver jumpserver]# SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`
(py3) [root@jumpserver jumpserver]# echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc
(py3) [root@jumpserver jumpserver]# BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16`
(py3) [root@jumpserver jumpserver]# echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc
(py3) [root@jumpserver jumpserver]# sed -i "s/SECRET_KEY:/SECRET_KEY: $SECRET_KEY/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/BOOTSTRAP_TOKEN:/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/# DEBUG: true/DEBUG: false/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/# LOG_LEVEL: DEBUG/LOG_LEVEL: ERROR/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/# SESSION_EXPIRE_AT_BROWSER_CLOSE: False/SESSION_EXPIRE_AT_BROWSER_CLOSE: true/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# sed -i "s/DB_PASSWORD: /DB_PASSWORD: 123.com/g" /opt/jumpserver/config.yml
(py3) [root@jumpserver jumpserver]# echo -e "\033[31m 你的SECRET_KEY是 $SECRET_KEY \033[0m"
你的SECRET_KEY是 UmIWcyEGJN6JfCbCYnthtlK7z4wQ8HwlEL2DagdBxPJjWWRdSN
(py3) [root@jumpserver jumpserver]# echo -e "\033[31m 你的BOOTSTRAP_TOKEN是 $BOOTSTRAP_TOKEN \033[0m"
你的BOOTSTRAP_TOKEN是 qFs86ALWXpamrBaH
(py3) [root@jumpserver jumpserver]# egrep -v '^$|^#' config.yml
SECRET_KEY: UmIWcyEGJN6JfCbCYnthtlK7z4wQ8HwlEL2DagdBxPJjWWRdSN
BOOTSTRAP_TOKEN: qFs86ALWXpamrBaH
DEBUG: false
LOG_LEVEL: ERROR
DB_ENGINE: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_USER: jumpserver
DB_PASSWORD: 123.com
DB_NAME: jumpserver
HTTP_BIND_HOST: 0.0.0.0
HTTP_LISTEN_PORT: 8080
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
(py3) [root@jumpserver jumpserver]# ./jms start all -d
(py3) [root@jumpserver jumpserver]# ss -lnt | grep 8080
LISTEN 0 128 *:8080 *:*
(py3) [root@jumpserver opt]# unzip coco.zip
(py3) [root@jumpserver opt]# cd coco
(py3) [root@jumpserver coco]# echo "source /opt/py3/bin/activate" > /opt/coco/.env
(py3) [root@jumpserver coco]# cd requirements/
autoenv:
autoenv: WARNING:
autoenv: This is the first time you are about to source /opt/coco/.env:
autoenv:
autoenv: --- (begin contents) ---------------------------------------
autoenv: source /opt/py3/bin/activate$
autoenv:
autoenv: --- (end contents) -----------------------------------------
autoenv:
autoenv: Are you sure you want to allow this? (y/N) y
(py3) [root@jumpserver requirements]# yum -y install $(cat rpm_requirements.txt)
(py3) [root@jumpserver requirements]# pip install -r requirements.txt
(py3) [root@jumpserver requirements]# cd ..
(py3) [root@jumpserver coco]# cp config_example.yml config.yml
(py3) [root@jumpserver coco]# echo -e "\033[31m 你的BOOTSTRAP_TOKEN是 $BOOTSTRAP_TOKEN \033[0m"
你的BOOTSTRAP_TOKEN是 qFs86ALWXpamrBaH
(py3) [root@jumpserver coco]# sed -i "s/BOOTSTRAP_TOKEN: <PleasgeChangeSameWithJumpserver>/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" config.yml
(py3) [root@jumpserver coco]# sed -i "s/# LOG_LEVEL: INFO/LOG_LEVEL: ERROR/g" config.yml
(py3) [root@jumpserver coco]# egrep -v '^$|^#' config.yml
CORE_HOST: http://127.0.0.1:8080
BOOTSTRAP_TOKEN: qFs86ALWXpamrBaH
//注意保證16個(gè)隨機(jī)字符保證與jumpserver配置文件中的16個(gè)隨機(jī)字符保證一致
LOG_LEVEL: ERROR
(py3) [root@jumpserver coco]# ./cocod start -d
(py3) [root@jumpserver coco]# ss -lnt | grep 2222
LISTEN 0 5 *:2222 *:*
(py3) [root@jumpserver ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
(py3) [root@jumpserver ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
(py3) [root@jumpserver ~]# yum makecache fast
(py3) [root@jumpserver ~]# yum -y install docker-ce
(py3) [root@jumpserver ~]# systemctl start docker
(py3) [root@jumpserver ~]# docker load < guacamole.tar
(py3) [root@jumpserver ~]# docker run --name jms_guacamole -d \
-p 8081:8080 -v /opt/guacamole/key:/config/guacamole/key \
-e JUMPSERVER_KEY_DIR=/config/guacamole/key \
-e JUMPSERVER_SERVER=http://192.168.1.10:8080 \
jumpserver/guacamole:latest
(py3) [root@jumpserver ~]# ss -lnt | grep 8081
LISTEN 0 128 :::8081 :::*
(py3) [root@jumpserver ~]# tar zxf luna.tar.gz -C /opt
(py3) [root@jumpserver ~]# tar zxf nginx-1.2.4.tar.gz -C /usr/src
(py3) [root@jumpserver ~]# cd /usr/src/nginx-1.2.4/
(py3) [root@jumpserver nginx-1.2.4]# ./configure && make && make install
(py3) [root@jumpserver nginx-1.2.4]# ln -sf /usr/local/nginx/sbin/nginx /usr/local/bin/
(py3) [root@jumpserver nginx-1.2.4]# cd /usr/local/nginx/conf/
(py3) [root@jumpserver conf]# cp nginx.conf nginx.conf.bak
(py3) [root@jumpserver conf]# mv /root/nginx.conf .
mv:是否覆蓋"./nginx.conf"? y
(py3) [root@jumpserver conf]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
(py3) [root@jumpserver conf]# nginx
(py3) [root@jumpserver conf]# ss -lnt | grep -w 80
LISTEN 0 128 *:80 *:*
如圖:
此用戶用于登錄Jumpserver web頁(yè)面的用戶,創(chuàng)建過(guò)程如下:
此用戶主要用于管理后端資源,創(chuàng)建方法如下:
此用戶主要用于登錄后端資產(chǎn),創(chuàng)建方法如下:
實(shí)驗(yàn)環(huán)境,所以就開(kāi)啟一臺(tái)虛擬機(jī)192.168.1.1作為測(cè)試(web頁(yè)面的客戶端與后端資產(chǎn)肯定不在同一網(wǎng)段,因?yàn)橛脩羰峭ㄟ^(guò)公網(wǎng)登錄到j(luò)umpserver才可以對(duì)后端服務(wù)器進(jìn)行操作的)!
最后,雖然寫(xiě)文檔花費(fèi)了不少時(shí)間,但是還是建議大家參考Jumpserver官方文檔
————————————本文到此結(jié)束,感謝閱讀——————————————
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。