#!/bin/bash MIKROTIK="10.10.10.1" USER="fail2ban" LIST="firehol_l1" TIMEOUT="7d" TMP="/tmp/firehol_l1.txt" LOG="/var/log/firehol-sync.log" echo "[$(date)] FireHOL sync started" >> $LOG curl -s https://raw.githubusercontent.com/firehol/blocklist-ipsets/master/firehol_level1.netset \ | grep -E '^[0-9]' \ | grep -v ':' \ | grep -Ev '^(0\.|10\.|127\.|169\.254\.|172\.(1[6-9]|2[0-9]|3[0-1])\.|192\.168\.|224\.|240\.)' \ > $TMP while read ip; do ssh -o ConnectTimeout=3 $USER@$MIKROTIK \ "/ip firewall address-list add list=$LIST address=$ip timeout=$TIMEOUT comment=FireHOL" \ 2>/dev/null done < $TMP echo "[$(date)] FireHOL sync finished" >> $LOG