标签: 漏洞管理

  • 使用 Docker 部署 Greenbone Community Edition(GCE):打造你的本地漏洞扫描平台

    一、GCE 简介

    Greenbone Community Edition(GCE) 是由 Greenbone Networks 维护的开源安全漏洞扫描解决方案,基于知名的 OpenVAS(Open Vulnerability Assessment System) 项目构建。它包括:

    • GSA(Greenbone Security Assistant):图形化 Web 管理界面;
    • GVMD:扫描调度与管理守护进程;
    • OpenVAS Scanner:扫描引擎;
    • Greenbone Community Feed:开源漏洞数据库(每日更新);
    • GVM-Tools:命令行工具,支持远程自动化控制。

    GCE 是企业级 Greenbone GSM 产品的免费替代方案,非常适合中小企业、个人研究人员、DevSecOps 团队部署。

    二、安装Docker

    $ curl -fsSL https://get.docker.com -o get-docker.sh
    $ sudo sh get-docker.sh

    三、部署Greenbone Community Edition(GCE)

    1. 保存 docker-compose.yml 文件
    2. 运行以下命令启动服务:
    docker compose up -d
    1. 容器启动后,访问 Web 管理界面:
    http://<服务器IP>:9392
    登录默认管理员账户/密码:admin

    首次启动可能需要等待几分钟,用于加载漏洞数据库、初始化服务。

    name: greenbone-community-edition
    
    services:
      vulnerability-tests:
        image: registry.community.greenbone.net/community/vulnerability-tests
        environment:
          FEED_RELEASE: "24.10"
        volumes:
          - vt_data_vol:/mnt
    
      notus-data:
        image: registry.community.greenbone.net/community/notus-data
        volumes:
          - notus_data_vol:/mnt
    
      scap-data:
        image: registry.community.greenbone.net/community/scap-data
        volumes:
          - scap_data_vol:/mnt
    
      cert-bund-data:
        image: registry.community.greenbone.net/community/cert-bund-data
        volumes:
          - cert_data_vol:/mnt
    
      dfn-cert-data:
        image: registry.community.greenbone.net/community/dfn-cert-data
        volumes:
          - cert_data_vol:/mnt
        depends_on:
          - cert-bund-data
    
      data-objects:
        image: registry.community.greenbone.net/community/data-objects
        environment:
          FEED_RELEASE: "24.10"
        volumes:
          - data_objects_vol:/mnt
    
      report-formats:
        image: registry.community.greenbone.net/community/report-formats
        environment:
          FEED_RELEASE: "24.10"
        volumes:
          - data_objects_vol:/mnt
        depends_on:
          - data-objects
    
      gpg-data:
        image: registry.community.greenbone.net/community/gpg-data
        volumes:
          - gpg_data_vol:/mnt
    
      redis-server:
        image: registry.community.greenbone.net/community/redis-server
        restart: on-failure
        volumes:
          - redis_socket_vol:/run/redis/
    
      pg-gvm:
        image: registry.community.greenbone.net/community/pg-gvm:stable
        restart: on-failure
        volumes:
          - psql_data_vol:/var/lib/postgresql
          - psql_socket_vol:/var/run/postgresql
    
      gvmd:
        image: registry.community.greenbone.net/community/gvmd:stable
        restart: on-failure
        volumes:
          - gvmd_data_vol:/var/lib/gvm
          - scap_data_vol:/var/lib/gvm/scap-data/
          - cert_data_vol:/var/lib/gvm/cert-data
          - data_objects_vol:/var/lib/gvm/data-objects/gvmd
          - vt_data_vol:/var/lib/openvas/plugins
          - psql_data_vol:/var/lib/postgresql
          - gvmd_socket_vol:/run/gvmd
          - ospd_openvas_socket_vol:/run/ospd
          - psql_socket_vol:/var/run/postgresql
        depends_on:
          pg-gvm:
            condition: service_started
          scap-data:
            condition: service_completed_successfully
          cert-bund-data:
            condition: service_completed_successfully
          dfn-cert-data:
            condition: service_completed_successfully
          data-objects:
            condition: service_completed_successfully
          report-formats:
            condition: service_completed_successfully
    
      gsa:
        image: registry.community.greenbone.net/community/gsa:stable
        restart: on-failure
        ports:
          - 9392:80
        volumes:
          - gvmd_socket_vol:/run/gvmd
        depends_on:
          - gvmd
      # Sets log level of openvas to the set LOG_LEVEL within the env
      # and changes log output to /var/log/openvas instead /var/log/gvm
      # to reduce likelyhood of unwanted log interferences
      configure-openvas:
        image: registry.community.greenbone.net/community/openvas-scanner:stable
        volumes:
          - openvas_data_vol:/mnt
          - openvas_log_data_vol:/var/log/openvas
        command:
          - /bin/sh
          - -c
          - |
            printf "table_driven_lsc = yes\nopenvasd_server = http://openvasd:80\n" > /mnt/openvas.conf
            sed "s/127/128/" /etc/openvas/openvas_log.conf | sed 's/gvm/openvas/' > /mnt/openvas_log.conf
            chmod 644 /mnt/openvas.conf
            chmod 644 /mnt/openvas_log.conf
            touch /var/log/openvas/openvas.log
            chmod 666 /var/log/openvas/openvas.log
    
      # shows logs of openvas
      openvas:
        image: registry.community.greenbone.net/community/openvas-scanner:stable
        restart: on-failure
        volumes:
          - openvas_data_vol:/etc/openvas
          - openvas_log_data_vol:/var/log/openvas
        command:
          - /bin/sh
          - -c
          - |
            cat /etc/openvas/openvas.conf
            tail -f /var/log/openvas/openvas.log
        depends_on:
          configure-openvas:
            condition: service_completed_successfully
    
      openvasd:
        image: registry.community.greenbone.net/community/openvas-scanner:stable
        restart: on-failure
        environment:
          # `service_notus` is set to disable everything but notus,
          # if you want to utilize openvasd directly, remove `OPENVASD_MODE`
          OPENVASD_MODE: service_notus
          GNUPGHOME: /etc/openvas/gnupg
          LISTENING: 0.0.0.0:80
        volumes:
          - openvas_data_vol:/etc/openvas
          - openvas_log_data_vol:/var/log/openvas
          - gpg_data_vol:/etc/openvas/gnupg
          - notus_data_vol:/var/lib/notus
        # enable port forwarding when you want to use the http api from your host machine
        # ports:
        #   - 127.0.0.1:3000:80
        depends_on:
          vulnerability-tests:
            condition: service_completed_successfully
          configure-openvas:
            condition: service_completed_successfully
          gpg-data:
            condition: service_completed_successfully
        networks:
          default:
            aliases:
              - openvasd
    
      ospd-openvas:
        image: registry.community.greenbone.net/community/ospd-openvas:stable
        restart: on-failure
        hostname: ospd-openvas.local
        cap_add:
          - NET_ADMIN # for capturing packages in promiscuous mode
          - NET_RAW # for raw sockets e.g. used for the boreas alive detection
        security_opt:
          - seccomp=unconfined
          - apparmor=unconfined
        command:
          [
            "ospd-openvas",
            "-f",
            "--config",
            "/etc/gvm/ospd-openvas.conf",
            "--notus-feed-dir",
            "/var/lib/notus/advisories",
            "-m",
            "666",
          ]
        volumes:
          - gpg_data_vol:/etc/openvas/gnupg
          - vt_data_vol:/var/lib/openvas/plugins
          - notus_data_vol:/var/lib/notus
          - ospd_openvas_socket_vol:/run/ospd
          - redis_socket_vol:/run/redis/
          - openvas_data_vol:/etc/openvas/
          - openvas_log_data_vol:/var/log/openvas
        depends_on:
          redis-server:
            condition: service_started
          gpg-data:
            condition: service_completed_successfully
          vulnerability-tests:
            condition: service_completed_successfully
          configure-openvas:
            condition: service_completed_successfully
    
      gvm-tools:
        image: registry.community.greenbone.net/community/gvm-tools
        volumes:
          - gvmd_socket_vol:/run/gvmd
          - ospd_openvas_socket_vol:/run/ospd
        depends_on:
          - gvmd
          - ospd-openvas
    
    volumes:
      gpg_data_vol:
      scap_data_vol:
      cert_data_vol:
      data_objects_vol:
      gvmd_data_vol:
      psql_data_vol:
      vt_data_vol:
      notus_data_vol:
      psql_socket_vol:
      gvmd_socket_vol:
      ospd_openvas_socket_vol:
      redis_socket_vol:
      openvas_data_vol:
      openvas_log_data_vol:
  • Debian 12 部署 HIDS Wazuh 指南

    Wazuh 是一款 开源的 SIEM(安全信息和事件管理)HIDS(主机入侵检测系统) 解决方案,能够实时监控系统日志、检测安全威胁、执行合规性审计,并提供可视化安全分析。
    Wazuh可用于入侵检测、日志分析、文件完整性监控、恶意软件检测、漏洞扫描等场景。Wazuh 适用于企业安全运营中心(SOC)、服务器与终端安全、DevSecOps 以及合规性管理,帮助企业和个人提升 IT 环境的安全性。

    1. 单节点部署 Wazuh

    首先,克隆 Wazuh 官方 Docker 仓库,并切换到指定版本:

    git clone https://github.com/wazuh/wazuh-docker.git -b v4.11.1

    进入 单节点部署目录

    cd wazuh-docker/single-node

    2. 配置 Wazuh

    Wazuh 由 管理器(Manager)索引器(Indexer)仪表板(Dashboard) 组成。

    2.1 调整内核参数

    在主机(Linux)上,提升 vm.max_map_count 以支持 Wazuh 索引器(需要 root 权限):

    sysctl -w vm.max_map_count=262144

    2.2 生成 SSL 证书

    运行以下命令,生成用于组件间通信的证书:

    docker compose -f generate-indexer-certs.yml run --rm generator

    2.3 启动 Wazuh

    完成配置后,启动 Wazuh 服务:

    docker compose up -d

    2.4 访问 Wazuh 仪表板

    部署完成后,在浏览器中访问:

    https://<Wazuh_IP>

    默认的登录凭据为:

    • 用户名admin
    • 密码SecretPassword

    3. 添加 Wazuh Agent

    要将受监控的主机接入 Wazuh,请在 Web 仪表板中进行操作:

    在 Wazuh 仪表板中添加 Agent

    1. 登录 Wazuh 仪表板。
    2. 导航到 HOME — OVERVIEW — Deploy new agent。
    3. 选择要监控的操作系统。
    4. 输入要监控的服务器地址、Agent 名称和分组。
    5. 复制生成的 Agent 安装命令,并粘贴到要监控的主机中执行。

    验证 Agent 连接
    返回到 HOME — OVERVIEW 页面,您应该能够看到新添加的 Agent。