From 9a47e61f3ed10ff61859e51bc5255b136aed8a3e Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 14 Sep 2019 00:41:19 -0400 Subject: [PATCH 1/5] fix spelling --- installers/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 13a80bd..d75a4c7 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -275,8 +275,8 @@ function patch_system_files() { "/bin/cp /etc/raspap/networking/dhcpcd.conf /etc/dhcpcd.conf" "/etc/raspap/hostapd/enablelog.sh" "/etc/raspap/hostapd/disablelog.sh" - "/var/lib/lokinet/lokilaunch.sh*" - + "/var/lib/lokinet/lokilaunch.sh" + ) # Check if sudoers needs patching From 239b1bd3eaddd0bb2b45b58edd232d8d997484af Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 14 Sep 2019 00:52:35 -0400 Subject: [PATCH 2/5] Redirect all remaining lokilaunch functions to /var/lib/lokinet/lokilaunch.sh (start stop gen bootstrap) --- includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index c44f953..47278fd 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -388,7 +388,7 @@ function DisplayLokinetConfig() echo '' , PHP_EOL; } - $filename = '/usr/local/bin/lokinet.ini'; + $filename = '/var/lib/lokinet/lokinet.ini'; if (file_exists($filename)) { echo '' , PHP_EOL; @@ -653,7 +653,7 @@ function SaveTORAndVPNConfig() $output"; } } From 997d841bf788d9bfebea501f7986d89ab7bada18 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 14 Sep 2019 08:10:08 -0400 Subject: [PATCH 3/5] Modify lokinet.sh gen to generate lokinet.ini appropriately in /var/lib/lokinet.ini --- config/lokilaunch.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config/lokilaunch.sh b/config/lokilaunch.sh index 122452c..2b1e22c 100644 --- a/config/lokilaunch.sh +++ b/config/lokilaunch.sh @@ -15,10 +15,16 @@ case "$1" in ;; gen) + systemctl stop lokinet echo -n "NEW lokinet.ini FILE CREATED\n" - lokinet "-g" - cp /root/.lokinet/lokinet.ini /usr/local/bin/ - cat /usr/local/bin/lokinet.ini + tmpdir=$(mktemp --tmpdir -d lokinet.XXXXXXXXXX) + /usr/bin/lokinet -g $tmpdir/lokinet.ini + sudo sed -i -e "s#$tmpdir#/var/lib/lokinet#" $tmpdir/lokinet.ini + chmod 640 $tmpdir/lokinet.ini + chgrp _loki $tmpdir/lokinet.ini + mv -f $tmpdir/lokinet.ini /var/lib/lokinet/lokinet.ini + cat /var/lib/lokinet/lokinet.ini + systemctl start lokinet ;; bootstrap) From 97a3aa106b18ba4efcc5fb2996295cd0acf63164 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 14 Sep 2019 09:25:34 -0400 Subject: [PATCH 4/5] Clean up bootstrap PHP. --- includes/functions.php | 68 +++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 47278fd..78d3f72 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -596,64 +596,70 @@ function SaveTORAndVPNConfig() foreach ($return as $line) { echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; } +/* Lokinet script commands start HERE +//// +//// LOKINET +//// +//*/ + + //START } elseif (isset($_POST['StartDaemon'])) { - ?> + ?>
- Launching Lokinet. + Launching Lokinet.
$output"; + echo "
$output
"; + + //STOP } elseif (isset($_POST['StopDaemon'])) { - ?> + ?>
- Exiting Lokinet. + Exiting Lokinet.
- Stopping Lokinet background daemon process. + Stopping Lokinet background daemon process.
$output"; + echo "
$output
"; + + //GENERATE LOKINET.INI } elseif (isset($_POST['GenerateLokinet'])) { - ?> + ?>
- Generating Lokinet Configuration + Generating Lokinet Configuration
$output"; + echo "
$output
"; + + //REGENERATE LOKINET.INI } elseif (isset($_POST['ReGenerateLokinet'])) { - ?> + ?>
- Regenerating Lokinet Configuration + Regenerating Lokinet Configuration
$output"; + echo "
$output
"; + + //APPLY LOKINET-BOOTSTRAP } elseif (isset($_POST['ApplyLokinetSettings'])) { - ?> -
- Exiting Lokinet. -
- -
+ ?> +
Stopping Lokinet background daemon process. -
- $output"; - $bootstrap = $_POST['lokinetbootstrap']; - ?> -
+
+
Applying Bootstrap -
- + $output"; } } From 2db6b3e9c556f1a62b2b4783bacbd1bad73b0027 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 14 Sep 2019 17:47:54 -0400 Subject: [PATCH 5/5] Modify Lokinet button functions. --- includes/functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 78d3f72..82fa73b 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -604,13 +604,15 @@ function SaveTORAndVPNConfig() //START } elseif (isset($_POST['StartDaemon'])) { - ?> + /*?>
Launching Lokinet.
$output"; + $output = */ + shell_exec('sudo /var/lib/lokinet/lokilaunch.sh start'); + /* echo "
$output
"; + */ //STOP } elseif (isset($_POST['StopDaemon'])) {