firewall_pleroma_rejects.sh: Removed old TODO, added comments.
This commit is contained in:
parent
e1749a8b45
commit
a4dba85927
|
@ -4,21 +4,22 @@
|
|||
# BE CAREFUL: Some instances may run under a shared IP, you may block more than
|
||||
# you want. No warranties and so on.
|
||||
|
||||
# Version: 2019-07-13_1
|
||||
# Version: 2019-07-14_1
|
||||
|
||||
# Before you run this script for the first time, run:
|
||||
# nft add table inet fediverse
|
||||
|
||||
function get_domains()
|
||||
function get_domains() # Outputs domains, separated by newline.
|
||||
{
|
||||
local instance="${1}"
|
||||
local nodeinfo=$(curl -s "https://${instance}/nodeinfo/2.1.json")
|
||||
local domains_json=$(jq -c '.metadata.federation.mrf_simple.reject' <<<"${nodeinfo}")
|
||||
local domains_json=$(jq -c '.metadata.federation.mrf_simple.reject' \
|
||||
<<<"${nodeinfo}")
|
||||
|
||||
sed -e 's/\[//' -e 's/\]//' -e 's/"//g' -e 's/,/\n/g' <<<"${domains_json}"
|
||||
}
|
||||
|
||||
function get_ips()
|
||||
function get_ips() # Outputs IPs, separated by newline.
|
||||
{
|
||||
local domain="${1}"
|
||||
|
||||
|
@ -38,12 +39,11 @@ function get_ips()
|
|||
done
|
||||
}
|
||||
|
||||
function gen_rule()
|
||||
function gen_rule() # Generates rule for IP if it is not in ignorelist.
|
||||
{
|
||||
# TODO: Filter out Cloudflare-IPs.
|
||||
local ip="${1}"
|
||||
local domain="${2}"
|
||||
# Regular expressions to ignore.
|
||||
# Regular expressions of IPs to ignore.
|
||||
local -a ignorelist=("^2001:41d0:302:1100:" # masto.host
|
||||
"^217\.182\.80\.236$" # masto.host
|
||||
"^2a06:98c[0-7]:" # CloudFlare 2a06:98c0::/29
|
||||
|
|
Loading…
Reference in New Issue