From e32d3bd1edcdc78f0df3b2efb1005b9911386273 Mon Sep 17 00:00:00 2001 From: Miraty Date: Thu, 9 Jun 2022 21:06:05 +0200 Subject: [PATCH] sudo cat as tor --- config.ini | 1 + public/ht/http-onion.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config.ini b/config.ini index 4011712..c351e49 100644 --- a/config.ini +++ b/config.ini @@ -30,6 +30,7 @@ tor_config_path = "/etc/tor/torrc" ; Tor keys directory tor_keys_path = "/var/lib/tor/keys" tor_service = "tor" +tor_user = "tor" sudo_path = "/usr/bin/sudo" systemctl_path = "/usr/bin/systemctl" diff --git a/public/ht/http-onion.php b/public/ht/http-onion.php index 1e96687..fddb54e 100644 --- a/public/ht/http-onion.php +++ b/public/ht/http-onion.php @@ -49,7 +49,7 @@ if ($code !== 0) serverError("Failed to reload Tor."); // Get the address generated by Tor -exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['cat_path'] . " " . CONF['ht']['tor_keys_path'] . "/" . $_POST['dir'] . "/hostname", $output); +exec(CONF['ht']['sudo_path'] . " -u " . CONF['ht']['tor_user'] . " " . CONF['ht']['cat_path'] . " " . CONF['ht']['tor_keys_path'] . "/" . $_POST['dir'] . "/hostname", $output); $onion = $output[0]; if (preg_match("/[0-9a-z]{56}\.onion/", $onion) !== 1) serverError("No onion address found.");