13 Star 56 Fork 25

bukale/zhongkui-waf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
install.sh 4.00 KB
一键复制 编辑 原始数据 按行查看 历史
bukale 提交于 2024-08-15 18:06 . 增加站点独立配置功能
#!/bin/bash
echo "
______ _ __ _
|__ / |__ ___ _ __ __ _| |/ / _(_)
/ /| '_ \ / _ \| '_ \ / _\` | ' / | | | |
/ /_| | | | (_) | | | | (_| | . \ |_| | |
/____|_| |_|\___/|_| |_|\__, |_|\_\__,_|_|
|___/
"
OPENRESTY_PATH=/usr/local/openresty
ZHONGKUI_PATH=$OPENRESTY_PATH/zhongkui-waf
GEOIP_DATABASE_PATH=/usr/local/share/GeoIP
cd /usr/local/src
if [ ! -x "openresty-1.25.3.2.tar.gz" ]; then
wget https://openresty.org/download/openresty-1.25.3.2.tar.gz
fi
tar zxf openresty-1.25.3.2.tar.gz
cd openresty-1.25.3.2
./configure --prefix=$OPENRESTY_PATH \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_sub_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-http_secure_link_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--without-http_fastcgi_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module
make && make install
echo -e "\033[34m[openresty安装成功]\033[0m"
cd /usr/local/src
if [ ! -x "zhongkui-waf-master.zip" ]; then
wget -O /usr/local/src/zhongkui-waf-master.zip https://github.com/bukaleyang/zhongkui-waf/archive/refs/heads/master.zip --no-check-certificate
fi
unzip zhongkui-waf-master.zip
mv ./zhongkui-waf-master $OPENRESTY_PATH/zhongkui-waf
mkdir -p $OPENRESTY_PATH/nginx/logs/hack
echo -e "\033[34m[hack目录已创建]\033[0m"
echo -e "\033[34m[zhongkui-waf安装成功]\033[0m"
cd /usr/local/src
if [ ! -x "libmaxminddb-1.7.1.tar.gz" ]; then
wget https://github.com/maxmind/libmaxminddb/releases/download/1.7.1/libmaxminddb-1.7.1.tar.gz
fi
tar -zxf libmaxminddb-1.7.1.tar.gz
cd ./libmaxminddb-1.7.1
./configure
make && make install
echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
ldconfig
echo -e "\033[34m[libmaxminddb安装成功]\033[0m"
cd /usr/local/src
if [ ! -x "libinjection-master.zip" ]; then
wget -O /usr/local/src/libinjection-master.zip https://github.com/client9/libinjection/archive/refs/heads/master.zip
fi
unzip libinjection-master.zip
cd ./libinjection-master
make all
mv ./src/libinjection.so $OPENRESTY_PATH/lualib/libinjection.so
echo -e "\033[34m[libinjection安装成功]\033[0m"
cd /usr/local/src
if [ ! -x "luaossl-rel-20220711.tar.gz" ]; then
wget -O /usr/local/src/luaossl-rel-20220711.tar.gz https://github.com/wahern/luaossl/archive/refs/tags/rel-20220711.tar.gz
fi
tar -zxf luaossl-rel-20220711.tar.gz
cd ./luaossl-rel-20220711
make all5.1 includedir=$OPENRESTY_PATH/luajit/include/luajit-2.1 && make install5.1
echo -e "\033[34m[luaossl安装成功]\033[0m"
cd /usr/local/src
if [ ! -x "luafilesystem-master.zip" ]; then
wget -O /usr/local/src/luafilesystem-master.zip https://github.com/lunarmodules/luafilesystem/archive/refs/heads/master.zip
fi
unzip luafilesystem-master.zip
cd ./luafilesystem-master
make INCS=-I$OPENRESTY_PATH/luajit/include/luajit-2.1
mv ./src/lfs.so $OPENRESTY_PATH/lualib/lfs.so
echo -e "\033[34m[luafilesystem安装成功]\033[0m"
# =================maxminddb数据库文件自动更新start=================
cd /usr/local/src
if [ ! -x "geoipupdate_6.0.0_linux_386.tar.gz" ]; then
wget https://github.com/maxmind/geoipupdate/releases/download/v6.0.0/geoipupdate_6.0.0_linux_386.tar.gz
fi
tar -zxf geoipupdate_6.0.0_linux_386.tar.gz
mv ./geoipupdate_6.0.0_linux_386/geoipupdate /usr/local/bin/geoipupdate
if [ -x "/usr/local/bin/geoipupdate" ]; then
# 将配置文件GeoIP.conf写入到/usr/local/etc/目录
echo "
AccountID your AccountID
LicenseKey your LicenseKey
#EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country
EditionIDs GeoLite2-City
DatabaseDirectory $GEOIP_DATABASE_PATH
" >> /usr/local/etc/GeoIP.conf
echo -e "\033[34m[GeoIP.conf安装成功]\033[0m"
echo "32 8 * * 1,3 /usr/local/bin/geoipupdate" | crontab -
echo -e "\033[34m[geoipupdate安装成功]\033[0m"
mkdir -p $GEOIP_DATABASE_PATH
/usr/local/bin/geoipupdate
fi
# =================maxminddb数据库文件自动更新end=================
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Lua
1
https://gitee.com/bukaleyang/zhongkui-waf.git
git@gitee.com:bukaleyang/zhongkui-waf.git
bukaleyang
zhongkui-waf
zhongkui-waf
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385