diff --git a/CHANGELOG.md b/CHANGELOG.md index 94129cb..f0a03d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,15 @@ SAFELINE-CE CHANGELOG ## [Unreleased] -- 仪表盘 - 告警 +## [1.2.0] - 2023-04-27 + +### 新增 +- 新增了数据统计页面,可以直观的看到流量大小 +- 支持配置源 IP 提取方式,解决了源 IP 获取不对的问题 +- 支持自定义检测策略,可以动态调整检测引擎 + ## [1.1.0] - 2023-04-20 ### 新增 diff --git a/README.md b/README.md index 954b229..67a5a35 100644 --- a/README.md +++ b/README.md @@ -50,15 +50,8 @@ sudo docker compose up -d **WARN: SafeLine will be restarted and your traffic will be unavailable for a short period of time. You may need to choose a proper time for upgration.** -``` -# check `IMAGE_TAG` -cat .env | grep IMAGE_TAG -# set IMAGE_TAG to `latest` or some specific version like `1.1.0` -sed -i "s/IMAGE_TAG=.*/IMAGE_TAG=latest/g" .env - -# check `compose.yaml` -# image namespace has changed to `chaitin` -sed -i "s/chaitinops/chaitin/g" compose.yaml +```shell +curl -kfLsS https://waf-ce.chaitin.cn/release/latest/upgrade.sh | bash # replace with `docker-compose` if necessary. docker compose down && docker compose pull && docker compose up -d diff --git a/README_CN.md b/README_CN.md index db58c71..e88d18f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -50,15 +50,8 @@ sudo docker compose up -d **WARN: 雷池 SafeLine 服务会重启,流量会中断一小段时间,根据业务情况选择合适的时间来执行升级操作。** -``` -# 查看 `IMAGE_TAG` -cat .env | grep IMAGE_TAG -# 把 IMAGE_TAG 修改为 latest 或者某个特定版本,比如 1.1.0 -sed -i "s/IMAGE_TAG=.*/IMAGE_TAG=latest/g" .env - -# 检查 `compose.yaml` -# docker 镜像的命名空间调整到了 `chaitin`,部分旧版本配置是使用的 `chaitinops` -sed -i "s/chaitinops/chaitin/g" compose.yaml +```shell +curl -kfLsS https://waf-ce.chaitin.cn/release/latest/upgrade.sh | bash # 根据环境情况自行使用 `docker compose` 或者 `docker-compose` docker compose down && docker compose pull && docker compose up -d diff --git a/compose.yaml b/compose.yaml index 549b0f6..38d9051 100644 --- a/compose.yaml +++ b/compose.yaml @@ -17,6 +17,7 @@ services: image: postgres:15.2 volumes: - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro environment: - POSTGRES_USER=safeline-ce - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?postgres password required} @@ -54,6 +55,7 @@ services: volumes: - ${SAFELINE_DIR}/resources/detector:/resources/detector - ${SAFELINE_DIR}/logs/detector:/logs/detector + - /etc/localtime:/etc/localtime:ro environment: - LOG_DIR=/logs/detector networks: @@ -68,6 +70,7 @@ services: volumes: - ${SAFELINE_DIR}/resources/mario:/resources/mario - ${SAFELINE_DIR}/logs/mario:/logs/mario + - /etc/localtime:/etc/localtime:ro environment: - LOG_DIR=/logs/mario - GOGC=100 @@ -89,6 +92,8 @@ services: - /etc/localtime:/etc/localtime:ro - ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache - /etc/resolv.conf:/etc/resolv.conf + environment: + - MGT_ADDR=169.254.0.4:9002 ulimits: nofile: 131072 network_mode: host \ No newline at end of file diff --git a/homepage/public/release/latest/upgrade.sh b/homepage/public/release/latest/upgrade.sh new file mode 120000 index 0000000..cd77ed7 --- /dev/null +++ b/homepage/public/release/latest/upgrade.sh @@ -0,0 +1 @@ +../../../../upgrade.sh \ No newline at end of file diff --git a/homepage/src/static/md/about_changelog.md b/homepage/src/static/md/about_changelog.md index f756ec7..de8e1db 100644 --- a/homepage/src/static/md/about_changelog.md +++ b/homepage/src/static/md/about_changelog.md @@ -5,3 +5,32 @@ weight: 3 --- # 版本更新记录 + +## [1.2.0] - 2023-04-27 + +### 新增 +- 新增了数据统计页面,可以直观的看到流量大小 +- 支持配置源 IP 提取方式,解决了源 IP 获取不对的问题 +- 支持自定义检测策略,可以动态调整检测引擎 + +## [1.1.0] - 2023-04-20 + +### 新增 +- 支持根据 IP 和 URL 特征配置黑白名单 +- 默认开启高防模式 + +### 优化 +- 支持在日志详情中展示响应报文 +- 服务器时间不准导致 TOTP 无法登录时增加了提示语 +- 修复了上游服务器填 HTTPS 时端口解析不正确的问题 +- 优化了 SSL 上传逻辑,体验更好 + +## [1.0.0] - 2023-04-13 + +- 站点配置 + +## [0.9.0] - 2023-03-20 + +- OTP 登录 +- 攻击检测日志 +- 默认防护策略 \ No newline at end of file diff --git a/homepage/src/static/md/guide_upgrade.md b/homepage/src/static/md/guide_upgrade.md index 0fe9016..2c4a7ac 100644 --- a/homepage/src/static/md/guide_upgrade.md +++ b/homepage/src/static/md/guide_upgrade.md @@ -8,15 +8,8 @@ weight: 6 **WARN: 雷池 SafeLine 服务会重启,流量会中断一小段时间,根据业务情况选择合适的时间来执行升级操作。** -``` -# 查看 `IMAGE_TAG` -cat .env | grep IMAGE_TAG -# 把 IMAGE_TAG 修改为 latest 或者某个特定版本,比如 1.1.0 -sed -i "s/IMAGE_TAG=.*/IMAGE_TAG=latest/g" .env - -# 检查 `compose.yaml` -# docker 镜像的命名空间调整到了 `chaitin`,部分旧版本配置是使用的 `chaitinops` -sed -i "s/chaitinops/chaitin/g" compose.yaml +```shell +curl -kfLsS https://waf-ce.chaitin.cn/release/latest/upgrade.sh | bash # 根据环境情况自行使用 `docker compose` 或者 `docker-compose` docker compose down && docker compose pull && docker compose up -d diff --git a/setup.sh b/setup.sh index a80a259..3739d3e 100755 --- a/setup.sh +++ b/setup.sh @@ -30,9 +30,7 @@ if [[ "x${compose_plugin}" = "xfalse" ]]; then fi COMPOSE_YAML="compose.yaml" -if [[ ! -f ${COMPOSE_YAML} ]]; then - wget https://waf-ce.chaitin.cn/release/latest/compose.yaml --no-check-certificate -O ${COMPOSE_YAML} -fi +wget https://waf-ce.chaitin.cn/release/latest/compose.yaml --no-check-certificate -O ${COMPOSE_YAML} ENV_FILE=".env" if [[ ! -f ${ENV_FILE} ]]; then diff --git a/upgrade.sh b/upgrade.sh new file mode 100755 index 0000000..7b59ee2 --- /dev/null +++ b/upgrade.sh @@ -0,0 +1,39 @@ +#! /bin/bash +set -eE + +abort() +{ + echo $1 + exit 1 +} + +echo " + ____ __ _ _ + / ___| __ _ / _| ___ | | (_) _ __ ___ + \___ \ / _\` | | |_ / _ \ | | | | | '_ \ / _ \\ + ___) | | (_| | | _| | __/ | |___ | | | | | | | __/ + |____/ \__,_| |_| \___| |_____| |_| |_| |_| \___| +" + +if [[ "$#" -ne "0" ]]; then + echo "Usage: run "$0" to set up Safeline CE at current working directory." + exit 0 +fi + +command -v docker > /dev/null || abort "docker not found, unable to deploy" +compose_plugin=true +compose_command="docker compose" +docker --help | grep compose | grep v2 > /dev/null || compose_plugin=false || compose_command="docker-compose" + +if [[ "x${compose_plugin}" = "xfalse" ]]; then + command -v docker-compose > /dev/null && docker-compose --version | grep v2 > /dev/null || abort "docker compose v2 not found, unable to deploy" +fi + +COMPOSE_YAML="compose.yaml" +wget https://waf-ce.chaitin.cn/release/latest/compose.yaml --no-check-certificate -O ${COMPOSE_YAML} + +ENV_FILE=".env" +sed -i "s/IMAGE_TAG=.*/IMAGE_TAG=latest/g" ${ENV_FILE} + +$compose_command down && $compose_command pull && $compose_command up -d +echo "Upgrade success!"