Created
April 24, 2019 09:24
-
-
Save chigley/4cf95669c298ab7a4ab7b4438fb11aaf to your computer and use it in GitHub Desktop.
Generate Tor v3 hidden service authorised client files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 onion client_name" >&2 | |
exit 1 | |
fi | |
onion=$(<<<"$1" sed 's/[.]onion$//') | |
declare -r onion | |
declare -r client_name=$2 | |
priv=$(mktemp) | |
openssl genpkey -algorithm x25519 -out "$priv" -outform der | |
tor_priv=$(tail -c32 "$priv" | base32 | tr -d =) | |
declare -r tor_priv | |
tor_pub=$(openssl pkey -in "$priv" -inform der -pubout -outform der | tail -c32 | base32 | tr -d =) | |
declare -r tor_pub | |
rm -f "$priv" | |
echo "$client_name.auth: descriptor:x25519:$tor_pub" | |
echo "$client_name.auth_private: $onion:descriptor:x25519:$tor_priv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment