wazauh离线部署

官网 https://wazuh.com/html

  • 若是服务器能够联网,直接参照官网文档部署便可。node

  • 为方便安装,选择手动下载rpm包进行安装
wazuh相关下载地址:https://documentation.wazuh.com/3.12/installation-guide/packages-list/index.html#linux
ES下载相关地址:https://www.elastic.co/cn/downloads/
  • 内网没法使用网络源,所以选择先将rpm包在能够联网的机器下载下来,再上传到内网服务器安装,可使用yumdownloader命令。
yum install yum-utils
语法:yumdownloader  rpmname  --resolve --destdir=/path  ##resolve   下载依赖包

1、安装Wazuh

  1. 安装Wazuh-managerlinux

    rpm -ivh wazuh-manager-3.12.3-1.x86_64.rpm 
    systemctl status wazuh-manager #安装完成会自动启动
  2. 安装Wazuh-APIgit

    #安装Wazuh-API须要nodejs> = 4.6.1,所以首先安装nodejs
    rpm -ivh nodejs-10.21.0-1nodesource.x86_64.rpm 
    rpm -ivh wazuh-api-3.12.3-1.x86_64.rpm 
    systemctl status wazuh-api.service #安装完成会自动启动
  3. 安装filebeatgithub

    #Filebeat是Wazuh服务器上的工具,可将警报和存档事件安全地转发到Elasticsearch。
    rpm -ivh filebeat-7.7.1-x86_64.rpm 
    
    #因为内网环境不方便下载官方提供的配置文件,所以选择一台能够连网的机器手动下载后将文件上传至内网服务器对应的目录中并受权。
    #下载Filebeat配置文件,用于将Wazuh警报转发到Elasticsearch。
    curl -so /etc/filebeat/filebeat.yml https://raw.githubusercontent.com/wazuh/wazuh/v3.12.3/extensions/filebeat/7.x/filebeat.yml  #官方下载命令
    
    cp  filebeat.yml  /etc/filebeat/ #拷贝下载的配置文件至filebeat
    chmod go+r /etc/filebeat/filebeat.yml #受权
    
    #下载Elasticsearch的警报模板
    curl -so /etc/filebeat/wazuh-template.json https://raw.githubusercontent.com/wazuh/wazuh/v3.12.3/extensions/elasticsearch/7.x/wazuh-template.json  #官方下载命令
    
    cp wazuh-template.json /etc/filebeat/  ##拷贝下载的警报模板至filebeat
    chmod go+r /etc/filebeat/wazuh-template.json  #受权
    
    #下载适用于Filebeat的Wazuh模块
    curl -s https://packages.wazuh.com/3.x/filebeat/wazuh-filebeat-0.1.tar.gz | sudo tar -xvz -C /usr/share/filebeat/module
    
    tar  -xvf wazuh-filebeat-0.1.tar.gz  -C /usr/share/filebeat/module/
    
    #修改配置文件
    vim /etc/filebeat/filebeat.yml
    output.elasticsearch.hosts: ['http://YOUR_ELASTIC_SERVER_IP:9200']  #写入es的地址
    
    #启动
    systemctl daemon-reload
    systemctl enable filebeat.service
    systemctl start filebeat.service

2、安装Elasticsearch

  1. 安装jdkjson

    rpm -ivh jdk-8u181-linux-x64.rpm 
    #能够选择分布式,也能够选择单点,由于是实验环境,因此将Elasticsearch与Wazuh服务器装在同一台服务器。
  2. 安装esvim

    rpm -ivh elasticsearch-7.7.1-x86_64.rpm
    #修改es配置文件
    vim  /etc/elasticsearch/elasticsearch.yml
    network.host: 127.0.0.1   #因为单机部署,所以写127.0.0.1
    node.name: node-1   #使用默认
    cluster.initial_master_nodes: ["node-1"]  
    
    #启动
    systemctl daemon-reload
    systemctl enable elasticsearch.service
    systemctl start elasticsearch.service
    
    #加载Filebeat模板,在安装filebeat的位置运行此命令
    filebeat setup --index-management -E setup.template.json.enabled=false
    
    #简单检查
    curl http://127.0.0.1:9200

3、安装Kibana

  1. 安装api

    rpm -ivh kibana-7.7.1-x86_64.rpm
  2. 安装wazuh插件安全

    cd /usr/share/kibana/
    cp /root/wazuhapp-3.12.3_7.7.1.zip  /usr/share/kibana/  #也能够放到/tpm
    sudo -u kibana bin/kibana-plugin install  file:///usr/share/kibana/wazuhapp-3.12.3_7.7.1.zip
  3. 修改配置文件服务器

    vim /etc/kibana/kibana.yml
    server.host: "0.0.0.0"
    elasticsearch.hosts: ["http://127.0.0.1:9200"]
    
    #对于Kibana 7.6.X以上的版本,增长kibana的堆大小确保插件正常安装
    cat >> /etc/default/kibana << EOF
    NODE_OPTIONS="--max_old_space_size=2048"
    EOF
    
    #登陆
    http://192.168.113.107:5601/

4、安装agent

  • 自动注册

    #自动注册,将agent的包上传到服务器,而后使用此命令安装便可。
    WAZUH_MANAGER='192.168.113.107'  yum install wazuh-agent-3.12.3-1.x86_64.rpm
相关文章
相关标签/搜索