Un tutoriel rapide sur l'installation et l'utilisation du système de filtrage IP CrowdSec v.1.0.x





Bonjour Ă  tous! Avant la nouvelle annĂ©e, nous avons publiĂ© une grande mise Ă  jour de notre produit - CrowdSec v.1.0.X, qui contient des changements importants par rapport Ă  la version prĂ©cĂ©dente. Plus important encore, l'API REST locale a Ă©tĂ© mise en service et les modifications architecturales correspondantes ont Ă©tĂ© apportĂ©es. En consĂ©quence, le processus de crĂ©ation de videurs a Ă©tĂ© considĂ©rablement simplifiĂ© et leur stabilitĂ© a Ă©tĂ© augmentĂ©e, tandis que le temps de maintenance du système a diminuĂ©. 





Dans cet article, vous trouverez des informations de base sur la façon dont CrowdSec a Ă©tĂ© repensĂ© et, en gĂ©nĂ©ral, peut ĂŞtre considĂ©rĂ© comme un guide de l'utilisateur pour ceux qui vont essayer notre produit sur leurs systèmes. 





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