From 81b2a140554fa662a3a0cd90d2580f6500f1ab30 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 06:38:29 -0400 Subject: [PATCH 01/26] Update php version test --- installers/common.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 7e743a4..7396b8e 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -1,34 +1,40 @@ raspap_dir="/etc/raspap" raspap_user="www-data" webroot_dir="/var/www/html" -version=`sed 's/\..*//' /etc/debian_version` +version=$(lsb_release -sc) #``sed 's/\..*//' /etc/debian_version` # Determine version, set default home location for lighttpd and # php package to install -if [ $version -eq 11 ]; then +if [ $version -eq bullseye ]; then version_msg="11.0 (Bullseye)" - sudo apt update --allow-releaseinfo-change + # sudo apt update --allow-releaseinfo-change php_package="php7.4-cgi" -elif [ $version -eq 10 ]; then +elif [ $version -eq buster ]; then version_msg="10.0 (Buster)" php_package="php7.3-cgi" -elif [ $version -eq 9 ]; then +elif [ $version -eq stretch ]; then version_msg="9.0 (Stretch)" php_package="php7.0-cgi" +elif [ $version -eq focal ]; then + version_msg="20.02 (Focal)" + php_package="php7.4-cgi" +elif [ $version -eq jammy ]; then + version_msg="22.04 (Jammy)" + php_package="php8.1-cgi" else version_msg="Unmatched version use php7.4" php_package="php7.4-cgi" fi phpcgiconf="" -if [ "$php_package" = "php7.4-cgi" ]; then +if [ "$php_package" = "php8.1-cgi" ]; then + phpcgiconf="/etc/php/8.1/cgi/php.ini" +elif [ "$php_package" = "php7.4-cgi" ]; then phpcgiconf="/etc/php/7.4/cgi/php.ini" elif [ "$php_package" = "php7.3-cgi" ]; then phpcgiconf="/etc/php/7.3/cgi/php.ini" elif [ "$php_package" = "php7.0-cgi" ]; then phpcgiconf="/etc/php/7.0/cgi/php.ini" -elif [ "$php_package" = "php5.6-cgi" ]; then - phpcgiconf="/etc/php5/cgi/php.ini" fi # Outputs a RaspAP Install log line @@ -326,7 +332,7 @@ function patch_system_files() { "/sbin/wpa_cli -i wlan[0-9] scan_results" "/sbin/wpa_cli -i wlan[0-9] scan" "/sbin/wpa_cli -i wlan[0-9] reconfigure" - "/sbin/wpa_cli -i wlan[0-9] select_network" + "/sbin/wpa_cli -i wlan[0-9] select_network" "/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf" "/etc/init.d/hostapd start" "/etc/init.d/hostapd stop" From 52a1562cb0cb01bdc1a360050facf24bdfa7973e Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 06:50:06 -0400 Subject: [PATCH 02/26] update version test. --- installers/common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 7396b8e..b615afa 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -5,20 +5,20 @@ version=$(lsb_release -sc) #``sed 's/\..*//' /etc/debian_version` # Determine version, set default home location for lighttpd and # php package to install -if [ $version -eq bullseye ]; then +if [ $version -eq "bullseye" ]; then version_msg="11.0 (Bullseye)" # sudo apt update --allow-releaseinfo-change php_package="php7.4-cgi" -elif [ $version -eq buster ]; then +elif [ $version -eq "buster" ]; then version_msg="10.0 (Buster)" php_package="php7.3-cgi" -elif [ $version -eq stretch ]; then +elif [ $version -eq "stretch" ]; then version_msg="9.0 (Stretch)" php_package="php7.0-cgi" -elif [ $version -eq focal ]; then +elif [ $version -eq "focal" ]; then version_msg="20.02 (Focal)" php_package="php7.4-cgi" -elif [ $version -eq jammy ]; then +elif [ $version -eq "jammy" ]; then version_msg="22.04 (Jammy)" php_package="php8.1-cgi" else From 4d13e906abeb67e30fd7ad18f250fbfb1d67e6f0 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 06:58:06 -0400 Subject: [PATCH 03/26] update test --- installers/common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index b615afa..53e72f1 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -5,20 +5,20 @@ version=$(lsb_release -sc) #``sed 's/\..*//' /etc/debian_version` # Determine version, set default home location for lighttpd and # php package to install -if [ $version -eq "bullseye" ]; then +if [ $version = "bullseye" ]; then version_msg="11.0 (Bullseye)" # sudo apt update --allow-releaseinfo-change php_package="php7.4-cgi" -elif [ $version -eq "buster" ]; then +elif [ $version = "buster" ]; then version_msg="10.0 (Buster)" php_package="php7.3-cgi" -elif [ $version -eq "stretch" ]; then +elif [ $version = "stretch" ]; then version_msg="9.0 (Stretch)" php_package="php7.0-cgi" -elif [ $version -eq "focal" ]; then +elif [ $version = "focal" ]; then version_msg="20.02 (Focal)" php_package="php7.4-cgi" -elif [ $version -eq "jammy" ]; then +elif [ $version = "jammy" ]; then version_msg="22.04 (Jammy)" php_package="php8.1-cgi" else From aa65248e22c08c160dcb07f7f4efbc2e04f27cb4 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 07:23:09 -0400 Subject: [PATCH 04/26] Default to iptables. --- installers/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index 53e72f1..aab4b84 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -236,7 +236,7 @@ function move_config_file() { function network_tables() { install_log "Selecting iptables or nftable rules" - if [ $version -lt 12 ]; then + if [ $version != "future_requirement" ]; then install_log "Use iptables" sudo apt-get -y install iptables tablerouteA='iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' From 4c84af1aa43f926ed8221ee3957cece1b409c6a0 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 08:55:36 -0400 Subject: [PATCH 05/26] patch notification armbianEnv --- installers/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index aab4b84..1353aa9 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -102,7 +102,8 @@ function install_dependencies() { function common_interfaces() { if [ -f /boot/armbianEnv.txt ]; then - sudo sed -i '1i extraargs=net.ifnames=0' /boot/armbianEnv.txt && install_log "armbianEnv patched" + sudo sed -i '1i extraargs=net.ifnames=0' /boot/armbianEnv.txt + install_log "armbianEnv patched" else install_log "Armbian undetected no patching required" fi } From 0975f3078b9c316ca5d3afe8b2ecf3343fee3746 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 09:00:56 -0400 Subject: [PATCH 06/26] use double quotes for sed in bash --- installers/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index 1353aa9..931688b 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -102,7 +102,7 @@ function install_dependencies() { function common_interfaces() { if [ -f /boot/armbianEnv.txt ]; then - sudo sed -i '1i extraargs=net.ifnames=0' /boot/armbianEnv.txt + sudo sed -i "1i extraargs=net.ifnames=0" /boot/armbianEnv.txt install_log "armbianEnv patched" else install_log "Armbian undetected no patching required" fi From a6f1ec0aa63254fc30e24a43a2a7aa1959107f65 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 09:13:51 -0400 Subject: [PATCH 07/26] Install log patch services --- installers/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index 931688b..7faf3dd 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -109,9 +109,10 @@ function common_interfaces() { } function stop_lokinet(){ + install_log "stop lokinet and patch services" sudo systemctl stop lokinet.service #Set sed lokinet.service for Hostapd to restart everytime after Lokinet restarts - sed -i '/^ExecStartPost=+/usr/sbin/lokinet-resolvconf add /var/lib/lokinet/lokinet.ini.*/a ExecStartPost=+systemctl restart hostapd' /usr/lib/systemd/system/lokinet.service + sed -i "/^ExecStartPost=+/usr/sbin/lokinet-resolvconf add /var/lib/lokinet/lokinet.ini.*/a ExecStartPost=+systemctl restart hostapd" /usr/lib/systemd/system/lokinet.service sudo systemctl daemon-reload } From 3a7a1787669a8e3f5396ed1e8d2d3374b62a8627 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 09:43:12 -0400 Subject: [PATCH 08/26] Use hostapd restart in service --- installers/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 7faf3dd..485572b 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -109,10 +109,10 @@ function common_interfaces() { } function stop_lokinet(){ - install_log "stop lokinet and patch services" + install_log "stop lokinet and patch hostapd restart to service" sudo systemctl stop lokinet.service #Set sed lokinet.service for Hostapd to restart everytime after Lokinet restarts - sed -i "/^ExecStartPost=+/usr/sbin/lokinet-resolvconf add /var/lib/lokinet/lokinet.ini.*/a ExecStartPost=+systemctl restart hostapd" /usr/lib/systemd/system/lokinet.service + sed -i "/ExecStartPost=+\/usr\/sbin\/lokinet-resolvconf add \/var\/lib\/lokinet\/lokinet.ini/a ExecStartPost=+systemctl restart hostapd" /usr/lib/systemd/system/lokinet.service sudo systemctl daemon-reload } From ceb0cadda10b1351e41f4c9bb162754dbca47287 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 10:46:11 -0400 Subject: [PATCH 09/26] Do not patch lokinet.service --- installers/common.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 485572b..b613b7b 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -1,7 +1,7 @@ raspap_dir="/etc/raspap" raspap_user="www-data" webroot_dir="/var/www/html" -version=$(lsb_release -sc) #``sed 's/\..*//' /etc/debian_version` +version=$(lsb_release -sc) # Determine version, set default home location for lighttpd and # php package to install @@ -108,6 +108,7 @@ function common_interfaces() { fi } +# This section no longer used but may retain value for patching service function stop_lokinet(){ install_log "stop lokinet and patch hostapd restart to service" sudo systemctl stop lokinet.service @@ -442,7 +443,7 @@ function install_raspap() { update_system_packages install_dependencies common_interfaces - stop_lokinet +# stop_lokinet check_for_networkmananger optimize_php enable_php_lighttpd From 081009aece4cc8122c03bdc5291f1b33653d2295 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 14:14:11 -0400 Subject: [PATCH 10/26] generate required directories earlier --- installers/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index b613b7b..8ad534c 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -442,12 +442,13 @@ function install_raspap() { config_installation update_system_packages install_dependencies + create_raspap_directories common_interfaces # stop_lokinet check_for_networkmananger optimize_php enable_php_lighttpd - create_raspap_directories +# create_raspap_directories check_for_old_configs download_latest_files change_file_ownership From f9118667c459a6ac27166182fc2b9f942c5ce425 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 14:43:34 -0400 Subject: [PATCH 11/26] remove blanks --- config/hostapd.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/hostapd.conf b/config/hostapd.conf index 5a2d512..e867a7a 100644 --- a/config/hostapd.conf +++ b/config/hostapd.conf @@ -1,5 +1,3 @@ - - driver=nl80211 ctrl_interface=/var/run/hostapd ctrl_interface_group=0 From 86b900e25f93c49b5762bafaf15aeb8546203b7b Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Sat, 16 Apr 2022 14:59:19 -0400 Subject: [PATCH 12/26] Bump version to 2.5 --- README.md | 2 +- includes/config.php | 2 +- index.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eaed0a2..c35211b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://i.imgur.com/2ZrhaiH.png) -# `LabyrinthAP / Lokinet Access Point` [![Release 2.4](https://img.shields.io/badge/Release-2.4-green.svg)](https://github.com/necro-nemesis/raspap-webgui/releases) +# `LabyrinthAP / Lokinet Access Point` [![Release 2.5](https://img.shields.io/badge/Release-2.5-green.svg)](https://github.com/necro-nemesis/raspap-webgui/releases) LabyrinthAP interfaces with Lokinet daemon to facilitate connections to the Lokinet global privacy network. LabyrinthAP provides a simple, responsive web interface to control wifi, hostapd, Lokinet daemon and related services necessary to access Lokinet on the Raspberry Pi or Orange Pi. diff --git a/includes/config.php b/includes/config.php index e84fbaa..1f4104b 100755 --- a/includes/config.php +++ b/includes/config.php @@ -1,6 +1,6 @@ Discord/Telegram) + * @author TechnicalTumbleweed (Oxen-> Session Lokinet/Telegram Oxen Community) * @license GNU General Public License, version 3 (GPL-3.0) - * @version 2.4 + * @version 2.5 * @link https://github.com/necro-nemesis/LabyrinthAP */ From fe1fc560df88a8f2435ad834d6d786c388f88297 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 16 Apr 2022 21:16:59 -0400 Subject: [PATCH 13/26] Include status info with exit start --- config/lokilaunch.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/lokilaunch.sh b/config/lokilaunch.sh index e96756b..f19fbf0 100644 --- a/config/lokilaunch.sh +++ b/config/lokilaunch.sh @@ -40,10 +40,12 @@ bootstrap) exitup) if [ "$3" = "" ]; then lokinet-vpn --up --exit "$2" - echo -n "lokinet --vpn --exit ""$2" + echo -n "lokinet --vpn --exit "$2"\n" + lokinet-vpn --status else lokinet-vpn --up --exit "$2" --token "$3" - echo -n "lokinet-vpn --up --exit ""$2"" --token ""$3" + echo -n "lokinet-vpn --up --exit "$2" --token "$3"\n" + lokinet-vpn --status fi ;; From 6e5fcb6eb9d73435641c56b945d8c7c1fc0938db Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Mon, 18 Apr 2022 10:37:34 -0400 Subject: [PATCH 14/26] Expand NM test --- installers/raspbian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index ddf9c92..878bcd1 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -24,7 +24,7 @@ function install_dependencies() { function check_for_networkmananger() { install_log "Checking for NetworkManager" echo "Checking for Network Manager" - if [ -f /lib/systemd/system/network-manager.service ]; then + if [ -f /lib/systemd/system/network-manager.service ] || [ -f /lib/systemd/system/NetworkManager.service]; then echo "Network Manager found. Replacing with DHCPCD" sudo apt-get -y purge network-manager sudo apt-get -y install dhcpcd5 From 25b8e87a0360fe8a71747062a299b145f43fd22f Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Mon, 18 Apr 2022 10:38:13 -0400 Subject: [PATCH 15/26] Expand NM test --- installers/raspbian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 878bcd1..24b93c6 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -24,7 +24,7 @@ function install_dependencies() { function check_for_networkmananger() { install_log "Checking for NetworkManager" echo "Checking for Network Manager" - if [ -f /lib/systemd/system/network-manager.service ] || [ -f /lib/systemd/system/NetworkManager.service]; then + if [ -f /lib/systemd/system/network-manager.service ] || [ -f /lib/systemd/system/NetworkManager.service ]; then echo "Network Manager found. Replacing with DHCPCD" sudo apt-get -y purge network-manager sudo apt-get -y install dhcpcd5 From 7ec05f56017d18aa5306751d2a861da11774f44a Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Mon, 18 Apr 2022 19:29:36 -0400 Subject: [PATCH 16/26] enable OPCache --- installers/common.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 8ad534c..4e16b78 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -399,18 +399,20 @@ function optimize_php() { sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf" sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini" - echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: " - read answer - if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then + echo -n "Enabling HttpOnly for session cookies " + # echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: " + # read answer + # if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then echo "Php-cgi enabling session.cookie_httponly." sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" - fi - - if [ "$php_package" = "php7.0-cgi" ]; then - echo -n "Enable PHP OPCache? [Y/n]: " - read answer - if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then - echo "Php-cgi enabling opcache.enable." + # fi + + # if [ "$php_package" = "php7.0-cgi" ]; then + echo -n "Enabling PHP OPCache" + # echo -n "Enable PHP OPCache? [Y/n]: " + # read answer + # if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then + # echo "Php-cgi enabling opcache.enable." sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf" # Make sure opcache extension is turned on. if [ -f "/usr/sbin/phpenmod" ]; then @@ -418,8 +420,8 @@ function optimize_php() { else install_warning "phpenmod not found." fi - fi - fi + # fi + # fi } function install_complete() { From 72cdd0e2b7767f666fef63b3636adcc0a99712ea Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Mon, 18 Apr 2022 20:06:37 -0400 Subject: [PATCH 17/26] Update common.sh --- installers/common.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installers/common.sh b/installers/common.sh index 4e16b78..f8b383c 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -417,6 +417,7 @@ function optimize_php() { # Make sure opcache extension is turned on. if [ -f "/usr/sbin/phpenmod" ]; then sudo phpenmod opcache + echo -n "PHP OPCache enabled" else install_warning "phpenmod not found." fi From 2974d336200eefcc92f9f100dfe855ae4ba7a563 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Mon, 18 Apr 2022 20:28:26 -0400 Subject: [PATCH 18/26] Update common.sh --- installers/common.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index f8b383c..1736c74 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -407,12 +407,12 @@ function optimize_php() { sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" # fi - # if [ "$php_package" = "php7.0-cgi" ]; then - echo -n "Enabling PHP OPCache" - # echo -n "Enable PHP OPCache? [Y/n]: " - # read answer - # if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then - # echo "Php-cgi enabling opcache.enable." + if [ "$php_package" = "php7.0-cgi" ]; then + # echo -n "Enabling PHP OPCache" + echo -n "Enable PHP OPCache? [Y/n]: " + read answer + if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then + echo "Php-cgi enabling opcache.enable." sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf" # Make sure opcache extension is turned on. if [ -f "/usr/sbin/phpenmod" ]; then @@ -421,8 +421,8 @@ function optimize_php() { else install_warning "phpenmod not found." fi - # fi - # fi + fi + fi } function install_complete() { From 41fc43cfad9c786834a561ae2078c015b13c5128 Mon Sep 17 00:00:00 2001 From: necro-nemsis Date: Mon, 18 Apr 2022 21:20:55 -0400 Subject: [PATCH 19/26] Clear out extra comments --- installers/common.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 1736c74..a72f25d 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -399,16 +399,9 @@ function optimize_php() { sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf" sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini" - echo -n "Enabling HttpOnly for session cookies " - # echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: " - # read answer - # if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then - echo "Php-cgi enabling session.cookie_httponly." - sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" - # fi - + echo -n "Enabling HttpOnly for session cookies " + sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" if [ "$php_package" = "php7.0-cgi" ]; then - # echo -n "Enabling PHP OPCache" echo -n "Enable PHP OPCache? [Y/n]: " read answer if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then @@ -447,11 +440,9 @@ function install_raspap() { install_dependencies create_raspap_directories common_interfaces -# stop_lokinet check_for_networkmananger optimize_php enable_php_lighttpd -# create_raspap_directories check_for_old_configs download_latest_files change_file_ownership From 64e4e60c7373600289df08acf71fde1106627def Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Tue, 19 Apr 2022 19:16:22 -0400 Subject: [PATCH 20/26] Patch lokinet.service for dnsmasq --- installers/raspbian.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 24b93c6..ca9a01f 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -19,6 +19,15 @@ function install_dependencies() { sudo yes | apt-get install whois lighttpd $php_package git resolvconf hostapd dnsmasq vnstat libqmi-utils udhcpc lokinet || install_error "Unable to install dependencies" } +#Patch Lokinet Service Wants/After DNSMasq + +function patch_lokinet_service() { + install_log "Patching Lokinet Service" + sed -i '/^After=network-online.target/a Wants=dnsmasq.service \nAfter=dnsmasq.service' /lib/systemd/system/lokinet.service + sudo systemctl daemon-reload + +} + #Remove NetworkManager and install dhcpd if required Armbian. function check_for_networkmananger() { From 101410ad767365c1700a9ae183767c528b559258 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Tue, 19 Apr 2022 19:17:46 -0400 Subject: [PATCH 21/26] Patch lokinet service --- installers/common.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installers/common.sh b/installers/common.sh index a72f25d..be8fa25 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -438,6 +438,7 @@ function install_raspap() { config_installation update_system_packages install_dependencies + patch_lokinet_service create_raspap_directories common_interfaces check_for_networkmananger From 81c3abde2aa2a99bfde0ec8f17d0e878d7df0813 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Tue, 19 Apr 2022 22:14:01 -0400 Subject: [PATCH 22/26] check for daemon run before vpn status test --- includes/functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index b4c25c9..d8bc546 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -228,7 +228,9 @@ function ConvertToSecurity($security) function DisplayLokinetConfig() { exec('pidof lokinet | wc -l', $lokinetstatus); + if ($lokinetstatus[0] != 0) { $exitstatus = exec("lokinet-vpn --status"); + } $rulestate = exec("ip rule show default | grep lokinet | awk {'print $5'}", $output); $lokiversion = exec("dpkg -s lokinet | grep '^Version:'", $output); ?> From 218341ece65a5e26c4592d36cdf4a88a96528ecf Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Tue, 19 Apr 2022 22:53:50 -0400 Subject: [PATCH 23/26] sync exit off button to daemon shutdown --- includes/functions.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index d8bc546..5e9a4b4 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -230,6 +230,8 @@ function DisplayLokinetConfig() exec('pidof lokinet | wc -l', $lokinetstatus); if ($lokinetstatus[0] != 0) { $exitstatus = exec("lokinet-vpn --status"); + } else { + $exitstatus = "no exits"; } $rulestate = exec("ip rule show default | grep lokinet | awk {'print $5'}", $output); $lokiversion = exec("dpkg -s lokinet | grep '^Version:'", $output); @@ -265,10 +267,10 @@ function DisplayLokinetConfig()
' , PHP_EOL; - } else { + if ($exitstatus != "no exits") { echo '' , PHP_EOL; + } else { + echo '' , PHP_EOL; } if ($lokinetstatus[0] == 0) { echo '' , PHP_EOL; @@ -367,7 +369,8 @@ function ActivateLokinetConfig() //STOP } elseif (isset($_POST['StopDaemon'])) { - exec('sudo /var/lib/lokinet/lokilaunch.sh stop'); + exec ('sudo /var/lib/lokinet/lokilaunch.sh exitdown'); + exec('sudo /var/lib/lokinet/lokilaunch.sh stop'); DisplayLokinetConfig(); //START EXIT From 889d96cbef0902541be0a23b8ac3bdb870a5cec8 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Wed, 20 Apr 2022 08:05:27 -0400 Subject: [PATCH 24/26] add RPi 4 references --- includes/system.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/system.php b/includes/system.php index c49551e..66a7e4b 100755 --- a/includes/system.php +++ b/includes/system.php @@ -40,6 +40,15 @@ function RPiVersion() { 'a220a0' => 'Compute Module 3', 'a020a0' => 'Compute Module 3', 'a02100' => 'Compute Module 3+', + 'a03111' => 'Model 4B Revision 1.1 (1 GB)', + 'b03111' => 'Model 4B Revision 1.1 (2 GB)', + 'b03112' => 'Model 4B Revision 1.2 (2 GB)', + 'b03114' => 'Model 4B Revision 1.4 (2 GB)', + 'c03111' => 'Model 4B Revision 1.1 (4 GB)', + 'c03112' => 'Model 4B Revision 1.2 (4 GB)', + 'c03114' => 'Model 4B Revision 1.4 (4 GB)', + 'd03114' => 'Model 4B Revision 1.4 (8 GB)', + 'c03130' => 'Model 4B Revision 1.0 (4 GB)', //Orange Pi Boards 'orpi' => 'Orange Pi', 'orpizero' => 'Orange Pi Zero', From 22d08bce35e7aecbe34e1a772925167943cad484 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Wed, 20 Apr 2022 10:51:53 -0400 Subject: [PATCH 25/26] test root user --- installers/raspbian.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index ca9a01f..5cf41aa 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -2,6 +2,13 @@ UPDATE_URL="https://raw.githubusercontent.com/necro-nemesis/LabyrinthAP/master/" wget -q ${UPDATE_URL}/installers/common.sh -O /tmp/raspapcommon.sh source /tmp/raspapcommon.sh && rm -f /tmp/raspapcommon.sh +function test_root_user() { + if [ "$EUID" -ne 0 ] + then echo "Please run LabyrinthAP installer as root" + exit + fi +} + function update_system_packages() { install_log "Updating sources" sudo apt-get update || install_error "Unable to update package list" From 7385495bf10e1ea04d491dcf9678732f153eb6c3 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Wed, 20 Apr 2022 10:52:51 -0400 Subject: [PATCH 26/26] add test root user --- installers/common.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installers/common.sh b/installers/common.sh index be8fa25..283541b 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -434,6 +434,7 @@ function install_complete() { } function install_raspap() { + test_root_user display_welcome config_installation update_system_packages