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.");