cs-firewall-bouncer: not updating ipset / iptables

I have abount 100+ ips in the ban list but bouncer only adds the first 4 ips :

crowdsec-firewall-bouncer-iptables 0.0.31 (ubuntu):

time="2025-02-27T10:17:53+01:00" level=info msg="Adding rule : /usr/sbin/iptables -I INPUT -j CROWDSEC_CHAIN"
time="2025-02-27T10:17:53+01:00" level=info msg="Adding rule : /usr/sbin/iptables -I FORWARD -j CROWDSEC_CHAIN"
time="2025-02-27T10:17:53+01:00" level=info msg="Using API key auth"
time="2025-02-27T10:17:53+01:00" level=debug msg="InsecureSkipVerify is set to false"
time="2025-02-27T10:17:53+01:00" level=debug msg="[URL] GET http://10.43.150.135:8080/v1/decisions/stream?startup=true"
time="2025-02-27T10:17:53+01:00" level=debug msg="req-api: GET http://10.43.150.135:8080/v1/decisions/stream?startup=true"
time="2025-02-27T10:17:53+01:00" level=debug msg="Systemd notified: READY=1"
time="2025-02-27T10:17:53+01:00" level=info msg="Processing new and deleted decisions . . ."
time="2025-02-27T10:32:53+01:00" level=debug msg="Updating metrics"
time="2025-02-27T10:32:53+01:00" level=debug msg="Processed 29445 packets and 26546635 bytes"
time="2025-02-27T10:32:53+01:00" level=debug msg="Dropped packets : map[]"
time="2025-02-27T10:32:53+01:00" level=debug msg="Dropped bytes : map[]"
time="2025-02-27T10:32:53+01:00" level=debug msg="Sending processed bytes for ipv4 26546635.000000 | current value: 26546635.000000 | previous value: 0.000000\n"
time="2025-02-27T10:32:53+01:00" level=debug msg="Sending processed packets for ipv4 29445.000000 | current value: 29445.000000 | previous value: 0.000000\n"
time="2025-02-27T10:32:53+01:00" level=debug msg="[URL] POST http://10.43.150.135:8080/v1/usage-metrics"
time="2025-02-27T10:32:53+01:00" level=debug msg="req-api: POST http://10.43.150.135:8080/v1/usage-metrics"
time="2025-02-27T10:32:53+01:00" level=debug msg="resp-api: http 201"
time="2025-02-27T10:32:53+01:00" level=debug msg="[headers] Date: [Thu, 27 Feb 2025 09:32:53 GMT]"
time="2025-02-27T10:32:53+01:00" level=debug msg="[headers] Content-Length: [0]"
time="2025-02-27T10:32:53+01:00" level=debug msg="Response: HTTP/1.1 201 Created\r\nContent-Length: 0\r\nDate: Thu, 27 Feb 2025 09:32:53 GMT\r\n\r\n"
time="2025-02-27T10:32:53+01:00" level=debug msg="usage metrics sent"

bouncer is connceted:

crowdsec-lapi-6d7644b4d8-hzfsc:/# cscli  bouncers list
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 Name      IP Address  Valid  Last API pull         Type                       Version                                                                  Auth Type 
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 firewall  10.0.5.154  ✔️     2025-02-27T09:34:51Z  crowdsec-firewall-bouncer  v0.0.31-debian-pragmatic-amd64-4b99c161b2c1837d76c5fa89e1df83803dfbcc87  api-key   
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
crowdsec-lapi-6d7644b4d8-hzfsc:/# cscli decisions list -a
╭─────┬──────────┬────────────────────┬────────────────────────────────────────┬────────┬─────────┬──────────────────────────────────────────────────────────────┬────────┬────────────┬──────────╮
│  ID │  Source  │     Scope:Value    │                 Reason                 │ Action │ Country │                              AS                              │ Events │ expiration │ Alert ID │
├─────┼──────────┼────────────────────┼────────────────────────────────────────┼────────┼─────────┼──────────────────────────────────────────────────────────────┼────────┼────────────┼──────────┤
│ 108 │ crowdsec │ Ip:23.249.81.235   │ crowdsecurity/postfix-non-smtp-command │ ban    │ US      │ 18467 AXIOM-TECH                                             │ 1      │ 3h53m59s   │ 108      │
│ 107 │ crowdsec │ Ip:194.186.69.166  │ crowdsecurity/postfix-non-smtp-command │ ban    │ RU      │ 3216 PVimpelCom                                              │ 1      │ 3h31m50s   │ 107      │
│ 106 │ crowdsec │ Ip:149.0.19.108    │ crowdsecurity/postfix-non-smtp-command │ ban    │ TR      │ 8386 Vodafone Net Iletisim Hizmetler AS                      │ 1      │ 3h26m36s   │ 106      │
│ 105 │ crowdsec │ Ip:63.116.23.24    │ crowdsecurity/postfix-non-smtp-command │ ban    │ US      │ 701 UUNET                                                    │ 1      │ 2h54m49s   │ 105      │
│ 104 │ crowdsec │ Ip:198.235.24.255  │ crowdsecurity/postfix-non-smtp-command │ ban    │ US      │ 396982 GOOGLE-CLOUD-PLATFORM                                 │ 1      │ 2h36m24s   │ 104      │
│ 103 │ crowdsec │ Ip:102.53.15.17    │ crowdsecurity/postfix-non-smtp-command │ ban    │ MA      │ 6713 Itissalat Al-MAGHRIB                                    │ 1      │ 2h35m25s   │ 103      │
│ 102 │ crowdsec │ Ip:65.20.129.253   │ crowdsecurity/postfix-non-smtp-command │ ban    │ IQ      │ 203214 Hulum Almustakbal Company for Communication           │ 1      │ 2h21m23s   │ 102      │
│     │          │                    │                                        │        │         │ Engineering and Services Ltd                                 │        │            │          │
│ 101 │ crowdsec │ Ip:94.156.227.249  │ crowdsecurity/postfix-spam             │ ban    │ NL      │ 214943 Railnet LLC                                           │ 10     │ 1h50m57s   │ 101      │
│ 99  │ crowdsec │ Ip:81.211.77.58    │ crowdsecurity/postfix-non-smtp-command │ ban    │ RU      │ 3216 PVimpelCom                                              │ 1      │ 1h18m56s   │ 99       │
│ 98  │ crowdsec │ Ip:106.219.120.86  │ crowdsecurity/postfix-non-smtp-command │ ban    │ IN      │ 24560 Bharti Airtel Ltd., Telemedia Services                 │ 1      │ 1h0m36s    │ 98       │
│ 97  │ crowdsec │ Ip:117.203.124.167 │ crowdsecurity/postfix-non-smtp-command │ ban    │ IN      │ 9829 National Internet Backbone                              │ 1      │ 59m42s     │ 97       │
│ 96  │ crowdsec │ Ip:103.189.135.134 │ crowdsecurity/postfix-non-smtp-command │ ban    │ IN      │ 141329 Udupi Fastnet Private Limited                         │ 1      │ 59m4s      │ 96       │
│ 94  │ crowdsec │ Ip:49.230.73.15    │ crowdsecurity/postfix-non-smtp-command │ ban    │ TH      │ 131445 Advance Wireless Network                              │ 1      │ 55m23s     │ 94       │
│ 93  │ crowdsec │ Ip:62.182.116.62   │ crowdsecurity/postfix-non-smtp-command │ ban    │ BG      │ 34917 Orlandonet ltd.                                        │ 1      │ 30m42s     │ 93       │
│ 92  │ crowdsec │ Ip:165.154.232.55  │ crowdsecurity/postfix-relay-denied     │ ban    │ TH      │ 142002 Scloud Pte Ltd                                        │ 2      │ 3m4s       │ 92       │
╰─────┴──────────┴────────────────────┴────────────────────────────────────────┴────────┴─────────┴──────────────────────────────────────────────────────────────┴────────┴────────────┴──────────╯
2 duplicated entries skipped

crowdsec-lapi-6d7644b4d8-hzfsc:/# cscli metrics show bouncers
╭───────────────────────────────────────────────────────────────────────────────────────────╮
│ Bouncer Metrics (firewall) since 2025-02-26 11:06:35 +0000 UTC                            │
├────────────────────────────┬──────────────────┬───────────────────┬───────────────────────┤
│ Origin                     │ active_decisions │      dropped      │       processed       │
│                            │        IPs       │  bytes  │ packets │   bytes   │  packets  │
├────────────────────────────┼──────────────────┼─────────┼─────────┼───────────┼───────────┤
│ crowdsec (security engine) │                4 │       0 │       0 │         - │         - │
├────────────────────────────┼──────────────────┼─────────┼─────────┼───────────┼───────────┤
│                      Total │                4 │       0 │       0 │   208.82M │   233.08k │
╰────────────────────────────┴──────────────────┴─────────┴─────────┴───────────┴───────────╯
ipset list:

Name: crowdsec-blacklists-0
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 131072 timeout 300
Size in memory: 832
References: 0
Number of entries: 4
Members:
207.188.157.230 timeout 12931
46.43.91.245 timeout 13121
139.135.241.218 timeout 13096
94.207.76.122 timeout 13117

that 4 ips are the oldest entries in the alert list, they were added yesterday. Everytime i restart the bouncer the list will be reseted to that 4 ips.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

i have upgraded to k3s v1.30.10 and that seems to fixed the issue! thanks again

i think i have found a bugticket, i have k3s 1.30.0 running https://github.com/k3s-io/k3s/issues/10205

when i create a new ipset hash:net “test” with just one ip, it persists while crowdsec-blacklists-0 gets replaced after some time. I now killed -9 the bouncer and it was replaced after some time. so this is not a bouncer bug.

maybe i should deploy the bouncer also in k8s, thanks for helping debugging.!