From b0fb3581249a48e05726296967bb0757afe8021b Mon Sep 17 00:00:00 2001 From: darkclip Date: Thu, 29 Jan 2026 01:57:09 +0800 Subject: [PATCH] update --- add-crowdsec.sh => setup-crowdsec.sh | 35 ++++++---------------------- 1 file changed, 7 insertions(+), 28 deletions(-) rename add-crowdsec.sh => setup-crowdsec.sh (52%) diff --git a/add-crowdsec.sh b/setup-crowdsec.sh similarity index 52% rename from add-crowdsec.sh rename to setup-crowdsec.sh index 387d0a7..7a65bc7 100755 --- a/add-crowdsec.sh +++ b/setup-crowdsec.sh @@ -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 [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; \ No newline at end of file +setup; \ No newline at end of file