Skip to content

cscli hub upgrade attempts to update a local parser/enricher #3453

@Athanasius

Description

@Athanasius

What happened?

  1. System picked up the upgrade to 1.6.5
  2. The Debian postinst script ran cscli hub upgrade
  3. This attempted to check a local enricher, which fails because there's no URL for it.

In addition, because cscli hub upgrade is run from the Debian postinst script it makes dpkg/APT think the installation failed.

What did you expect to happen?

cscli hub upgrade should continue to ignore local parsers of any kind.

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

  1. Have any local, not installed from hub, enricher. Mine is <config dir>/parsers/s02-enrich/whitelists_fysh.yaml
  2. Run cscli hub upgrade

Anything else we need to know?

This was all working fine with v1.6.4. I just downgraded to that version and running cscli hub upgrade completes without errors.

Crowdsec version

Details
$ cscli version
# paste output here
version: v1.6.5-debian-pragmatic-amd64-d8dcdc91
Codename: alphaga
BuildDate: 2025-02-07_14:53:23
GoVersion: 1.23.6
Platform: linux
libre2: C++
User-Agent: crowdsec/v1.6.5-debian-pragmatic-amd64-d8dcdc91-linux
Constraint_parser: >= 1.0, <= 3.0
Constraint_scenario: >= 1.0, <= 3.0
Constraint_api: v1
Constraint_acquis: >= 1.0, < 2.0
Built-in optional components: cscli_setup, datasource_appsec, datasource_cloudwatch, datasource_docker, datasource_file, datasource_http, datasource_journalctl, datasource_k8s-audit, datasource_kafka, datasource_kinesis, datasource_loki, datasource_s3, datasource_syslog, datasource_victorialogs, datasource_wineventlog

OS version

Details
# On Linux:
$ cat /etc/os-release
# paste output here
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ uname -a
# paste output here
Linux river.fysh.org 6.1.125-fysh-kvmguest #1 SMP PREEMPT_DYNAMIC Fri Jan 17 15:07:39 UTC 2025 x86_64 GNU/Linux


# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Enabled collections and parsers

Details
$ cscli hub list -o raw
# paste output here
Loaded: 134 parsers, 10 postoverflows, 751 scenarios, 8 contexts, 4 appsec-configs, 93 appsec-rules, 131 collections
Unmanaged items: 1 local, 0 tainted
name,status,version,description,type
crowdsecurity/dateparse-enrich,enabled,0.2,,parsers
crowdsecurity/geoip-enrich,enabled,0.5,"Populate event with geoloc info : as, country, coords, source range.",parsers
crowdsecurity/mysql-logs,enabled,0.4,Parse MySQL logs,parsers
crowdsecurity/sshd-logs,enabled,2.9,Parse openSSH logs,parsers
crowdsecurity/syslog-logs,enabled,0.8,,parsers
crowdsecurity/whitelists,enabled,0.2,Whitelist events from private ipv4 addresses,parsers
fysh/whitelists,"enabled,local",,,parsers
crowdsecurity/mysql-bf,enabled,0.2,Detect mysql bruteforce,scenarios
crowdsecurity/ssh-bf,enabled,0.3,Detect ssh bruteforce,scenarios
crowdsecurity/ssh-cve-2024-6387,enabled,0.2,Detect exploitation attempt of CVE-2024-6387,scenarios
crowdsecurity/ssh-slow-bf,enabled,0.4,Detect slow ssh bruteforce,scenarios
crowdsecurity/bf_base,enabled,0.1,,contexts
crowdsecurity/linux,enabled,0.2,core linux support : syslog+geoip+ssh,collections
crowdsecurity/mysql,enabled,0.1,mysql support : logs and brute-force scenarios,collections
crowdsecurity/sshd,enabled,0.5,sshd support : parser and brute-force detection,collections

Acquisition config

(NB: I removed the opening <detail> as github wasn't rendering the pasted text properly)

On Linux:

$ cat /etc/crowdsec/acquis.yaml /etc/crowdsec/acquis.d/*

paste output here

#Generated acquisition file - wizard.sh (service: sshd) / files : /var/log/auth.log
filenames:
  - /var/log/auth.log
labels:
  type: syslog
---
#Generated acquisition file - wizard.sh (service: mysql) / files : /var/log/mysql/error.log
filenames:
  - /var/log/mysql/error.log
labels:
  type: mysql
---
#Generated acquisition file - wizard.sh (service: linux) / files : /var/log/syslog /var/log/kern.log /var/log/messages
filenames:
  - /var/log/syslog
  - /var/log/kern.log
  - /var/log/messages
labels:
  type: syslog
---
cat: '/etc/crowdsec/acquis.d/*': No such file or directory

On Windows:

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

paste output here

Config show

Details
$ cscli config show
# paste output here
Global:
   - Configuration Folder   : /etc/crowdsec
   - Data Folder            : /var/lib/crowdsec/data
   - Hub Folder             : /etc/crowdsec/hub
   - Simulation File        : /etc/crowdsec/simulation.yaml
   - Log Folder             : /var/log
   - Log level              : info
   - Log Media              : file
Crowdsec:
  - Acquisition File        : /etc/crowdsec/acquis.yaml
  - Parsers routines        : 1
  - Acquisition Folder      : /etc/crowdsec/acquis.d
cscli:
  - Output                  : human
  - Hub Branch              : 
API Client:
  - URL                     : http://192.168.41.2:8080/
  - Login                   : <redacted>
  - Credentials File        : /etc/crowdsec/local_api_credentials.yaml
Local API Server:
  - Listen URL              : 192.168.41.2:8080
  - Listen Socket           : 
  - Profile File            : /etc/crowdsec/profiles.yaml

  - Trusted IPs:
      - 127.0.0.1
      - ::1
  - Database:
      - Type                : sqlite
      - Path                : /var/lib/crowdsec/data/crowdsec.db
      - Flush age           : 7d
      - Flush size          : 5000

Prometheus metrics

Details
$ cscli metrics
# paste output here
WARNING while fetching metrics: executing GET request for URL "http://192.168.41.2:6060/metrics" failed: Get "http://192.168.41.2:6060/metrics": dial tcp 192.168.41.2:6060: connect: connection refused 
╭───────────────────────────────────────────────────────────────────────╮
│ Bouncer Metrics (cs-firewall-bouncer-1696258531) since 2025-01-31 19: │
│ 33:25 +0000 UTC                                                       │
├────────┬──────────────────┬───────────────────┬───────────────────────┤
│ Origin │ active_decisions │      dropped      │       processed       │
│        │        IPs       │  bytes  │ packets │   bytes   │  packets  │
├────────┼──────────────────┼─────────┼─────────┼───────────┼───────────┤
│ ipset  │           23.66k │  55.50M │ 967.70k │         - │         - │
├────────┼──────────────────┼─────────┼─────────┼───────────┼───────────┤
│  Total │           23.66k │  55.50M │ 967.70k │     8.85G │    17.15M │
╰────────┴──────────────────┴─────────┴─────────┴───────────┴───────────╯

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

Details The custom enricher is:
name: fysh/whitelists
description: "Whitelist fysh-specific IPs"
data:
  - dest_file: "fysh-whitelist-ips.txt"
    type: string

whitelist:
  reason: "Known good local IPs"
  ip: 
    - "<redacted>" # Athan's Aquiss static IPv4 address
  cidr:
    - "192.168.41.0/2" # Internal VM NAT
  expression:
  #   - "'foo.com' in evt.Meta.source_ip.reverse" 
    - evt.Meta.source_ip in File('fysh-whitelist-ips.txt')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions