sudo cat as tor

This commit is contained in:
Miraty 2022-06-09 21:06:05 +02:00
parent 546a7f2572
commit e32d3bd1ed
2 changed files with 2 additions and 1 deletions

View file

@ -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"

View file

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