Added get_real_instance_domain.
A script for finding out the real IP of an instance.
This commit is contained in:
parent
2ac4393621
commit
8f86b41e1d
30
get_real_instance_domain.sh
Executable file
30
get_real_instance_domain.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user