diff --git a/get_real_instance_domain.sh b/get_real_instance_domain.sh new file mode 100755 index 0000000..b5db348 --- /dev/null +++ b/get_real_instance_domain.sh @@ -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 with access logging activated in order for this to +# work. + +# Version: 2019-08-17_1 + +if [ -z "${2}" ]; then + echo "Usage: ${0} [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