Skip to content

Commit

Permalink
whitelist: use a more readable format for whitelisted local IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Droz committed Feb 12, 2019
1 parent cdd8f32 commit 969fabc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion update-blacklist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,20 @@ filterout_whitelisted() {
fi
}

rfc1918_ip=$(cat <<EOF
0.0.0.0
10.
127.
172.(1[6-9]|2[0-9]|3[0-1]).
192.168.
# multicast
22[4-9].
23[0-9].
EOF
);

# sort -nu does not work as expected
sed -r -e '/^(0\.0\.0\.0|10\.|127\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.|192\.168\.|22[4-9]\.|23[0-9]\.)/d' "$IP_BLACKLIST_TMP" \
grep -Ev -f <(ip_list_to_regexp <<< "$rfc1918_ip") "$IP_BLACKLIST_TMP" \
| filterout_whitelisted \
| sort -n \
| sort -mu \
Expand Down

0 comments on commit 969fabc

Please sign in to comment.