31 lines
948 B
Bash
31 lines
948 B
Bash
|
#!/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
|