jumpserver组件安装
1、安装coco组件
Jumpserver堡垒机自V1.5.3 版本起,Koko(基于Go语言开发的SSH客户端)将担任Coco(基于Python语言开发的SSH客户端)在Jumpserver项目中的角色,后续版本不会再对Coco进行维护。
Coco为 SSH Server 和 Web Terminal Server。用户可以通过使用自己的账户登录 SSH 或者 Web Terminal直接访问被授权的资产。不需要知道服务器的账户和密码,现在 Coco 已经被 koko 取代。
Koko下载地址:
下载地址:https://github.com/jumpserver/koko/releases/tag/2.0.1
下载版本:koko-master-linux-amd64.tar
此次试验内容依旧安装coco组件。
Jumpserrver安装完成后,点击页面中:会话管理-web终端,会显示如下信息:
故需要安装coco及luna组件。
(1)安装coco
[root@test ~]# cd coco/[root@test ~]# source /root/py3/bin/activate
安装依赖:
(py3) [root@test ~]# cd /root/coco/requirements(py3) [root@test requirements]# yum -y install $(cat rpm_requirements.txt)(py3) [root@test requirements]# pip install -r requirements.txt
注: pip download -r requirements.txt ,下载相关安装包到本地。
(2)修改配置文件并启动coco
(py3) [root@test requirements]# cd ..(py3) [root@test coco]# cp conf_example.py conf.py(py3) [root@test coco]# vi conf.py CORE_HOST = 'http://127.0.0.1:8080'(py3) [root@test coco]# chmod +x cocod启动coco并完成注册:(py3) [root@test coco]# ./cocod start -d注册:http://192.168.0.10:8080/terminal/terminal/
进程查看:
(py3) [root@test coco]# ps -ef |grep cocod(py3) [root@test coco]# netstat -anpt |grep 2222
2、安装luna组件
Luna是 Web Terminal 前端,计划前端页面都由该项目提供,Jumpserver 只提供 API,不再负责后台渲染html等。
下载地址:
https://github.com/jumpserver/luna/releases
访问该地址下载对应版本luna安装包。
(py3) [root@test ~]# tar -zxvf luna.tar.gz(py3) [root@test ~]# chown -R root:root luna
3、配置nginx整合各组件
(1)安装nginx
(py3) [root@test ~]# yum -y install nginx
(2)修改nginx配置
[root@test ~]# vi /etc/nginx/nginx.conf
user root;worker_processes 2; error_log /var/log/nginx/error.log;#error_log logs/error.log notice;#error_log logs/error.log info; pid /var/log/nginx/nginx.pid; events { worker_connections 10240;} http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; # 代理端口,以后将通过此端口进行访问,不再通过8080端口 server_name localhost; # 修改你的域名或者地址 client_max_body_size 100m; # 录像及文件上传大小限制 location /luna/ { try_files $uri / /index.html; alias /root/luna/; # luna 路径,如果修改安装目录,此处需要修改 } location /media/ { add_header Content-Encoding gzip; root /root/jumpserver/data/; # 录像位置,如果修改安装目录,此处需要修改 } location /static/ { root /root/jumpserver/data/; # 静态资源,如果修改安装目录,此处需要修改 } location /socket.io/ { proxy_pass http://localhost:5000/socket.io/; # 如果coco安装在别的服务器,请填写它的ip proxy_buffering off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; access_log off; } location /coco/ { proxy_pass http://localhost:5000/coco/; # 如果coco安装在别的服务器,请填写它的ip proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; access_log off; } location / { proxy_pass http://localhost:8080; # 如果jumpserver安装在别的服务器,请填写它的ip proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }}
(3)nginx启动
nginx配置检查:
[root@test nginx]# nginx -tnginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successful[root@test nginx]#
启动:
[root@test nginx]# /etc/init.d/nginx start正在启动 nginx:nginx: [emerg] getpwnam("www") failed in /etc/nginx/nginx.conf:1 [失败]
报错解决:
[root@test nginx]# /usr/sbin/groupadd -f www[root@test nginx]# /usr/sbin/useradd -g www www[root@test nginx]# /etc/init.d/nginx start 正在启动 nginx:[确定]
进程查看:
[root@test ~]# ps -ef |grep nginxroot 61771 1 0 20:37 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.confwww 61773 61771 0 20:37 ? 00:00:00 nginx: worker process www 61774 61771 0 20:37 ? 00:00:00 nginx: worker process root 61814 59411 0 20:41 pts/1 00:00:00 grep nginx[root@test ~]# netstat -anpt |grep 80tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 61771/nginx
各端口说明:
Jumpserver 默认端口为 8080/tcp 配置文件在 jumpserver/config.py
Coco 默认 SSH 端口为 2222/tcp ,默认 Web Terminal 端口为 5000/tcp 配置文件在 coco/conf.py
Nginx 默认端口为 80/tcp
Redis 默认端口为 6379/tcp
Mysql 默认端口为 3306/tcp
配置完成:
访问:http://192.168.0.10(安装主机地址)
用户名:admin 密码:admin