
Mitigazione DDOS L7
Come promesso, pubblico il post del talk che non è stato scelto all’HackInBo.
In questo post vedremo come mitigare gli attacchi DDOS Layer 7 con Crowdsec e Cloudflare.
Continua a leggere
VPS
Era il lontano 2016 e mi presentavo come ospite e relatore ad un Linux day. Il mio talk era incentrato su come muovere i primi passi e mettere in sicurezza un VPS in quanto stava diventando molto semplice acquistare un istanza a buon mercato (con 2 o 3 € al mese).
Continua a leggere
Crowdsec TLS
Puntiamo ad una maggiore sicurezza utilizzando il TLS per le comunicazioni tra LAPI e gli agenti e buttafuori.
Continua a leggere
Crowdsec e Cloudflare
Installare e configurare il buttafuori di Cloudflare. Utilizzeremo le regole firewall per inserire una challenge e verificare l’autenticità delle richieste.
Continua a leggere
Crowdsec Docker Compose
Proteggiamo i nostri stack docker con CrowdSec e il bouncer sulla macchina host.
File docker-compose.yml di riferimento
version: '3'
services:
#the application itself : static html served by apache2.
#the html can be found in ./app/
app:
image: httpd:alpine
restart: unless-stopped
volumes:
- ./app/:/usr/local/apache2/htdocs/
networks:
- crowdsec_test
#the reverse proxy that will serve the application
#you can see nginx's config in ./reverse-proxy/nginx.conf
reverse-proxy:
image: nginx:alpine
restart: unless-stopped
ports:
- 8000:80
depends_on:
- 'app'
volumes:
- ./reverse-proxy/nginx.conf:/etc/nginx/nginx.conf
- logs:/var/log/nginx
networks:
- crowdsec_test
#crowdsec : it will be fed nginx's logs
#and later we're going to plug a firewall bouncer to it
crowdsec:
image: crowdsecurity/crowdsec:latest
restart: unless-stopped
environment:
#this is the list of collections we want to install
#https://hub.crowdsec.net/author/crowdsecurity/collections/nginx
COLLECTIONS: "crowdsecurity/nginx"
GID: "${GID-1000}"
depends_on:
- 'reverse-proxy'
ports:
- 127.0.0.1:8080:8080
volumes:
- ./crowdsec/acquis.yaml:/etc/crowdsec/acquis.yaml
- logs:/var/log/nginx
- crowdsec-db:/var/lib/crowdsec/data/
- crowdsec-config:/etc/crowdsec/
networks:
- crowdsec_test
#metabase, because security is cool, but dashboards are cooler
dashboard:
#we're using a custom Dockerfile so that metabase pops with pre-configured dashboards
build: ./crowdsec/dashboard
restart: unless-stopped
ports:
- 3000:3000
environment:
MB_DB_FILE: /data/metabase.db
MGID: "${GID-1000}"
depends_on:
- 'crowdsec'
volumes:
- crowdsec-db:/metabase-data/
networks:
- crowdsec_test
volumes:
logs:
crowdsec-db:
crowdsec-config:
networks:
crowdsec_test:

Crowdsec e Pwnkit
Brutta vulnerabilità Per voi che siete già passati a Crowdsec esiste uno scenario ad hoc. Lo scenario non permette di bloccare chi sfrutta questa vulnerabilità ma possiamo ricevere un avviso immediato.
Approfondisci
Crowdsec Centralizzato
Il runtime di CrowdSec ruota attorno ad alcuni semplici concetti:
- vengono letti i log (file system, journald, docker, ecc);
- i log vengono analizzati tramite parser;
- i log normalizzati vengono confrontati con gli scenari;
- quando uno scenario viene “attivato”, CrowdSec genera un avviso ed eventualmente una o più decisioni:
- l’avviso viene tracciato e rimarrà anche dopo la scadenza della decisione;
- la decisione d’altra parte, è di breve durata e indica quale azione dovrebbe essere intrapresa contro l’ip offensivo.

Crowdsec e log4j
Installiamo lo scenario per capire se qualcuno sta tentando di sfruttare la vulnerabilità.
# cscli hub update
# cscli scenarios install crowdsecurity/apache_log4j2_cve-2021-44228
# systemctl reload crowdsec
Lanciamo una scansione manuale e verifichiamo i risultati
# crowdsec --dsn "file:///var/log/nginx/access.log" -no-api --type nginx
# cscli alerts list --scenario crowdsecurity/apache_log4j2_cve-2021-44228