WEB服务器,在互联网上,不可避免的遇到安全问题,推荐一款免费的WAF.
一、基础环境
$ uname -a
Linux open-boots-1.localdomain 5.14.0-60.el9.x86_64 #1 SMP PREEMPT Tue Feb 15 06:49:54 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r
5.14.0-60.el9.x86_64
$ uname -m
x86_64
$ dnf install tar git g++ -y SourceByrd's Blog-https://note.t4x.org/basic/config-safeline-waf/
二、安装配置
2.0 Docker安装
0123 sudo dnf -y install dnf-plugins-coresudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.reposudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginsudo systemctl enable --now docker
2.1 创建目录
0 mkdir /data/safeline
2.2 下载脚本
01 cd "/data/safeline"wget "https://waf-ce.chaitin.cn/release/latest/compose.yaml"
2.3 环境变量
0123456789 cat >> /data/safeline/.env <<BYRDSAFELINE_DIR=/data/safelineIMAGE_TAG=6.3.0 #最新版请修改为latestMGT_PORT=9443POSTGRES_PASSWORD=yourpasswordSUBNET_PREFIX=172.22.222IMAGE_PREFIX=swr.cn-east-3.myhuaweicloud.com/chaitin-safelineARCH_SUFFIX=RELEASE=BYRD
2.4 启动
0 docker compose up -d
2.5 6.3.0 compose
SourceByrd's Blog-https://note.t4x.org/basic/config-safeline-waf/
0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 cat compose.yamlnetworks:safeline-ce:name: safeline-cedriver: bridgeipam:driver: defaultconfig:- gateway: ${SUBNET_PREFIX:?SUBNET_PREFIX required}.1subnet: ${SUBNET_PREFIX}.0/24driver_opts:com.docker.network.bridge.name: safeline-ceservices:postgres:container_name: safeline-pgrestart: alwaysimage: ${IMAGE_PREFIX}/safeline-postgres:15.2volumes:- ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data- /etc/localtime:/etc/localtime:roenvironment:- POSTGRES_USER=safeline-ce- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?postgres password required}networks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.2command: [postgres, -c, max_connections=600]healthcheck:test: pg_isready -U safeline-ce -d safeline-cemgt:container_name: safeline-mgtrestart: alwaysimage: ${IMAGE_PREFIX}/safeline-mgt:${IMAGE_TAG:?image tag required}volumes:- /etc/localtime:/etc/localtime:ro- ${SAFELINE_DIR}/resources/mgt:/app/dataports:- ${MGT_PORT:-9443}:1443healthcheck:test: curl -k -f https://localhost:1443/api/open/healthenvironment:- MGT_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disabledepends_on:- postgres- fvmlogging:options:max-size: "100m"max-file: "5"networks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.4detect:container_name: safeline-detectorrestart: alwaysimage: ${IMAGE_PREFIX}/safeline-detector:${IMAGE_TAG}volumes:- ${SAFELINE_DIR}/resources/detector:/resources/detector- ${SAFELINE_DIR}/logs/detector:/logs/detector- /etc/localtime:/etc/localtime:roenvironment:- LOG_DIR=/logs/detectornetworks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.5mario:container_name: safeline-mariorestart: alwaysimage: ${IMAGE_PREFIX}/safeline-mario:${IMAGE_TAG}volumes:- ${SAFELINE_DIR}/resources/mario:/resources/mario- ${SAFELINE_DIR}/logs/mario:/logs/mario- /etc/localtime:/etc/localtime:roenvironment:- LOG_DIR=/logs/mario- GOGC=100- DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-celogging:options:max-size: "100m"max-file: "5"networks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.6tengine:container_name: safeline-tenginerestart: alwaysimage: ${IMAGE_PREFIX}/safeline-tengine:${IMAGE_TAG}volumes:- /etc/localtime:/etc/localtime:ro- /etc/resolv.conf:/etc/resolv.conf:ro- ${SAFELINE_DIR}/resources/nginx:/etc/nginx- ${SAFELINE_DIR}/resources/detector:/resources/detector- ${SAFELINE_DIR}/logs/nginx:/var/log/nginx- ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache- ${SAFELINE_DIR}/resources/chaos:/resources/chaos- ${SAFELINE_DIR}/logs/nginx:/var/log/nginx:z- ${SAFELINE_DIR}/resources/sock:/app/sockenvironment:- TCD_MGT_API=https://${SUBNET_PREFIX}.4:1443/api/open/publish/server- TCD_SNSERVER=${SUBNET_PREFIX}.5:8000# deprecated- SNSERVER_ADDR=${SUBNET_PREFIX}.5:8000ulimits:nofile: 131072network_mode: hostluigi:container_name: safeline-luigirestart: alwaysimage: ${IMAGE_PREFIX}/safeline-luigi:${IMAGE_TAG}environment:- MGT_IP=${SUBNET_PREFIX}.4volumes:- /etc/localtime:/etc/localtime:ro- ${SAFELINE_DIR}/resources/luigi:/app/datalogging:options:max-size: "100m"max-file: "5"depends_on:- detect- mgtnetworks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.7fvm:container_name: safeline-fvmrestart: alwaysimage: ${IMAGE_PREFIX}/safeline-fvm:${IMAGE_TAG}volumes:- /etc/localtime:/etc/localtime:rologging:options:max-size: "100m"max-file: "5"networks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.8bridge:container_name: safeline-bridgerestart: alwaysimage: ${IMAGE_PREFIX}/safeline-bridge:${IMAGE_TAG}command:- /app/bridge- serve- -n- unix- -a- /app/run/safeline.sockvolumes:- /etc/localtime:/etc/localtime:ro- /var/run:/app/runlogging:options:max-size: "100m"max-file: "5"networks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.9depends_on:- mgtchaos:container_name: safeline-chaosrestart: alwaysimage: ${IMAGE_PREFIX}/safeline-chaos${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG}logging:options:max-size: "100m"max-file: "10"volumes:- ${SAFELINE_DIR}/resources/sock:/app/sock- ${SAFELINE_DIR}/resources/chaos:/app/chaosnetworks:safeline-ce:ipv4_address: ${SUBNET_PREFIX}.10
三、其他信息
之所以使用6.3.0是因为我从5.x升级到最新版本以后,发现以前很多free的功能开始收费了.降了一下版本。 SourceByrd's Blog-https://note.t4x.org/basic/config-safeline-waf/
官方资料:
1:https://docs.waf-ce.chaitin.cn/
2:https://github.com/chaitin/SafeLine/SourceByrd's Blog-https://note.t4x.org/basic/config-safeline-waf/
SourceByrd's Blog-https://note.t4x.org/basic/config-safeline-waf/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!