跳至主内容

容器保护(通过安全容器部署)

容器保护 功能通过扩展和增强主机操作系统的安全层,为Linux容器工作负载及其主机提供防护。它利用服务器工作负载端点检测与响应、高级反漏洞利用、Linux专用反漏洞利用技术以及反恶意软件扫描服务和威胁防护功能。您可选择性启用或禁用各安全模块。

重要提示

本功能可通过两个组件部署:

  • 一个 最佳 代理(含 容器保护 模块),需安装在已部署Docker的Linux主机上。

  • 一个 安全容器 部署在Linux主机端点下。 安全容器 是一个专用Docker容器,运行Ubuntu 20.04基础镜像及 BEST Linux官方Debian软件包。它以特权容器身份运行在容器主机上。

本指南提供通过安全容器部署该功能的相关信息。

提示

在本指南中,我们将安全容器简称为BSC(Bitdefender安全容器)。

当前安全容器支持的功能集包括:

  • 反恶意软件

  • EDR传感器

  • 高级反漏洞利用

  • 容器保护

部署在Linux主机时,安全容器可保护该主机及主机上运行的其他容器。

组件

容器保护 使用以下组件:

  • GravityZone 控制中心

  • 一个安全容器

  • 未安装安全代理的Linux主机

安装与配置 容器保护

本指南将演示如何在Kubernetes集群部署安全容器。

测试新功能

测试部署

要确认特定节点上的部署是否成功,请按以下步骤操作。

为与该节点上部署的安全容器交互,需在Pod内的容器中打开shell。获得shell后,即可像在常规机器上安装产品一样操作所有产品文件(二进制文件、日志等)。

注意

容器日志不包含产品日志,需从容器内部访问。

  1. 在运行的Pod中打开shell并确认产品存在。

    root@tcor-temp-workspace:~# kubectl exec -it bitdefender-security-container-6kzg7 -n bitdefender-security-container -- bash
    root@node1:~# /opt/bitdefender-security-tools/bin/bdsecd -V
    Bitdefender安全工具版本7.0.5.200049 (d0fd7aa8)
  2. 检查BEST进程是否正在运行。

    root@node1:~# ps afx | grep bitdef
      27820 ?        S      0:00  |       \_ /bin/sh -c cd /; "/opt/bitdefender-security-tools/bin/bdwatchdogd" -c "/opt/bitdefender-security-tools/etc/bdwatchdogd.json"
      27821 ?        S      0:00  |           \_ /opt/bitdefender-security-tools/bin/bdwatchdogd -c /opt/bitdefender-security-tools/etc/bdwatchdogd.json
      27822 ?        Sl     0:43  |               \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json
      27920 ?        Sl     0:33  |               |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      27932 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      27936 ?        S      0:00  |               |   |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      33967 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      33968 ?        S      0:00  |               |   |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      33977 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      33978 ?        S      0:00  |               |   |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      33995 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      33996 ?        S      0:00  |               |   |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      34005 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      34006 ?        S      0:00  |               |   |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      34015 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      34016 ?        S      0:00  |               |   |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      34025 ?        S      0:00  |               |   |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      34066 ?        S      0:00  |               |   |       \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m fanotify -M
      28649 ?        Sl     0:11  |               |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m antimalware -M config=/opt/bitdefender-security-tools/var/lib/modules/antimalware/update.jso.temp
      29354 ?        Sl     1:31  |               |   \_ /opt/bitdefender-security-tools/bin/bdsecd -c /opt/bitdefender-security-tools/etc/bdsecd.json -m ctc -M config=/opt/bitdefender-security-tools/var/lib/modules/ctc/update.jso.temp
      27823 ?        Sl     0:04  |               \_ /opt/bitdefender-security-tools/bin/updated -c /opt/bitdefender-security-tools/etc/bdsecd.json
      27824 ?        Sl     0:04  |               \_ /opt/bitdefender-security-tools/bin/epagngd -c /opt/bitdefender-security-tools/etc/bdsecd.json

    注意

    由于节点上已运行多个容器,因此存在多个fanotify进程。

  3. 前往 网络 页面(通过 GravityZone 控制中心 .

  4. 选择需要验证的容器主机以显示详细信息。 进入

  5. 防护 选项卡并检查以下信息:

    • 代理 部分,确保 主扫描引擎 中央扫描 备用扫描引擎 混合扫描 .

      BSC_GZ_network_nodes_5_523216_en.png
    • 概览 部分,确认 反恶意软件 , , 容器保护 以及 EDR传感器 功能已启用。

      BSC_GZ_network_nodes_6_523216_en.png

若所有检查均通过,则确认部署成功。可对集群中所有节点重复上述步骤。

测试实时防护功能

要在BSC上执行反恶意软件实时扫描基础测试,并验证防护是否覆盖容器主机及所有托管运行中的容器,请按以下步骤操作。

由于环境为Kubernetes集群,需通过DaemonSet定义以与BSC部署相同方式(每个集群节点一个pod)创建其他pod。以下定义描述了一个持续运行50000秒的CentOS 7容器DaemonSet。

api版本: apps/v1
类型: DaemonSet
元数据:
  名称: centos临时
  命名空间: 默认
  标签:
    名称: centos临时
规格:
  选择器:
    匹配标签:
      名称: centos临时
  模板:
    元数据:
      名称: centos临时
      标签:
        名称: centos临时
    规格:
      容忍度:
      - 键: node-role.kubernetes.io/master
        操作符: 存在
        效果: 不调度
      - 键: node-role.kubernetes.io/control-plane
        操作符: 存在
        效果: 不调度
      容器:
      - 名称: centos临时
        镜像: centos:7
        命令: ["休眠", "50000"]
  1. 将此定义保存至名为 centos.yaml 的文件中,置于集群外部。

  2. 运行此命令(该命令会微调文件以创建多个DaemonSet):

    循环5次执行:sed "s/centos临时/centos临时$i/g" centos.yaml > /tmp/centos临时.yaml && kubectl apply -f /tmp/centos临时.yaml
    daemonset.apps/centos临时1已创建
    daemonset.apps/centos临时2已创建
    daemonset.apps/centos临时3已创建
    daemonset.apps/centos临时4已创建
    daemonset.apps/centos临时5已创建
  3. 等待所有对象创建完成且所有pod进入运行状态。

    root@tcor-temp-workspace:~# kubectl get pods -o wide
    名称                 就绪   状态     重启次数   年龄   IP               节点    提名节点       就绪门限
    centos-temp1-4krnb   1/1    运行中    0          51秒  10.233.71.61     node3   <无>           <无>
    centos-temp1-6fq8v   1/1    运行中    0          51秒  10.233.75.61     node2   <无>           <无>
    centos-temp1-7fhqp   1/1    运行中    0          51秒  10.233.102.135   node1   <无>           <无>
    centos-temp1-s2985   1/1    运行中    0          51秒  10.233.74.65     node4   <无>           <无>
    centos-temp2-kv7sz   1/1    运行中    0          51秒  10.233.71.28     node3   <无>           <无>
    centos-temp2-m48hx   1/1    运行中    0          51秒  10.233.75.4      node2   <无>           <无>
    centos-temp2-n2z9c   1/1    运行中    0          51秒  10.233.74.127    node4   <无>           <无>
    centos-temp2-pwc69   1/1    运行中    0          51秒  10.233.102.133   node1   <无>           <无>
    centos-temp3-b8vdm   1/1    运行中    0          50秒  10.233.75.26     node2   <无>           <无>
    centos-temp3-cxjrz   1/1    运行中    0          50秒  10.233.74.66     node4   <无>           <无>
    centos-temp3-p8qxs   1/1    运行中    0          50秒  10.233.71.26     node3   <无>           <无>
    centos-temp3-ztqrb   1/1    运行中    0          50秒  10.233.102.157   node1   <无>           <无>
    centos-temp4-4chdk   1/1    运行中    0          50秒  10.233.75.21     node2   <无>           <无>
    centos-temp4-8fqtx   1/1    运行中    0          50秒  10.233.74.121    node4   <无>           <无>
    centos-temp4-cqchs   1/1    运行中    0          50秒  10.233.71.21     node3   <无>           <无>
    centos-temp4-lptjt   1/1    运行中    0          50秒  10.233.102.136   node1   <无>           <无>
    centos-temp5-8xx8z   1/1    运行中    0          50秒  10.233.75.62     node2   <无>           <无>
    centos-temp5-hbdtk   1/1    运行中    0          49秒  10.233.102.139   node1   <无>           <无>
    centos-temp5-kfx7t   1/1    运行中    0          50秒  10.233.74.92     node4   <无>           <无>
    centos-temp5-lzq44   1/1    运行中    0          50秒  10.233.71.60     node3   <无>           <无>
  4. 在单个集群节点上测试功能:

    1. 前往 网络 页面(通过 GravityZone 左侧菜单),确认该节点的容器组中新增了5个容器。

      BSC_GZ_network_nodes_7_523216_en.png
    2. 在受保护路径内创建恶意软件样本文件(例如EICAR测试字符串文件) (位于容器主机上) .

      root@node3:~# echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' > /home/test1.txt

      反恶意软件实时防护功能将自动检测EICAR文件并将其移至隔离区。

    3. 在受保护路径内创建恶意软件样本, 即在先前部署的某个容器内部 .

      root@tcor-temp-workspace:~# kubectl exec -it centos-temp5-lzq44 -- bash
      [root@centos-temp5-lzq44 /]# echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' > /home/test2.txt

      反恶意软件实时防护功能将自动检测EICAR文件并将其移至隔离区。

    4. 前往 事件 页面(通过 GravityZone 左侧菜单),确认存在2起源自反恶意软件功能的事件:一起针对 test1.txt ,另一起针对 test2.txt .

      BSC_GZ_incidents_detection_1_523216_en.png
      BSC_GZ_incidents_detection_2_523216_en.png
  5. 您现在可以删除为此测试创建的容器组。

产品更新

与BEST Linux v7的软件包版本不同,安全容器不支持产品更新。当新镜像版本发布时,安全容器 需重新部署 .

安全内容更新

您可通过以下任一流程执行安全内容更新: