|
@@ -51,15 +51,15 @@ if (isset($_POST['dir']) AND isset($_SESSION['username'])) {
|
|
exit("ERROR : Wrong value for dir");
|
|
exit("ERROR : Wrong value for dir");
|
|
|
|
|
|
// Generate a .onion address
|
|
// Generate a .onion address
|
|
- $torConf = file_get_contents("/etc/tor/torrc");
|
|
|
|
- $torConf = $torConf . "\nHiddenServiceDir /var/lib/tor/niver/" . $_POST['dir'] . "/\nHiddenServicePort 80 [::1]:80";
|
|
|
|
- file_put_contents("/etc/tor/torrc", $torConf);
|
|
|
|
|
|
+ $torConf = file_get_contents(TOR_CONFIG_PATH);
|
|
|
|
+ $torConf = $torConf . "\nHiddenServiceDir " . TOR_KEYS_PATH . "/" . $_POST['dir'] . "/\nHiddenServicePort 80 [::1]:80";
|
|
|
|
+ file_put_contents(TOR_CONFIG_PATH, $torConf);
|
|
|
|
|
|
- exec("sudo -u root " . MANIVER_PATH . " reload-tor", $output);
|
|
|
|
|
|
+ exec(SUDO_PATH . " " . MANIVER_PATH . " reload-tor", $output);
|
|
addNiverLog("Tor reloaded by " . $_SESSION['username'], $output);
|
|
addNiverLog("Tor reloaded by " . $_SESSION['username'], $output);
|
|
|
|
|
|
// Copy generated address to a location readable by PHP
|
|
// Copy generated address to a location readable by PHP
|
|
- exec("sudo -u root " . MANIVER_PATH . " export-tor " . $_SESSION['username'] . " " . $_POST['dir'], $output);
|
|
|
|
|
|
+ exec(SUDO_PATH . " " . MANIVER_PATH . " export-tor " . $_SESSION['username'] . " " . $_POST['dir'], $output);
|
|
addNiverLog("Tor data exported by " . $_SESSION['username'], $output);
|
|
addNiverLog("Tor data exported by " . $_SESSION['username'], $output);
|
|
|
|
|
|
// Get the address generated by Tor
|
|
// Get the address generated by Tor
|
|
@@ -70,14 +70,14 @@ if (isset($_POST['dir']) AND isset($_SESSION['username'])) {
|
|
addSite($_SESSION['username'], $_POST['dir'], $onion, "onion", "http");
|
|
addSite($_SESSION['username'], $_POST['dir'], $onion, "onion", "http");
|
|
|
|
|
|
// Add it to Nginx
|
|
// Add it to Nginx
|
|
- $nginxConf = file_get_contents("/etc/nginx/hyper.d/onion.template");
|
|
|
|
|
|
+ $nginxConf = file_get_contents(ROOT_PATH . "/inc/nginx/dns.template");
|
|
$nginxConf = preg_replace("#DOMAIN#", $onion, $nginxConf);
|
|
$nginxConf = preg_replace("#DOMAIN#", $onion, $nginxConf);
|
|
$nginxConf = preg_replace("#DIR#", $_POST['dir'], $nginxConf);
|
|
$nginxConf = preg_replace("#DIR#", $_POST['dir'], $nginxConf);
|
|
$nginxConf = preg_replace("#USER#", $_SESSION['username'], $nginxConf);
|
|
$nginxConf = preg_replace("#USER#", $_SESSION['username'], $nginxConf);
|
|
- file_put_contents("/etc/nginx/hyper.d/" . $_POST['dir'] . ".conf", $nginxConf);
|
|
|
|
|
|
+ file_put_contents(NGINX_CONFIG_PATH . "/" . $_POST['dir'] . ".conf", $nginxConf);
|
|
|
|
|
|
// Reload Nginx
|
|
// Reload Nginx
|
|
- exec("sudo /root/maniver/target/debug/maniver reload-nginx");
|
|
|
|
|
|
+ exec("sudo " . MANIVER_PATH . " reload-nginx");
|
|
|
|
|
|
// Tell the user their site address
|
|
// Tell the user their site address
|
|
echo "<p>L'adresse de votre site Onion HTTP est :<br><a href='http://" . $onion . "'<code>http://" . $onion . "</code></a></p>";
|
|
echo "<p>L'adresse de votre site Onion HTTP est :<br><a href='http://" . $onion . "'<code>http://" . $onion . "</code></a></p>";
|