- #!/bin/bash
- ((EUID == 0 )) || { echo "Need root"; exit 1; }
- set -euo pipefail
- CONFD=/etc/e-router
- source $CONFD/config
- tmp=$(mktemp)
- curl -f -s -m 60 -o $tmp "https://www.badips.com/get/list/${banservice}/${banlevel}?age=${rangecheck}"
- while read -r ip ; do
- ipset -! add ${banset} ${ip} timeout $bantime
- done < $tmp
- trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM
|