kopia lustrzana https://github.com/alecmuffett/eotk
commit: bump tor version, fix a few checks, add helper script for renaming v3 secrets
rodzic
6eecd545c6
commit
c69097d7c9
2
eotk
2
eotk
|
@ -444,7 +444,7 @@ case "$cmd" in
|
||||||
InvokeRemotely debugoff "$@"
|
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 "$@"
|
$need_to_run_locally && RunLocallyOverProjects cleanup "$@"
|
||||||
InvokeRemotely cleanup "$@"
|
InvokeRemotely cleanup "$@"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -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 {
|
sub ValidOnionV3 {
|
||||||
my $onion = shift;
|
my $onion = shift;
|
||||||
return ( $onion =~ /^[a-z2-7]{56}$/o );
|
return ( $onion =~ /^[a-z2-7]{56}$/o );
|
||||||
|
@ -41,7 +31,7 @@ sub ExtractOnion {
|
||||||
my $onion = shift;
|
my $onion = shift;
|
||||||
$onion =~ s!^.*/!!o;
|
$onion =~ s!^.*/!!o;
|
||||||
$onion =~ s!\.onion$!!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;
|
return $onion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +45,6 @@ sub OnionVersion {
|
||||||
my $onion = shift;
|
my $onion = shift;
|
||||||
$onion = &ExtractOnion($onion);
|
$onion = &ExtractOnion($onion);
|
||||||
return 3 if (&ValidOnionV3($onion));
|
return 3 if (&ValidOnionV3($onion));
|
||||||
return 2 if (&ValidOnionV2($onion));
|
|
||||||
die "OnionVersion: was not given a valid onion: $onion\n";
|
die "OnionVersion: was not given a valid onion: $onion\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,15 +439,10 @@ sub DoProject {
|
||||||
my $hs_dir = "$ENV{PROJECT_DIR}/$onion_dirname";
|
my $hs_dir = "$ENV{PROJECT_DIR}/$onion_dirname";
|
||||||
&MakeDir($hs_dir);
|
&MakeDir($hs_dir);
|
||||||
|
|
||||||
# install keyfile
|
# install keyfiles
|
||||||
# TODO:
|
|
||||||
my $onion = &ExtractOnion($onion_doto);
|
my $onion = &ExtractOnion($onion_doto);
|
||||||
my $secrets_dir = "secrets.d";
|
my $secrets_dir = "secrets.d";
|
||||||
if (&ValidOnionV2($onion)) {
|
if (&ValidOnionV3($onion)) {
|
||||||
$key = "$secrets_dir/$onion.key";
|
|
||||||
&CopyFile($key, "$hs_dir/private_key");
|
|
||||||
}
|
|
||||||
elsif (&ValidOnionV3($onion)) {
|
|
||||||
$pub = "$secrets_dir/$onion.v3pub.key";
|
$pub = "$secrets_dir/$onion.v3pub.key";
|
||||||
$sec = "$secrets_dir/$onion.v3sec.key";
|
$sec = "$secrets_dir/$onion.v3sec.key";
|
||||||
&CopyFile($pub, "$hs_dir/hs_ed25519_public_key");
|
&CopyFile($pub, "$hs_dir/hs_ed25519_public_key");
|
||||||
|
|
|
@ -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"
|
|
@ -60,7 +60,7 @@ ConfigureOpenResty() { # this accepts arguments
|
||||||
|
|
||||||
SetupTorVars() {
|
SetupTorVars() {
|
||||||
tool="tor"
|
tool="tor"
|
||||||
tool_version="0.4.3.5"
|
tool_version="0.4.5.8"
|
||||||
tool_signing_keys="6AFEE6D49E92B601 C218525819F78451"
|
tool_signing_keys="6AFEE6D49E92B601 C218525819F78451"
|
||||||
tool_url="https://dist.torproject.org/$tool-$tool_version.tar.gz"
|
tool_url="https://dist.torproject.org/$tool-$tool_version.tar.gz"
|
||||||
tool_sig_url="https://dist.torproject.org/$tool-$tool_version.tar.gz.asc"
|
tool_sig_url="https://dist.torproject.org/$tool-$tool_version.tar.gz.asc"
|
||||||
|
|
Ładowanie…
Reference in New Issue