写点什么

JumpServer 堡垒机对接 Elasticsearch 集群存储命令

作者:coxi_vv
  • 2023-02-01
    北京
  • 本文字数:1526 字

    阅读完需:约 5 分钟

JumpServer 堡垒机对接 Elasticsearch 集群存储命令

1. 为什么对接 Elasticsearch

JumpServer 堡垒机默认配置把命令存储在数据库的「terminal_command」表,在管理大规模资产数量场景中相应的也会记录更多的命令条目,在这种场景下直接查询数据库获取数据会导致页面有卡顿现象,同时在也不利于归档整理和分类。为了解决上述问题 JumpServer 堡垒机支持将命令存储记录到 Elasticsearch 集群,命令存储在 Elasticsearch 也支持按天创建索引方便整理和归档。

2. JumpServer 堡垒机对接 Elasticsearch 步骤

2.1 环境说明

备注:测试环境中 Elasticsearch 为单机环境。


2.2 Elasticsearch 安装配置

#安装 java[root@es-node1 ~]# yum -y install java
#添加 Elasticsearch 源[root@es-node1 ~]# rpm --import ​​​https://artifacts.elastic.co/GPG-KEY-elasticsearch​​​[root@es-node1 ~]# cat >> /etc/yum.repos.d/elk.repo << EOF[elasticsearch]name=Elasticsearch repository for 7.x packagesbaseurl=https://artifacts.elastic.co/packages/7.x/yumgpgcheck=1gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearchenabled=0autorefresh=1type=rpm-mdEOF
#安装 Elasticsearch[root@es-node1 ~]# yum -y install elasticsearch --enablerepo=elasticsearch
#配置 Elasticsearch[root@es-node1 ~]# grep -Ev “#|$” /etc/elasticsearch/elasticsearch.ymlcluster.name: jms-clusternode.name: es-node01path.data: /var/lib/elasticsearchpath.logs: /var/log/elasticsearchnetwork.host: 10.1.11.32http.port: 9200discovery.seed_hosts: [“10.1.11.32”]cluster.initial_master_nodes: [“10.1.11.32”]
#启动 Elasticsearch 服务[root@es-node1 ~]# systemctl enable elasticsearch[root@es-node1 ~]# systemctl start elasticsearch
#访问 Elasticsearch 服务[root@es-node1 ~]# curl ​​​http://10.1.11.32:9200​​​{“name” : “es-node01”,“cluster_name” : “jms-cluster”,“cluster_uuid” : “w_wbn7GHQWybqg40Swff7w”,“version” : {“number” : “7.17.7”,“build_flavor” : “default”,“build_type” : “rpm”,“build_hash” : “78dcaaa8cee33438b91eca7f5c7f56a70fec9e80”,“build_date” : “2022-10-17T15:29:54.167373105Z”,“build_snapshot” : false,“lucene_version” : “8.11.1”,“minimum_wire_compatibility_version” : “6.8.0”,“minimum_index_compatibility_version” : “6.0.0-beta1”},“tagline” : “You Know, for Search”}
复制代码

2.3 JumpServer 堡垒机对接 Elasticsearch

在系统设置 -> 终端设置模块下进行配置和管理 Elasticsearch 集群连接信息。

2.3.1 JumpServer 堡垒机对接 Elasticsearch

在终端设置 -> 命令存储子模块中创建一个 Elasticsearch 集群连接项用来连接 Elasticsearch 集群环境。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


在 Elasticsearch 连接项中填写名称、主机和索引等信息。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


成功创建连接项后测试 JumpServer 堡垒机与 Elasticsearch 集群连通性。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


页面显示测试成功后表示 JumpServer 堡垒机与 Elasticsearch 集群通信正常。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


2.3.2 JumpServer 组件使用 Elasticsearch

确认 JumpServer 堡垒机与 Elasticsearch 集群通信正常后在终端管理子模块中配置 JumpServer 堡垒机组件将命令存储至 Elasticsearch 集群环境。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


2.3.3 JumpServer 对接 Elasticsearch 验证

在 JumpServer 堡垒机成功对接 Elasticseach 集群环境后可以连接任意资产测试是否能正常将命令记录到 Elasticseach 集群。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


在 JumpServer 堡垒机审计台页面 -> 会话审计模块 -> 命令记录子模块中查看结果。


JumpServer 堡垒机对接 Elasticsearch 集群存储命令-开源基础软件社区


通过上述配置 JumpServer 堡垒机成功将命令记录存储至 Elasticsearch 集群。

用户头像

coxi_vv

关注

还未添加个人签名 2023-01-31 加入

还未添加个人简介

评论

发布
暂无评论
JumpServer 堡垒机对接 Elasticsearch 集群存储命令_coxi_vv_InfoQ写作社区