Skip to content
Pocket Homelab
Install

CrowdSec

Who CrowdSec has banned and why, from which country and network, recent alerts and Unban, on the Home dashboard and the CrowdSec screen.

iPhoneMac
On this page

CrowdSec watches your logs, spots attacks and bans the addresses behind them. Pocket Homelab reads its Local API (LAPI) to show who is banned right now and why, the recent alerts with the country and network they came from, and lets you lift a ban.

What you get

  • Home card “CrowdSec”: “3 bans”, with “3 decisions · 5 alerts today” underneath, then the top scenario (“Top: ssh-bf (2)”) and the top countries as flags. Green when nobody is banned, orange when someone is. The alerts part needs a machine login (see Set up).
  • A CrowdSec screen with the active decisions, the recent alerts and Unban.
  • A CrowdSec tab, off by default: turn it on in Settings → Tabs to pin it to the tab bar.
  • Spotlight entry “CrowdSec” (“Bans and alerts”; bans, decisions, unban, firewall, fail2ban, bouncer).
  • Mac: the CrowdSec workspace in the sidebar’s Infrastructure group (⌥⇧⌘1 by default) and a CrowdSec widget for Home.

Set up

CrowdSec offers two kinds of login, and the app can use either one or both. A bouncer key is enough to see who is banned. A machine login adds the alerts, the country and network of each address, and Unban.

  1. On the machine that runs CrowdSec’s LAPI, create a bouncer key: cscli bouncers add pocket-homelab. It prints the key once, so copy it right away. In Docker, run it as docker exec crowdsec cscli bouncers add pocket-homelab.
  2. Optional, for alerts and Unban: add a machine (watcher) with its own password: cscli machines add pocket-homelab --password 'a-long-password' -f -. The -f - prints the credentials instead of writing them over the local agent’s credentials file.
  3. In Pocket Homelab: Settings → Services → CrowdSec, enter the LAPI address (port 8080 by default), then the bouncer key, the machine ID and password, or all three. Tap Test connection.
  4. The CrowdSec card shows up on Home. Turn on the CrowdSec tab in Settings → Tabs if you want it in the tab bar.
The URL plus a bouncer key or a machine login (ID and password). With neither, CrowdSec stays hidden.
KeyFieldRequiredSecretWhere to get it
CROWDSEC_URLCrowdSec URLRequired—Address of your CrowdSec Local API (LAPI, port 8080 by default), for who is banned and why and recent alerts. Leave empty to hide it.
CROWDSEC_API_KEYCrowdSec bouncer API keyOptionalSecretA bouncer key from cscli bouncers add pocket-homelab: reads the active decisions. Optional when a machine login is set. Stored in the Keychain.
CROWDSEC_MACHINE_IDCrowdSec machine IDOptional—Optional: a machine (watcher) from cscli machines add pocket-homelab --password …. With its password the app also reads alerts (with country and network) and can unban an address.
CROWDSEC_PASSWORDCrowdSec machine passwordOptionalSecretThat machine's password. Stored in the Keychain.
The URL plus a bouncer key or a machine login (ID and password). With neither, CrowdSec stays hidden.

On iPhone

The CrowdSec screen refreshes every minute while it is open, and on pull to refresh or Refresh at the top. A search field, “Address, scenario, country…”, filters both lists. From the top:

  • Summary: the number of bans, alerts today (with a machine login) and the number of addresses, then Top scenarios and Top countries with their counts.
  • Active decisions: one row per decision with the address, the scenario and where it came from (for example ssh-bf · crowdsec), the country, network name and AS number when known, a ban tag, and the time left (“3 h 59 min”). A decision for a whole range, country or network shows its scope too, and decisions in simulation mode carry a grey simulated tag. With nobody banned it says “Nobody is banned right now.”
  • Recent alerts (machine login only): the scenario, the address, its country and network, how long ago and the number of events. A red shield marks an alert whose ban is still running.

Long-press a decision for Copy Address and Unban…, or swipe it left for Unban. Unban only appears with a machine login; without one, the footer says so: “Add a machine login (CROWDSEC_MACHINE_ID, CROWDSEC_PASSWORD) for countries, alerts and unbanning.”

Tap an alert to open it: CrowdSec’s message, then Source (address, range, country, network), Alert (scenario, events, when it started and stopped, the machine that raised it, and Simulation if it was one) and Decisions, each with the time left and an Unban button while it is still running.

On Mac

The CrowdSec workspace sits under Infrastructure in the sidebar, with the header “Who CrowdSec has banned and why, from which country and network, the recent alerts, and unbanning.” It holds the same summary, Active decisions and Recent alerts as the iPhone screen, with the same search and Refresh. Right-click a decision for Copy Address and Unban…; click an alert for its details.

The Home CrowdSec widget shows the number of active bans (green at zero, orange otherwise), then Decisions, Alerts today, Top scenario and Top country. Wide sizes, and the expanded widget, add the first three decisions with their address and scenario.

Actions

Unban is the one thing this integration writes back to CrowdSec, and it needs the machine login.

  • Every Unban asks first: “Unban 203.0.113.7?”, with “The ban from ssh-bf ends now; CrowdSec bans it again if it misbehaves again.” Tap Unban to confirm.
  • The decision disappears from the list right away, and the screen reads CrowdSec again to be sure.
  • If CrowdSec refuses, an alert shows its reason.

Works with

  • With both logins set, the bouncer key reads the decisions and the machine login fills in each one’s country and network from the alert that caused it.
  • With only a machine login, the decisions come from the alerts that still have a running ban.
  • The free plan counts CrowdSec as one service, whichever logins you use.

Tips & troubleshooting

  • A package install often has the LAPI listening on 127.0.0.1:8080 only. To reach it from your phone, set listen_uri under api.server in /etc/crowdsec/config.yaml to an address on your LAN or VPN and restart CrowdSec. The Docker image listens on all addresses.
  • The machine login is kept in memory for an hour at a time, then the app signs in again. Your password stays in the Keychain.
  • No country or network on a decision? Those come from the alerts, so they need the machine login.
  • Bans in simulation mode are listed but not counted in the number of bans.