AliSecGuard阿里云的内核安全模块

AliSecGuard 是阿里云的 内核安全模块,本质上就是一个云厂商级的 内核防护 Agent(没法卸载),它负责监控和保护主机,包括入侵检测、完整性校验、关键系统调用监控等。

1
2
3
4
5
1241.896537] AliSecGuard: module verification failed: signature and/or required key missing - tainting kernel
[1241.897094] AliSecGuard : a130d12303ad1ffdfbd0eea01d79bdedea99d53a
[ 1241.970141] AliSecGuard : a130d12303ad1ffdfbd0eea01d79bdedea99d53a
[ 3224.580869] wireguard: wg0: Could not create IPv4 socket
[ 3224.581661] A link change request failed with some changes committed already. Interface wg0 may have been left with an inconsistent configuration, please check.

WireGuard 在创建 IPv4 socket 时被内核层“拦住了”,而拦截者高度疑似是 AliSecGuard(阿里云安全内核模块)

关键特点:

  1. 内核级 Hook
  • 它会 hook 网络 socket、文件系统、进程创建等敏感路径
  • 例如阻止未知内核模块创建 UDP socket → WireGuard 就可能被拦截
  1. 用户态 + 内核态联动
  • 用户态进程(如 aegisaliyun-service)控制模块
  • 即使杀掉用户态,内核模块可能仍有引用(lsmod 显示引用数 > 0)
  1. 强干扰 VPN / 自建内核模块
  • WireGuard、udp2raw 等隧道模块容易被拒绝
  • 可能导致 socket 创建失败或接口半残
  1. 卸载难度大
  • 引用非 0 时 rmmod 无法卸载
  • 需要先停掉 agent → 确认引用归零 → 才能安全卸载
  • 云控制台若开启“主机安全”,模块可能重生
  1. 应对方法(实际没卵用)
  • 临时:停服务 → modprobe -r(引用为 0 时)
  • 永久:控制台关闭主机安全 → 黑名单模块 → reboot
  • 生产环境慎用 rmmod -f,否则可能 kernel panic

一句话总结:

AliSecGuard = 阿里云安全内核模块,它抓住系统敏感操作不放,你的 WireGuard 被它拦截就是典型案例。

AliSecGuard + WireGuard 冲突机理图

flowchart TD
    subgraph 内核
        KernelSocket[AF_INET Socket 创建]
        Netfilter[Netfilter Hook]
        AliSecGuard["AliSecGuard 内核模块"]
        wgModule["WireGuard 内核模块"]
    end

    subgraph 用户态
        aegis["Aegis / Aliyun-Agent"]
        wgUser["wg-quick / WireGuard 用户态工具"]
    end

    wgUser -->|请求创建接口| wgModule
    wgModule -->|创建 socket| KernelSocket
    KernelSocket -->|经过 netfilter hook| Netfilter
    Netfilter -->|被 AliSecGuard 拦截| AliSecGuard
    AliSecGuard -->|拒绝操作| KernelSocket
    aegis -->|控制 & 维护模块| AliSecGuard

    style AliSecGuard fill:#ffcccc,stroke:#ff0000,stroke-width:2px
    style wgModule fill:#ccffcc,stroke:#008000,stroke-width:2px
    style KernelSocket fill:#ffffcc,stroke:#ffaa00,stroke-width:2px

解读

  1. wg-quick → 用户态 → 内核模块 → 尝试创建 socket
  2. 内核层通过 netfilter hook 拦截
  3. AliSecGuard 拒绝 socket 创建 → WireGuard 报 Could not create IPv4 socket
  4. 用户态 Agent 维护 AliSecGuard,使其自动驻留内核

颜色提示:

  • 红色 = 安全模块(阻塞源)
  • 绿色 = WireGuard
  • 黄色 = 内核核心 socket 资源