Fix fatal CrowdSec crash-loop in ASN-exempt Asterisk scenarios

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.
This commit is contained in:
Claude
2026-07-21 12:57:00 +00:00
parent c2d74f9520
commit c7dac67234
+7 -1
View File
@@ -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