CrowdSec
Overview
CrowdSec is an open-source (MIT) collaborative intrusion detection and prevention system. Its Security Engine parses your local logs (the systemd journal and SSH/auth activity), runs behavioural scenarios to spot aggressive behaviour such as SSH brute-force, and ships decisions to bouncers that enforce bans.
This SecureAnyCloud image installs CrowdSec from the official CrowdSec package repository and enables the crowdsec.service agent with its Local API (LAPI). It parses the journal and detects SSH attacks out of the box, and an iptables firewall bouncer actively bans aggressive IPs.
What you get:
- CrowdSec Security Engine (
crowdsec.service) and thecsclimanagement CLI - The Local API (LAPI) bound to
127.0.0.1:8080with a/healthliveness endpoint - The
crowdsecurity/linuxandcrowdsecurity/sshdcollections, which provide journal parsing and SSH brute-force scenarios - The
crowdsec-firewall-bouncer-iptablesbouncer that enforces bans - A per-VM Local API machine credential rotated on first boot, so there is no shared default identity
- 24/7 SecureAnyCloud support
This is a security daemon, not a web application. The Local API listens on 127.0.0.1:8080 only and is not opened to the internet. The engine works entirely from this VM's local logs, and you run cscli on the VM.
Prerequisites
You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.
Standard_B2s (2 vCPU / 4 GiB RAM) is a good starting point.
In the network security group (NSG), allow inbound 22/tcp from your management network. No inbound application ports are needed, because the Local API is loopback-only.
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for CrowdSec by SecureAnyCloud, and select Create.
On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) only. Then select Review + create and Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:crowdsec-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name crowdsec \
--image sac1647283583153:crowdsec-ubuntu-24-04:default:latest \
--size Standard_B2s \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku StandardStep 3 - Connect to your VM
ssh azureuser@<vm-public-ip>Step 4 - Confirm CrowdSec is installed and running
crowdsec -version | head -1 systemctl is-active crowdsecThe output shows a CrowdSec version line and active.
Step 5 - Check the Security Engine and Local API
Run cscli lapi status to confirm that the agent can authenticate to the Local API. The LAPI also exposes a plain HTTP /health endpoint on loopback.
sudo cscli lapi status curl -s http://127.0.0.1:8080/healthcscli lapi status reports that you can successfully interact with the Local API. /health returns a small JSON status document.
Step 6 - Review the loaded collections and scenarios
List the loaded collections. The image ships with the crowdsecurity/linux and crowdsecurity/sshd collections, which bring in the SSH brute-force and log-parsing scenarios.
sudo cscli collections list
sudo cscli scenarios listThe output shows crowdsecurity/linux and crowdsecurity/sshd enabled, along with the crowdsecurity/ssh-bf family of scenarios.
Step 7 - Confirm the engine is parsing and watch for detections
cscli metrics shows the acquisition, parser and Local API activity, which proves that the engine is reading your logs. cscli decisions list and cscli alerts list show any bans and alerts the engine has raised. A freshly deployed VM starts with a clean history.
sudo cscli metrics
sudo cscli decisions list
sudo cscli alerts listReal traffic, such as repeated failed SSH logins from an attacker, triggers the SSH scenarios. The engine raises an alert and the firewall bouncer adds a ban decision, which appears in cscli decisions list.
Step 8 - Confirm the firewall bouncer is registered
The iptables firewall bouncer enforces the engine's ban decisions at the network layer. List the registered bouncers:
sudo cscli bouncers listThe firewall bouncer appears as registered and validated.
Security model
The Local API binds 127.0.0.1:8080 only and is never exposed publicly. Keep your NSG limited to 22/tcp from trusted networks.
CrowdSec manages its machine and bouncer credentials automatically. The SecureAnyCloud image rotates the per-VM Local API machine credential on first boot, so every VM has its own identity.
To extend protection, install additional collections from the CrowdSec Hub with sudo cscli collections install <name>, and add bouncers for your web server, firewall or cloud edge.
Whitelist your admin network to avoid lockouts
The firewall bouncer enforces SSH brute-force bans, so repeated connections from a single source can trigger a ban. The image ships with loopback and the RFC1918 private ranges already whitelisted, and with an editable whitelist at /etc/crowdsec/parsers/s02-enrich/sac-admin-whitelist.yaml.
Add your admin public IP or CIDR under ip: / cidr: in that file, then reload the engine with sudo systemctl reload crowdsec.
If you lock yourself out, use the Azure Portal serial console (or run-command) to clear active bans with sudo cscli decisions delete --all.
Support
SecureAnyCloud maintains this image and provides 24/7 support for it. CrowdSec is a trademark of CrowdSec SAS. This image is not affiliated with or endorsed by CrowdSec SAS. See the SecureAnyCloud guides for more.
Deploy on Azure
Launch CrowdSec on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
CrowdSec is a free and open source collaborative behavioural security engine. It parses logs, detects aggressive and malicious behaviour using a curated library of detection scenarios, and blocks the offending source IPs.
This SecureAnyCloud image is a ready-to-use host intrusion detection and prevention appliance. The moment an engineer connects over SSH, the host is already protected. It is a headless service with no web interface, and you operate it with the cscli command-line tool.
What you get:
- The
crowdsecagent and thecrowdsec-firewall-bouncer, both enabled and started on boot - The Linux and SSH detection collections, installed
- A firewall bouncer that already enforces the engine's decisions in iptables
- An agent that tails the system journal and the SSH authentication log, runs the events through the installed parsers and scenarios, and records its verdicts as decisions in an embedded Local API (LAPI)
- A Local API bound to loopback only (
127.0.0.1:8080) and backed by a local database, so it answers on the instance without ever being exposed to the network. The instance security group opens port 22 only - Per-instance secrets: the agent's Local API machine credentials and the firewall bouncer's API key are rotated the first time the instance boots, so no shared secret ships in the image
- A dedicated, independently resizable EBS data volume mounted at
/var/lib/crowdsec, which keeps the Local API database and engine state on durable storage rather than the operating system disk
Prerequisites
Before you deploy this image, you need:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group that allows inbound port 22 from your management network
- The AWS CLI (version 2) installed locally, if you plan to deploy from the command line
Launch the Instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for CrowdSec. Select the SecureAnyCloud listing and choose Select, then Continue on the subscription summary.
Pick an instance type of t3.small or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet, then create or select a security group that opens port 22 from your management network. Leave the root volume at the default size or larger.
Select Launch instance. First-boot initialisation runs a few seconds after the instance state becomes Running and the status checks pass. It rotates the per-instance Local API and bouncer credentials, then starts the engine and the firewall bouncer.
Launch the Instance from the AWS CLI
The command below launches an instance from the SecureAnyCloud CrowdSec Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing. Replace <key-name> with your EC2 key pair name and <subnet-id> with your subnet ID. Replace <security-group-id> with a security group that opens port 22 from your management network.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type t3.small \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=crowdsec}]'When the instance reaches the Running state and its status checks pass, note its public IP address or DNS name. You can find it in the EC2 console or with aws ec2 describe-instances.
Connect to Your Instance
Connect over SSH with your key pair and the login user for your operating system variant.
OS variant SSH login user
Ubuntu 24.04 ubuntu
ssh -i <key-name>.pem ubuntu@<public-ip>A welcome banner prints the most useful commands. Run sudo cat /root/crowdsec-info.txt to see the full getting-started notes: what is running, where the per-instance credentials live, and the cscli commands to operate the engine.
Verify the Engine and the Bouncer
CrowdSec runs as two system services, both enabled and started on boot. The crowdsec detection agent also serves the Local API, and the crowdsec-firewall-bouncer is the remediation component. Confirm that both are active:
systemctl is-active crowdsec crowdsec-firewall-bouncerThe output shows active twice. For the full unit status of either service, including the main PID and memory use, run systemctl status crowdsec --no-pager or systemctl status crowdsec-firewall-bouncer --no-pager.
Next, confirm the installed version, which is pinned to CrowdSec 1.7.8 on this image, and check that the agent can authenticate to the Local API:
sudo cscli version
sudo cscli lapi statuscscli version reports v1.7.8. cscli lapi status reports that you can successfully interact with the Local API, which proves that the agent and the embedded API are wired up correctly.
The Local API
The agent serves an embedded Local API. On this image it is bound to loopback only (127.0.0.1:8080), so it answers on the instance but is never exposed to the network. Check the health endpoint, which returns HTTP 200 while the engine is healthy:
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/healthThe output is 200. The Local API holds the registered machines and bouncers, the raised alerts and the active decisions, all backed by a local database on the dedicated data volume.
You drive the API entirely through cscli, so there is no web interface to secure and the API stays private by default. To distribute decisions to bouncers on other hosts, register them against this Local API and expose port 8080 on your own terms.
Operate the Engine with cscli
cscli is the command-line interface to the engine. Inspect the acquisition and processing metrics to confirm that the pipeline is reading and parsing logs:
sudo cscli metrics show acquisitionThe output lists the log sources the engine is reading (the SSH journal and the auth log), with lines-read and lines-parsed counters. Then list the detection collections installed on this image:
sudo cscli collections listThe crowdsecurity/linux and crowdsecurity/sshd collections ship installed, so brute-force and credential-stuffing behaviour against the host is detected out of the box. Each collection bundles the parsers and scenarios for one class of workload.
Decisions and the Firewall Bouncer
When a scenario fires, the engine records a decision, typically a ban, in the Local API. The firewall bouncer enforces it in iptables and ipset. List the active decisions and the registered bouncers:
sudo cscli decisions list
sudo cscli bouncers listThe bouncers list shows the crowdsec-firewall-bouncer registered with its per-instance API key. A recent Last API pull timestamp proves that it is polling the engine.
You can add and remove bans by hand at any time. These commands add a four-hour ban on an example address and then remove it:
sudo cscli decisions add --ip 192.0.2.10 --duration 4h --reason "manual block"
sudo cscli decisions delete --ip 192.0.2.10The firewall bouncer picks up the new decision on its next pull and drops traffic from the banned address at the host firewall. It removes the rule when the decision is deleted or expires.
Add Detection for Your Workloads
CrowdSec ships a hub of detection collections for web servers, proxies, mail servers, databases and dozens of other applications. Browse the available collections and install the ones that match your workloads. This example installs the nginx collection, then reloads the engine to load it:
sudo cscli collections install crowdsecurity/nginx
sudo systemctl reload crowdsecTo feed the new scenarios, point the engine's log acquisition at your own sources. The acquisition configuration is at /etc/crowdsec/acquis.yaml, and on this image it tails the SSH journal and the auth log. Add stanzas for your web server access logs, proxy logs or application logs, then reload the engine with sudo systemctl reload crowdsec.
The whitelists in the installed collections keep known-good actors from being banned. Add your own management addresses to a whitelist so you are never locked out.
The Data Volume
The Local API database and engine state live on a dedicated EBS volume mounted at /var/lib/crowdsec. This keeps the security-engine database off the operating system disk and lets you resize or snapshot it independently. Confirm the mount with:
df -h /var/lib/crowdsecThe database under /var/lib/crowdsec/data holds the machines, bouncers, alerts and decisions. The hub content the engine uses to parse and detect also lives under this tree.
To grow the volume, expand the EBS volume in the AWS console. Then grow the filesystem on the instance by running sudo resize2fs on the underlying device.
Support
SecureAnyCloud publishes and supports this image. Support covers log acquisition configuration, collection and scenario selection, parser and whitelist tuning, firewall bouncer deployment, registering bouncers on other hosts, central console enrolment, allowlisting and upgrade planning. Contact SecureAnyCloud through the support channel listed on the AWS Marketplace listing.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on AWS
Launch CrowdSec on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com