crowdsec icon indicating copy to clipboard operation
crowdsec copied to clipboard

[Docker container] 403 Forbidden HTTP error when downloading GeoLite2-City.mmdb

Open KyoTensu opened this issue 11 months ago • 40 comments

What happened?

While trying to access a service through Pangolin, which is set up with a crowdsec container alongside it, I got errors and tried to restart Pangolin's docker compose. Now, the crowdsec container always start unhealthy, with the following logs:

/var/lib/crowdsec/data was found in a volume
Local agent already registered
Check if lapi needs to register an additional agent
sqlite database permissions updated
/etc/crowdsec was found in a volume
Running hub update
Skipping hub update, index file is recent
/var/lib/crowdsec/data was found in a volume
Running hub upgrade
Action plan:
🔄 check & update data files

downloading https://hub-data.crowdsec.net/mmdb_update/GeoLite2-City.mmdb
level=warning msg="Failed to check last modified: bad HTTP code 403 for https://hub-data.crowdsec.net/mmdb_update/GeoLite2-City.mmdb" url="https://hub-data.crowdsec.net/mmdb_update/GeoLite2-City.mmdb"
Error: cscli hub upgrade: while downloading data for /etc/crowdsec/parsers/s02-enrich/geoip-enrich.yaml: while getting data: bad HTTP code 403 for https://hub-data.crowdsec.net/mmdb_update/GeoLite2-City.mmdb
Running: cscli  parsers install "crowdsecurity/docker-logs" 
Nothing to install or remove.
Running: cscli  parsers install "crowdsecurity/cri-logs" 
Nothing to install or remove.
Running: cscli  collections install "crowdsecurity/traefik" 
Nothing to install or remove.
Running: cscli  collections install "crowdsecurity/appsec-virtual-patching" 
Nothing to install or remove.
Running: cscli  collections install "crowdsecurity/appsec-generic-rules" 
Nothing to install or remove.
Running: cscli  parsers install "crowdsecurity/whitelists" 
Nothing to install or remove.
time="2025-12-18T16:40:17Z" level=info msg="Enabled feature flags: none"
time="2025-12-18T16:40:17Z" level=info msg="Crowdsec v1.7.4-db3efdbf"
time="2025-12-18T16:40:17Z" level=info msg="Loading CAPI manager"
time="2025-12-18T16:40:17Z" level=info msg="flushed 1/430 alerts because they were created 168h0m0s ago or more" module=db
time="2025-12-18T16:40:17Z" level=info msg="attempt 1 out of 2"
time="2025-12-18T16:40:17Z" level=info msg="attempt 2 out of 2"
time="2025-12-18T16:40:18Z" level=info msg="max attempts reached for status code 403"
time="2025-12-18T16:40:18Z" level=fatal msg="api server init: unable to run local API: authenticate watcher (<REDACTED>): API error: Forbidden"

I don't know if I might have hit a limit rate of some sort, but it's already been a while and it stills cannot download.

What did you expect to happen?

That the container starts healthy.

How can we reproduce it (as minimally and precisely as possible)?

Starting a Pangolin setup with crowdsec enabled, with docker compose, and with the last docker and docker compose ubuntu packages (if it is the real issue)

Anything else we need to know?

If I remember correctly, I updated the docker packages of my VPS yesterday as my regular system update, which might have changed something, even though I could access everything perfectly without an issue all evening.

Crowdsec version

$ cscli version
# paste output here

OS version

PRETTY_NAME="Ubuntu 25.04"
NAME="Ubuntu"
VERSION_ID="25.04"
VERSION="25.04 (Plucky Puffin)"
VERSION_CODENAME=plucky
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=plucky
LOGO=ubuntu-logo

Enabled collections and parsers

can't access the crowdsec cli, but the docker compose variables are these: COLLECTIONS: crowdsecurity/traefik crowdsecurity/appsec-virtual-patching crowdsecurity/appsec-generic-rules PARSERS: crowdsecurity/whitelists

Acquisition config

```console # On Linux: $ cat /etc/crowdsec/acquis.yaml /etc/crowdsec/acquis.d/* # paste output here

On Windows:

C:> Get-Content C:\ProgramData\CrowdSec\config\acquis.yaml

paste output here

Config show

$ cscli config show
# paste output here

Prometheus metrics

$ cscli metrics
# paste output here

Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.

KyoTensu avatar Dec 18 '25 17:12 KyoTensu

@KyoTensu: Thanks for opening an issue, it is currently awaiting triage.

In the meantime, you can:

  1. Check Crowdsec Documentation to see if your issue can be self resolved.
  2. You can also join our Discord.
  3. Check Releases to make sure your agent is on the latest version.
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

github-actions avatar Dec 18 '25 17:12 github-actions

Hello,

We are currently in the process of adding stricter rate limits on some CAPI endpoints (mostly the login endpoint) due to some users having broken installations restarting in a loop and hammering our APIs (upwards of 10k requests per hour per user in the worst cases).

When too many requests are detected, the IP is blocked globally on all endpoints. The exact rate limit depends on whether the instance is enrolled in the console, sharing signals or not, ..., but at the very least, it allows for 25 logins per hour (in a normal situation, crowdsec should only attempt to login once every 8 hours, or each time you restart it).

If you'd like, you can send me your public IP address to support [at] crowdsec [dot] net (mentioning this issue), and we'll exclude it while we work to adjust the rate limits more precisely.

blotus avatar Dec 18 '25 17:12 blotus

I have the same issue, can I send you my IPs too?

AleksCee avatar Dec 18 '25 17:12 AleksCee

I'll send it then, thank you. I'm a bit surprised because it is a container that isn't restarted a lot, only when my Pangolin stack has an update somewhere, so maybe 1 or 2 times a week. Unless it downloads regularly while running too?

KyoTensu avatar Dec 18 '25 17:12 KyoTensu

I'll send it then, thank you. I'm a bit surprised because it is a container that isn't restarted a lot, only when my Pangolin stack has an update somewhere, so maybe 1 or 2 times a week. Unless it downloads regularly while running too?

Nothing downloads automatically whilst in a container, are you using any external tools? Other than pangolin?

LaurenceJJones avatar Dec 18 '25 17:12 LaurenceJJones

The compose stack has pangolin, traefik, periphery and crowdsec. It is the only stack on the server.

KyoTensu avatar Dec 18 '25 17:12 KyoTensu

Are you sure the crowdsec container is working properly ?

According to our logs, we see you attempting a login every 10s for at least the past 19 days (at the very least), which indicates something is broken.

Could you share the logs from the crowdsec container ? (You can join our discord here: https://discord.gg/wGN7ShmEE8, it might be easier to diagnose the issue)

blotus avatar Dec 18 '25 17:12 blotus

I am also in this boat. Also use Pangolin. I have sent in a support email. Seems this is related to Pangolin.

sugarfunk avatar Dec 18 '25 17:12 sugarfunk

@blotus who did you mean @KyoTensu or me?

AleksCee avatar Dec 18 '25 17:12 AleksCee

edit: hhf crowdsec manager had nothing to do with this, the underlying issue was the default health check provided by pangolin installer.

ignore emojis on comment that was debugging the users current setups.

Please stop spamming HHF dm's, I spoken to HHF directly to apologise

LaurenceJJones avatar Dec 18 '25 17:12 LaurenceJJones

@blotus If it happens to other pangolin users like @sugarfunk, it might be related to this. But what's interesting is that the container was running and was seemingly doing its job. I'll check the discord.

The logs I attached to my issue is what's outputted from docker logs and is just repeated multiple times.

KyoTensu avatar Dec 18 '25 17:12 KyoTensu

@blotus If it happens to other pangolin users like @sugarfunk, it might be related to this. But what's interesting is that the container was running and was seemingly doing its job. I'll check the discord.

The logs I attached to my issue is what's outputted from docker logs and is just repeated multiple times.

Pangolin just deploys a standard container, please see my comment about crowdsec manager and 👍 if you are using it we need to find a pattern here

LaurenceJJones avatar Dec 18 '25 17:12 LaurenceJJones

Perhaps the many api calls are from the healthcheck? I mean the pangolin installer put this in the docker-compose.yml

healthcheck:
      test:
        - CMD
        - cscli
        - capi
        - status

AleksCee avatar Dec 18 '25 18:12 AleksCee

Perhaps the many api calls are from the healthcheck? I mean the pangolin installer put this in the docker-compose.yml

healthcheck:
      test:
        - CMD
        - cscli
        - capi
        - status

Bingo

LaurenceJJones avatar Dec 18 '25 18:12 LaurenceJJones

@AleksCee good catch, that's almost certainly the issue.

cscli capi status will trigger a login to CAPI each time it is ran (because we want to check if everything is ok).

blotus avatar Dec 18 '25 18:12 blotus

Is it just capi? Or does the other commands also makes a call?

KyoTensu avatar Dec 18 '25 18:12 KyoTensu

Is it just capi? Or does the other commands also makes a call?

Just CAPI the command should be LAPI with a delay, as the healthcheck is just checking communication to us

Whilst it should be checking the container health

LaurenceJJones avatar Dec 18 '25 18:12 LaurenceJJones

Might be interesting to make an issue on Pangolin's GitHub (or contact them directly). Should I?

KyoTensu avatar Dec 18 '25 18:12 KyoTensu

See solution via the healthcheck section https://github.com/crowdsecurity/crowdsec/issues/3603

LaurenceJJones avatar Dec 18 '25 18:12 LaurenceJJones

Might be interesting to make an issue on Pangolin's GitHub (or contact them directly). Should I?

Create it and link this thread but problem is people need to manually patch

LaurenceJJones avatar Dec 18 '25 18:12 LaurenceJJones