Un tutorial rápido sobre la instalación y el funcionamiento del sistema de filtrado de IP CrowdSec v.1.0.x





¡Hola a todos! Antes del Año Nuevo, lanzamos una gran actualización de nuestro producto, CrowdSec v.1.0.X, que contiene cambios significativos en comparación con la versión anterior. Lo más importante es que se puso en funcionamiento la API REST local y se realizaron los cambios arquitectónicos correspondientes. Como resultado, el proceso de creación de gorilas se ha simplificado enormemente y su estabilidad se ha incrementado, mientras que el tiempo de mantenimiento del sistema ha disminuido. 





En este artículo, encontrará material básico sobre cómo se rediseñó CrowdSec y, en general, puede considerarse como una Guía de usuario para quienes van a probar nuestro producto en sus sistemas. 





CrowdSec ( , cscli ) REST API, . , SQLite, PostgreSQL MySQL.





, CrowdSec Linux Server. :





  • CrowdSec





  •  













CrowdSec Debian 10 buster t2.medium EC2. nginx:





Debian 10 buster t2.medium EC2.





, nginx:





$ sudo apt-get update





$ sudo apt-get install nginx





, ssh (tcp / 22) http (tcp / 80) . . 





CrowdSec

CrowdSec ( GitHub):





$ curl -s https://api.github.com/repos/crowdsecurity/crowdsec/releases/latest | grep browserdownloadurl| cut -d '"' -f 4  | wget -i

$ tar xvzf crowdsec-release.tgz 

$ cd crowdsec-v1.0.0/

$ sudo ./wizard.sh -i
      
      



, ,





. nginx, sshd Linux-. 





- :





, CrowdSec . , . 





— , . , Crowdsecurity/sshd sshd ssh





, ( , CrowdSec ), .





, ( , ). 





— , IP-. , , CrowdSec. .





CrowdSec . 





CrowdSec

, CrowdSec , , «». 





- wapiti

- nginx wapiti IP-. 





ATTACKER$ wapiti   -u http://34.248.33.108/





[*] Saving scan state, please wait…





 Note





========





This scan has been saved in the file /home/admin/.wapiti/scans/34.248.33.108folderb753f4f6.db









«»:





, IP :





- Crowdsecurity / http-path-traversal-probing: URI GET





- Crowdsecurity / http-sqli-probbing-detection: SQL- URI GET





, , , nginx-, . , , -. 





, - nginx, , , -.





cscli

CrowdSec cscli. — :





cscli decisions list, , , cscli alerts list ( - ). 





- , cscli alerts inspect -d <ID> (ID  , . ).





scli , . , :





— . «tail the logfile» — metabase dashboard prometheus.





cscli metabase docker





docker





cscli dashboard setup metabase , . :











: Prometheus

, -, , Prometheus metabase. 





, cscli metrics:





, cscli metrics Prometheus. , , (!) Prometheus CrowdSec. , Prometheus :





- Buckets: , / ;





- Acquisition: / , / ;





- Parser: / ;





- Local API: . .





cscli, . Prometheus Grafana. :





:

, CrowdSec . , . : CrowdSec , . 





API CrowdSec, , IP .





cs-firewall-bouncer. IP iptables nftables. , sudo cscli solutions delete -i X.X.X.X ( X.X.X.X — IP-). 





- GitHub:





$ wget https://github.com/crowdsecurity/cs-firewall-bouncer/releases/download/v0.0.5/cs-firewall-bouncer.tgz





$ tar xvzf cs-firewall-bouncer.tgz





$ cd cs-firewall-bouncer-v0.0.5/





:





, REST API, , :





sudo cscli bouncers list , . 









, , IP . , . . 





, , - . 





:





ATTACKER$ curl --connect-timeout 1 http://34.248.33.108/
curl: (28) Connection timed out after 1001 milliseconds
      
      



, :





, cs-firewall-bouncer nftables, iptables. nftables ( debian 10 ) Crowdsec Crowdsec6 ( ipv4 ipv6 ).





$ sudo nft list ruleset
table ip crowdsec {
	set crowdsec_blocklist {
		type ipv4_addr
		elements = { 3.22.63.25, 3.214.184.223,
			     3.235.62.151, 3.236.112.98,
			     13.66.209.11, 17.58.98.156, …
                        }
	}

	chain crowdsec_chain {
		type filter hook input priority 0; policy accept;
		ip saddr @crowdsec_blocklist drop
	}
}
table ip6 crowdsec6 {
	set crowdsec6_blocklist {
		type ipv6_addr
	}

	chain crowdsec6_chain {
		type filter hook input priority 0; policy accept;
		ip6 saddr @crowdsec6_blocklist drop
	}
}
      
      



iptables mftables, , /etc/crowdsec/cs-firewall-bouncer/cs-firewall-bouncer.yaml/ , iptables ipset.





, , /etc/crowdsec/cs-firewall-bouncer/cs-firewall-bouncer.yaml, , nftables iptables ( iptables ipset).





, . , CrowdSec. :





  • CrowdSec v.1.0









  • GitHub





  • Gitter












All Articles