commit: bump tor version, fix a few checks, add helper script for renaming v3 secrets

pull/94/head
Alec Muffett 2021-05-18 10:54:39 +00:00
rodzic 6eecd545c6
commit c69097d7c9
4 zmienionych plików z 35 dodań i 21 usunięć

2
eotk
Wyświetl plik

@ -444,7 +444,7 @@ case "$cmd" in
InvokeRemotely debugoff "$@"
;;
cleanup) ## project* ... | stop and remove trash files for projects (eg: after crash, "nginx.pid exists!" and ".sock exists!" errors, etc)
clean|cleanup) ## project* ... | stop and remove trash files for projects (eg: after crash, "nginx.pid exists!" and ".sock exists!" errors, etc)
$need_to_run_locally && RunLocallyOverProjects cleanup "$@"
InvokeRemotely cleanup "$@"
;;

Wyświetl plik

@ -22,16 +22,6 @@ chdir($here) or die "chdir: $here: $!\n";
##################################################################
sub ValidOnion {
my $onion = shift;
return ( $onion =~ /^[a-z2-7]{16}(?:[a-z2-7]{40})?$/o );
}
sub ValidOnionV2 {
my $onion = shift;
return ( $onion =~ /^[a-z2-7]{16}$/o );
}
sub ValidOnionV3 {
my $onion = shift;
return ( $onion =~ /^[a-z2-7]{56}$/o );
@ -41,7 +31,7 @@ sub ExtractOnion {
my $onion = shift;
$onion =~ s!^.*/!!o;
$onion =~ s!\.onion$!!o;
die "ExtractOnion: was not given a valid onion: $onion\n" unless (&ValidOnion($onion));
die "ExtractOnion: was not given a valid onion: $onion\n" unless (&ValidOnionV3($onion));
return $onion;
}
@ -55,7 +45,6 @@ sub OnionVersion {
my $onion = shift;
$onion = &ExtractOnion($onion);
return 3 if (&ValidOnionV3($onion));
return 2 if (&ValidOnionV2($onion));
die "OnionVersion: was not given a valid onion: $onion\n";
}
@ -450,15 +439,10 @@ sub DoProject {
my $hs_dir = "$ENV{PROJECT_DIR}/$onion_dirname";
&MakeDir($hs_dir);
# install keyfile
# TODO:
# install keyfiles
my $onion = &ExtractOnion($onion_doto);
my $secrets_dir = "secrets.d";
if (&ValidOnionV2($onion)) {
$key = "$secrets_dir/$onion.key";
&CopyFile($key, "$hs_dir/private_key");
}
elsif (&ValidOnionV3($onion)) {
if (&ValidOnionV3($onion)) {
$pub = "$secrets_dir/$onion.v3pub.key";
$sec = "$secrets_dir/$onion.v3sec.key";
&CopyFile($pub, "$hs_dir/hs_ed25519_public_key");

Wyświetl plik

@ -0,0 +1,30 @@
#!/bin/sh -x
# Version 3 onion addresses require explicit declaration of the
# onion-address AS WELL AS the key materials; for simplicity and
# clarity we embed the onion address in the filenames, and we need two
# filenames for the two files.
self=`basename $0`
hostname=hostname
public=hs_ed25519_public_key
secret=hs_ed25519_secret_key
Fatal() {
echo "fatal error: $0: $@" 1>&2
exit 1
}
for f in $hostname $public $secret ; do
test -f $f || Fatal "cannot file file '$f' for data"
done
onion=`cat hostname` || Fatal "cannot read 'hostname' file to establish onion address"
onion=`basename $onion .onion` # strip verbiage
public2="$onion.v3pub.key"
secret2="$onion.v3sec.key"
cp $public $public2 || Fatal "cannot copy $public to $public2"
cp $secret $secret2 || Fatal "cannot copy $secret to $secret2"

Wyświetl plik

@ -60,7 +60,7 @@ ConfigureOpenResty() { # this accepts arguments
SetupTorVars() {
tool="tor"
tool_version="0.4.3.5"
tool_version="0.4.5.8"
tool_signing_keys="6AFEE6D49E92B601 C218525819F78451"
tool_url="https://dist.torproject.org/$tool-$tool_version.tar.gz"
tool_sig_url="https://dist.torproject.org/$tool-$tool_version.tar.gz.asc"