yaencn/safeline-helmchart
GitHub: yaencn/safeline-helmchart
长亭 SafeLine WAF 预览版的 Helm Chart,用于在 Kubernetes 上快速部署和管理 Web 应用防火墙。
Stars: 16 | Forks: 4
SafeLine - 预览版本 - HelmChart
SafeLine 官网 | LTS 仓库 | 预览版仓库 | 中文文档
## ----- 自述文件 ----- 从 AppVersion 7.5.0 开始,为了更好地管理 HelmChart 版本,HelmChart Version 将独立于 AppVersion 进行计算。 **提醒:** 此分支为预览版本分支,仅包含预览版本。 如需使用 LTS 版本,请访问以下 GIT 仓库: https://github.com/yaencn/safeline-lts-helmchart - GitHub 上的预览版仓库 https://github.com/yaencn/safeline-helmchart 中国大陆的 GIT 仓库加速地址: - 预览版仓库 https://gitee.com/andyhau/safeline-helmchart.git - LTS 版仓库 https://gitee.com/andyhau/safeline-lts-helmchart.git - 国际版部署支持 从 appVersion 8.8.2 开始支持 x86_64 架构的国际版部署。如需部署国际版,请将 value.yaml 文件参数修改为以下值: `global.image.registry=chaitin` `global.image.region="-g"` ## ----- HelmChart 安装 ----- - HelmChart 网页地址: https://helm.yaencn.com - HelmChart 仓库地址: 此链接将于 2025 年 9 月 1 日失效: https://g-otkk6267-helm.pkg.coding.net/Charts/safeline 最新的 helmchart 仓库地址: https://helm.yaencn.com/charts - 示例: ``` # 添加 repo helm repo add yaencn https://helm.yaencn.com/charts # 自定义 PostgreSQL 密码 helm install safeline ./safeline/charts \ --namespace safeline \ --create-namespace \ --set database.internal.password="YourCustomPassWord" # 安装 sample helm install safeline --namespace safeline \ --set global.ingress.enabled=true \ --set global.ingress.hostname="waf.local" \ yaencn/safeline # 安装 International 版本 helm install safeline --namespace safeline \ --set global.ingress.enabled=true \ --set global.ingress.hostname="waf.local" \ --set global.image.registry=chaitin \ --set global.image.region="-g" \ yaencn/safeline # 升级 helm -n safeline upgrade safeline yaencn/safeline # 获取 chart helm fetch --version 10.0.9 yaencn/safeline # 卸载 helm -n safeline uninstall safeline ``` ## ----- Helm 构建 ----- ``` # 检测helmchart-template是否有语法问题 cd safeline helm template charts/ --output-dir ./result ``` ``` helm package ./safeline/charts/ -d ./assets/safeline helm repo index --merge ./index.yaml --url assets assets/ rm -f ./index.yaml mv ./assets/index.yaml ./index.yaml cd ./assets/safeline/ helm coding-push safeline-${app-version}.tgz safeline ``` ## ----- 安装提醒 ----- **警告:** 此 HelmChart 中的任何 deployment 资源只能部署一个 pod 副本! 如果运行多个 pod 副本,整个 WAF 服务将遇到未知错误。 ## ----- 版本说明 ----- **6.1.2 版本之后:** - 默认开启 Expose Services As Ports 模式 - 如果您想使用 Ingress 模式,需要将 values 文件中的 `global.exposeServicesAsPorts.enabled` 字段配置为 `false`。 - 可以通过 values 文件中的 `global.exposeServicesAsPorts.enabled` 字段值进行控制。 **6.9.1 版本之后:** 添加了通过 nginx-ingress 绑定域名的 WAF 控制台 Web 界面。 具体请参阅 values.yaml 文件。 ``` # Set up the SafeLine WAF console to be accessed through a domain name. # For example: demowaf-ce.chaitin.cn global: ingress: # Whether to enable SafeLine WAF control for domain access. # It is not enabled by default enabled: true hostname: waf.local ingressClassName: nginx pathType: ImplementationSpecific path: / tls: # Whether to load the Secret of the HTTPS domain name certificate outside HelmChart. #If yes, please fill in the Secret name. By default, it is not filled in and the domain name only enables http access. # If you fill in the following items, please create the corresponding Secret before running the HelmChart. secretName: "waf-xxx-com-tls" ``` ## ----- 核心配置参数 ----- | 参数 | 描述 | 默认值 | |------|------|--------| | `global.image.registry` | 镜像仓库地址 | `swr.cn-east-3.myhuaweicloud.com/chaitin-safeline` | | `global.busyboxImage` | InitContainer 基础镜像 | `busybox:1.36` | | `global.exposeServicesAsPorts.enabled` | 以端口模式暴露服务(建议开启) | `true` | | `database.internal.password` | 数据库密码(**建议修改**) | `changeit` | | `database.type` | 数据库类型 `internal`/`external` | `internal` | | `tengine.service.type` | Tengine 服务类型 | `LoadBalancer` | | `tengine.service.loadBalancerIP` | MetalLB 指定 IP | `""` | | `mgt.service.type` | 管理控制台服务类型 | `NodePort` | | `mgt.service.web.nodePort` | 管理控制台 NodePort | `31443` | | `persistence.persistentVolumeClaim.*.storageClass` | 存储类 (StorageClass) | `""` (使用默认值) | ## 架构组件 | 组件 | 描述 | 端口 | |------|------|------| | **tengine** | WAF 反向代理引擎,处理入站流量 | 80, 65443, 9999 | | **detector** | 威胁检测引擎,语义分析 | 8000, 8001, 7777 | | **mgt** | 管理控制台 Web UI | 1443, 80, 8000 | | **chaos** | 人机验证 / 排队等待室 | 9000, 23333, 8080 | | **fvm** | 特征/漏洞管理 | 9004, 80 | | **luigi** | 日志处理 | 80 | | **database** | PostgreSQL 数据库 | 5432 | ## 安全注意事项 1. **数据库密码**:默认密码为 `changeit`,**建议**在部署前进行修改。 2. **数据库连接字符串**:已从 ConfigMap 迁移至 Secret 存储,以避免明文泄露。 3. **JWT 密钥**:默认的 EC 私钥包含在 `chaos-cm.yaml` 中,建议在生产环境中将其替换: ```bash openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem openssl ec -in ec_private.pem -pubout -out ec_public.pem ``` 4. **Replica Limit**: All Deployments can only run... **Only one replica is needed.** Multiple replicas will cause WAF service malfunctions. ```标签:AppImage, Helm, WAF, Web应用防火墙, 子域名突变, 测试用例, 请求拦截