فهرست منبع

sudo cat as tor

Miraty 3 سال پیش
والد
کامیت
e32d3bd1ed
2فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 1 0
      config.ini
  2. 1 1
      public/ht/http-onion.php

+ 1 - 0
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"

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