From 91441c5f1d30125d9e15bea810a3d2faaa603dc0 Mon Sep 17 00:00:00 2001 From: Miraty Date: Wed, 4 May 2022 21:18:43 +0200 Subject: [PATCH] ht/ rework for onions step 2 --- public/ht/http-onion.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/ht/http-onion.php b/public/ht/http-onion.php index bd5d060..606ff23 100644 --- a/public/ht/http-onion.php +++ b/public/ht/http-onion.php @@ -64,7 +64,7 @@ HiddenServicePort 80 [::1]:" . INTERNAL_ONION_HTTP_PORT . " "; file_put_contents(TOR_CONFIG_PATH, $torConf); - exec(SUDO_PATH . " " . SYSTEMCTL_PATH . " reload-tor", $output); + exec(SUDO_PATH . " " . SYSTEMCTL_PATH . " reload tor", $output); addNiverLog("Tor reloaded by " . $_SESSION['username'], $output); // Copy generated address to a location readable by PHP @@ -77,6 +77,8 @@ HiddenServicePort 80 [::1]:" . INTERNAL_ONION_HTTP_PORT . " // Get the address generated by Tor $onion = file_get_contents(HT_PATH . "/" . $_SESSION['username'] . "/" . $_POST['dir'] . "/hostname"); $onion = str_replace(array("\r", "\n"), "", $onion); + if (preg_match("/[0-9a-z]{56}\.onion/", $onion) !== 1) + exit("ERROR: No onion address found"); // Store it in the database addSite($_SESSION['username'], $_POST['dir'], $onion, "onion", "http");