sudo cat as tor
This commit is contained in:
parent
546a7f2572
commit
e32d3bd1ed
|
@ -30,6 +30,7 @@ tor_config_path = "/etc/tor/torrc"
|
||||||
; Tor keys directory
|
; Tor keys directory
|
||||||
tor_keys_path = "/var/lib/tor/keys"
|
tor_keys_path = "/var/lib/tor/keys"
|
||||||
tor_service = "tor"
|
tor_service = "tor"
|
||||||
|
tor_user = "tor"
|
||||||
|
|
||||||
sudo_path = "/usr/bin/sudo"
|
sudo_path = "/usr/bin/sudo"
|
||||||
systemctl_path = "/usr/bin/systemctl"
|
systemctl_path = "/usr/bin/systemctl"
|
||||||
|
|
|
@ -49,7 +49,7 @@ if ($code !== 0)
|
||||||
serverError("Failed to reload Tor.");
|
serverError("Failed to reload Tor.");
|
||||||
|
|
||||||
// Get the address generated by 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];
|
$onion = $output[0];
|
||||||
if (preg_match("/[0-9a-z]{56}\.onion/", $onion) !== 1)
|
if (preg_match("/[0-9a-z]{56}\.onion/", $onion) !== 1)
|
||||||
serverError("No onion address found.");
|
serverError("No onion address found.");
|
||||||
|
|
Loading…
Reference in New Issue