2022-05-27 16:19:11 -04:00
|
|
|
#!/usr/bin/env bash
|
2023-02-07 12:15:22 -05:00
|
|
|
|
2026-01-06 13:28:12 +01:00
|
|
|
# Copyright (c) 2021-2026 tteck
|
2023-02-07 12:15:22 -05:00
|
|
|
# Author: tteck (tteckster)
|
2026-02-24 15:11:53 +01:00
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
|
# Source: https://www.crowdsec.net/ | Github: https://github.com/crowdsecurity/crowdsec
|
2023-02-07 12:15:22 -05:00
|
|
|
|
2022-05-27 16:19:11 -04:00
|
|
|
APP="CrowdSec"
|
2026-08-04 21:02:03 +02:00
|
|
|
APP_TYPE="addon"
|
2026-02-17 16:36:20 +01:00
|
|
|
|
2026-08-04 21:02:03 +02:00
|
|
|
if ! command -v curl &>/dev/null; then
|
|
|
|
|
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
|
|
|
|
|
if [[ -f /etc/alpine-release ]]; then
|
|
|
|
|
apk update >/dev/null 2>&1
|
|
|
|
|
apk add --no-cache curl >/dev/null 2>&1
|
|
|
|
|
else
|
|
|
|
|
apt-get update >/dev/null 2>&1
|
|
|
|
|
apt-get install -y curl >/dev/null 2>&1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2026-10-01 08:15:12 +02:00
|
|
|
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/core.func")
|
|
|
|
|
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/lib/tools.func")
|
|
|
|
|
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/error_handler.func")
|
|
|
|
|
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/api/api.func") 2>/dev/null || true
|
2026-02-17 16:36:20 +01:00
|
|
|
declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "crowdsec" "addon"
|
|
|
|
|
|
2026-08-04 21:02:03 +02:00
|
|
|
# Enable error handling
|
|
|
|
|
set -Eeuo pipefail
|
|
|
|
|
trap 'error_handler' ERR
|
|
|
|
|
|
|
|
|
|
# Initialize all core functions (colors, formatting, icons, STD mode)
|
|
|
|
|
load_functions
|
|
|
|
|
require_debian_like
|
|
|
|
|
|
|
|
|
|
header_info
|
|
|
|
|
confirm_not_pve_host
|
2022-05-27 16:19:11 -04:00
|
|
|
|
|
|
|
|
while true; do
|
2026-08-04 21:02:03 +02:00
|
|
|
echo -n "${TAB}This will Install ${APP}. Proceed (y/n)? "
|
|
|
|
|
read -r yn
|
2025-04-02 19:23:58 +02:00
|
|
|
case $yn in
|
|
|
|
|
[Yy]*) break ;;
|
|
|
|
|
[Nn]*) exit ;;
|
|
|
|
|
*) echo "Please answer yes or no." ;;
|
|
|
|
|
esac
|
2022-05-27 16:19:11 -04:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
msg_info "Setting up ${APP} Repository"
|
2026-08-04 21:02:03 +02:00
|
|
|
$STD apt update
|
|
|
|
|
$STD apt install -y \
|
|
|
|
|
curl \
|
|
|
|
|
gnupg
|
|
|
|
|
$STD bash -c "curl -fsSL https://install.crowdsec.net | bash"
|
2022-05-27 16:19:11 -04:00
|
|
|
msg_ok "Setup ${APP} Repository"
|
|
|
|
|
|
|
|
|
|
msg_info "Installing ${APP}"
|
2026-08-04 21:02:03 +02:00
|
|
|
$STD apt update
|
|
|
|
|
$STD apt install -y crowdsec
|
|
|
|
|
msg_ok "Installed ${APP}"
|
2022-05-27 16:19:11 -04:00
|
|
|
|
|
|
|
|
msg_info "Installing ${APP} Common Bouncer"
|
2026-08-04 21:02:03 +02:00
|
|
|
$STD apt install -y crowdsec-firewall-bouncer-iptables
|
2022-05-27 16:19:11 -04:00
|
|
|
msg_ok "Installed ${APP} Common Bouncer"
|
|
|
|
|
|
2026-01-06 22:57:40 +01:00
|
|
|
msg_ok "Completed successfully!\n"
|