This commit is contained in:
darkclip 2026-01-29 01:57:09 +08:00
parent ecd39d2098
commit b0fb358124
Signed by: hl
GPG Key ID: A948B2AA5A5D3BDB

View File

@ -1,22 +1,10 @@
#!/usr/bin/env bash
set -e
OS_ARCH=$(dpkg --print-architecture) || (echo "Not Debian Based Distro" && exit 1)
OS_CODE=$(source /etc/os-release && echo "$VERSION_CODENAME")
SCRIPT=$(readlink -f "$0")
AWD=$(dirname "$SCRIPT")
main(){
echo "deb https://packagecloud.io/crowdsec/crowdsec/debian/ $OS_CODE main" | \
tee /etc/apt/sources.list.d/crowdsec_crowdsec.list
curl -fsSL "https://packagecloud.io/crowdsec/crowdsec/gpgkey" $SET_PROXY | \
gpg --dearmor | tee /etc/apt/trusted.gpg.d/crowdsec_crowdsec-archive-keyring.gpg > /dev/null
echo "crowdsec crowdsec-firewall-bouncer-iptables" | $AWD/install.sh
}
setup(){
echo "crowdsec crowdsec-firewall-bouncer-iptables" | $AWD/install.sh
echo -e "db_config:
use_wal: true" | tee /etc/crowdsec/config.yaml.local
@ -44,19 +32,13 @@ whitelist:
usage(){
echo "Usage: $0 [OPTIONS]";
echo "OPTIONS:";
echo " -s skip setup";
echo " -x <PROXY> Proxy [protocol://]host[:port]";
echo " -h show this help";
}
DO_SETUP=true;
SET_PROXY=;
while getopts ":sx:" OPT; do
while getopts ":h" OPT; do
case $OPT in
s)
DO_SETUP=false;
;;
x)
SET_PROXY="-x $OPTARG";
h)
usage;
;;
?)
echo "Invalid Option: -$OPTARG";
@ -65,7 +47,4 @@ while getopts ":sx:" OPT; do
esac;
done;
main
if $DO_SETUP; then
setup
fi;
setup;