背景:
在当今数字化浪潮席卷全球的背景下,企业运维管理面临着前所未有的挑战。从复杂的网络架构到海量的设备与数据,如何确保运维过程的安全、高效与合规,成为了 IT 团队亟待解决的核心问题。而 JumpServer,作为一款开源的运维安全管理系统,宛如一把神奇的 "钥匙",正吸引着众多从业者与技术爱好者的目光,它悄然地打开了通往高效安全运维的新世界大门,接下来,让我们一同深入探索 JumpServer 的奥秘,领略它在运维领域的独特魅力与强大功能。
一、什么是Jumpserver
JumpServer 是一款由 Fit2Cloud 飞致云团队开发的完全开源的运维安全管理系统,具备集中化资产管理、用户权限管理、连接管理、命令控制与审计、会话管理与审计以及资产自动化管理等核心功能。它支持多种协议,能为用户提供更加安全、高效的远程连接方式,通过命令黑白名单、会话录制等手段保障操作安全并便于审计追踪,具有开源免费、高度可定制、安全性高、易用性强以及社区支持广泛等优势,可帮助企业和组织实现对 IT 运维的高效、安全和精细化管理。
二、Jumpserver服务实战
1.安装jumpserver
bash
jumpserver官网:https://www.jumpserver.org/
官网提供的在线安装方法:
仅需两步快速安装 JumpServer:
准备一台 4核8G (最低)且可以访问互联网的 64 位 Linux 主机;
以 root 用户执行如下命令一键安装 JumpServer。
curl -sSL https://resource.fit2cloud.com/jumpserver/jumpserver/releases/latest/download/quick_start.sh | bash
2.使用jumpserver
给添加主机资产的机器都与jumpserver机器做ssh免密钥,这里除了安装Jumpserver之外还准备了另外两台机器。
bash
$ ssh-keygen
$ ssh-copy-id 172.16.1.7
$ ssh-copy-id 172.16.1.8
......
2.1. 创建组

2.2. 创建用户,分到组里面
2.3 创建资产
普通的web主机特权账号可以使用ssh密钥,数据库直接填写要登录的用户名和密码即可。


2.4 创建账号模版

2.5 给资产授权

2.6 使用普通账号登录jms

可以看到分配给自己的资产
连接即可


这样的好处就是我们可以通过资产的管理来给公司不同的部门进行不同的sudo提权。
2.7 设置命令过滤规则
就是不让用户使用哪些命令,一般都是危险命令被禁止。


2.8 到审计台查看操作,登录日志

2.9 支持命令回放
三、通过命令行连接jms
bash
[root@jumpserver ~]# netstat -nltup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 7179/docker-proxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7228/docker-proxy
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1035/sshd: /usr/sbi
tcp6 0 0 :::2222 :::* LISTEN 7190/docker-proxy
tcp6 0 0 :::80 :::* LISTEN 7240/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 1035/sshd: /usr/sbi
udp 0 0 127.0.0.1:323 0.0.0.0:* 703/chronyd
udp6 0 0 ::1:323 :::* 703/chronyd
就是通过这2222端口,官方提供的服务
1. 我们通过ssh连接
bash
[C:\~]$ ssh [email protected] 2222
Welcome to JumpServer SSH Server
WARNING! The remote SSH server rejected X11 forwarding request.
普通登录jms用户, JumpServer
1) Enter part IP, Hostname, Comment to to search login if unique.
2) Enter / + IP, Hostname, Comment to to search, such as: /192.168.
3) Enter p to display the assets you have permission.
4) Enter g to display the node that you have permission.
5) Enter h to display the hosts that you have permission.
6) Enter d to display the databases that you have permission.
7) Enter k to display the kubernetes that you have permission.
8) Enter r to refresh your assets and nodes.
9) Enter s to language switch.
10) Enter ? to print help.
11) Enter q to exit.
Opt> p
ID | NAME | ADDRESS | PLATFORM | ORGANIZATION | COMMENT
-----+-------+------------+-------------------------------+-----------------------------------+-------------------------------
1 | web01 | 172.16.1.7 | Linux | DEFAULT |
Page: 1, Count: 23, Total Page: 1, Total Count: 1
Enter ID number directly login, multiple search use // + field, such as: //16 Page up: b Page down: n
Search:
[Host]> 1
Connecting to 运维账号模版(Jack)@172.16.1.7 0.1
Authorized users only. All activities may be monitored and reported.
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Thu Jan 16 17:16:21 2025 from 172.16.1.81
[Jack@web01 ~]$ sudo su -
Last login: Thu Jan 16 17:51:14 CST 2025 from 10.0.0.1 on pts/1
[root@web01 ~]#
2. 通过终端工具连接
这样就不用每次登录都要输入密码,以及选项

bash
每次登录点击即可
WARNING! The remote SSH server rejected X11 forwarding request.
普通登录jms用户, JumpServer
1) Enter part IP, Hostname, Comment to to search login if unique.
2) Enter / + IP, Hostname, Comment to to search, such as: /192.168.
3) Enter p to display the assets you have permission.
4) Enter g to display the node that you have permission.
5) Enter h to display the hosts that you have permission.
6) Enter d to display the databases that you have permission.
7) Enter k to display the kubernetes that you have permission.
8) Enter r to refresh your assets and nodes.
9) Enter s to language switch.
10) Enter ? to print help.
11) Enter q to exit.
Opt> web01
Connecting to 运维账号模版(Jack)@172.16.1.7 0.1
Authorized users only. All activities may be monitored and reported.
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Thu Jan 16 17:57:56 2025 from 172.16.1.81
[Jack@web01 ~]$