Administrators, autoreview, Vérificateurs d’utilisateurs, checkuser-log, editor, reviewer, usersnoop
3 321
modifications
Ligne 291 : | Ligne 291 : | ||
# nano /usr/local/bin/listeblanche_CrowdSec.sh | # nano /usr/local/bin/listeblanche_CrowdSec.sh | ||
<pre>#!/bin/bash | <pre>#!/bin/bash | ||
precedente=$(cat /usr/local/bin/votre.domaine.org) | precedente=$(cat /usr/local/bin/votre.domaine.org) | ||
actuelle=$(dig +short votre.domaine.org) | actuelle=$(dig +short votre.domaine.org) | ||
if ! [[ $actuelle =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | if ! [[ $actuelle =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
# echo "Echec. Ne semble pas être une IP valide. Sortie."; | |||
exit 1 | |||
elif [[ $actuelle = $precedente ]]; then | elif [[ $actuelle = $precedente ]]; then | ||
# echo $actuelle "égale" $precedente "=> Sortie!" | |||
: | : | ||
else | else | ||
echo "name: crowdsecurity/whitelists" > /usr/local/bin/gateway.yaml | # echo $actuelle "différente" $precedente "=> On génère un nouveau fichier!" | ||
echo "name: crowdsecurity/whitelists" > /usr/local/bin/gateway.yaml | |||
echo "description: \"Mise en liste blanche de votre.domaine.org\"" >> /usr/local/bin/gateway.yaml | |||
echo "whitelist:" >> /usr/local/bin/gateway.yaml | |||
echo " reason: \"C'est la maison!\"" >> /usr/local/bin/gateway.yaml | |||
echo " ip:" >> /usr/local/bin/gateway.yaml | |||
echo " - \""$actuelle"\"" >> /usr/local/bin/gateway.yaml | |||
echo $actuelle > /usr/local/bin/votre.domaine.org | |||
cp /usr/local/bin/gateway.yaml /etc/crowdsec/parsers/s02-enrich/gateway.yaml | |||
systemctl reload crowdsec | |||
fi</pre> | fi</pre> | ||
modifications