Added get_real_instance_domain.

A script for finding out the real IP of an instance.
This commit is contained in:
tastytea 2019-08-17 02:59:27 +02:00
parent 2ac4393621
commit 8f86b41e1d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 30 additions and 0 deletions

30
get_real_instance_domain.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# Triggers an HTTPS connection from the remote Fediverse instance to your host.
# Works only if the remote instance checks signatures. You need an HTTPS server
# running on <Your host> with access logging activated in order for this to
# work.
# Version: 2019-08-17_1
if [ -z "${2}" ]; then
echo "Usage: ${0} <Your host> <Remote host> [additional curl options]" >&2
exit 1
fi
your_host="${1}"
remote_host="${2}"
if command -v md5sum > /dev/null; then
uuid="$(date | md5sum | cut -d' ' -f 1)"
else
echo "Warning: md5sum not found." >&2
uuid="4c2896dcba1597e2768387bc1e0e727a"
fi
sig='Signature: keyId="https://'"${your_host}/${uuid}"'",algorithm="rsa-sha256"'
sig="${sig}"',headers="(request-target) host date content-type",signature="Aa="'
curl -H "${sig}" -H "Date: $(date -Ru|sed -e 's/+0000/GMT/')" \
-H "Content-Type: application/activity+json" -d '{}' "${@}" \
"https://${remote_host}/inbox"
echo