From c7dac67234e5eb8de454afe20d36eb4e23480820 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Jul 2026 12:57:00 +0000 Subject: [PATCH] Fix fatal CrowdSec crash-loop in ASN-exempt Asterisk scenarios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmed live: unquoted integer literals in the ASN exclusion filter (evt.Enriched.ASNNumber in [21928, 14593]) made CrowdSec fatal-crash-loop at startup with "cannot use string as type int in array" — ASNNumber is a string field internally despite printing as a bare number in cscli output, same as IsoCode in the geo-allowlist scenario. Quote each ASN as a string to match, exactly like the working geo-allowlist pattern. --- services/crowdsec.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/crowdsec.sh b/services/crowdsec.sh index f21165f..c37eaf0 100644 --- a/services/crowdsec.sh +++ b/services/crowdsec.sh @@ -207,8 +207,14 @@ labels: local ASN_LIST="" prompt_text " ASN numbers to exempt, space-separated:" "21928 14593" ASN_LIST if [ -n "$ASN_LIST" ]; then + # ASNNumber is a string field internally (like IsoCode in the + # geo-allowlist scenario above) even though it prints as a bare + # number in cscli/explain output. Confirmed live: unquoted + # integer literals here made CrowdSec fatal-crash-loop at + # startup with "cannot use string as type int in array" — + # every ASN must be quoted as a string to match. local _asn_expr - _asn_expr="$(printf "%s, " $ASN_LIST)" + _asn_expr="$(printf "'%s', " $ASN_LIST)" _asn_expr="${_asn_expr%, }" sudo mkdir -p /etc/crowdsec/scenarios