2019-11-12 22:05:21 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2020-02-15 18:57:46 +01:00
|
|
|
* Manage Tor Proxy configuration
|
|
|
|
*/
|
2019-11-12 22:05:21 +01:00
|
|
|
function DisplayTorProxyConfig()
|
|
|
|
{
|
|
|
|
|
|
|
|
exec('cat '. RASPI_TORPROXY_CONFIG, $return);
|
|
|
|
exec('pidof tor | wc -l', $torproxystatus);
|
|
|
|
|
|
|
|
$arrConfig = array();
|
|
|
|
foreach ($return as $a) {
|
|
|
|
if ($a[0] != "#") {
|
2020-02-15 18:57:46 +01:00
|
|
|
$arrLine = explode(" ", $a);
|
2019-11-12 22:05:21 +01:00
|
|
|
$arrConfig[$arrLine[0]]=$arrLine[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 18:57:46 +01:00
|
|
|
echo renderTemplate(
|
|
|
|
"torproxy", compact(
|
|
|
|
"status",
|
|
|
|
"torproxystatus"
|
|
|
|
)
|
|
|
|
);
|
2019-11-12 22:05:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-02-15 18:57:46 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2019-11-12 22:05:21 +01:00
|
|
|
function SaveTORAndVPNConfig()
|
|
|
|
{
|
|
|
|
if (isset($_POST['SaveTORProxySettings'])) {
|
|
|
|
// TODO
|
|
|
|
} elseif (isset($_POST['StartTOR'])) {
|
|
|
|
echo "Attempting to start TOR";
|
|
|
|
exec('sudo systemctl start tor.service', $return);
|
|
|
|
foreach ($return as $line) {
|
|
|
|
$status->addMessage($line, 'info');
|
|
|
|
}
|
|
|
|
} elseif (isset($_POST['StopTOR'])) {
|
|
|
|
echo "Attempting to stop TOR";
|
|
|
|
exec('sudo systemctl stop tor.service', $return);
|
|
|
|
foreach ($return as $line) {
|
|
|
|
$status->addMessage($line, 'info');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|