From cf22356a8e58b76d3db9397d541ad61bef762621 Mon Sep 17 00:00:00 2001 From: hl Date: Fri, 1 Nov 2024 23:39:47 +0800 Subject: [PATCH] update --- add-crowdsec.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/add-crowdsec.sh b/add-crowdsec.sh index 59ab121..413838c 100755 --- a/add-crowdsec.sh +++ b/add-crowdsec.sh @@ -14,7 +14,9 @@ main(){ command -v $command &>/dev/null || command="apt" $command update $command install -y crowdsec crowdsec-firewall-bouncer-iptables +} +setup(){ echo -e "db_config: use_wal: true" | tee /etc/crowdsec/config.yaml.local @@ -39,4 +41,26 @@ whitelist: systemctl reload crowdsec } -main; \ No newline at end of file +usage(){ + echo "Usage: $0 [OPTIONS]"; + echo "OPTIONS:"; + echo " -i install only"; +} + +INSTALL_ONLY=0; +while getopts ":i" OPT; do + case $OPT in + i) + INSTALL_ONLY=1; + ;; + ?) + echo "Invalid Option: -$OPTARG"; + usage; + exit 1;; + esac; +done; + +main; +if [ $INSTALL_ONLY -eq 0 ]; then + setup; +fi; \ No newline at end of file