Merge pull request #43 from necro-nemesis/master

bring backup up to master
backup
necro-nemesis 3 years ago committed by GitHub
commit 925787f9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
![](https://i.imgur.com/2ZrhaiH.png) ![](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. 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.

@ -1,5 +1,3 @@
driver=nl80211 driver=nl80211
ctrl_interface=/var/run/hostapd ctrl_interface=/var/run/hostapd
ctrl_interface_group=0 ctrl_interface_group=0

@ -40,10 +40,12 @@ bootstrap)
exitup) exitup)
if [ "$3" = "" ]; then if [ "$3" = "" ]; then
lokinet-vpn --up --exit "$2" lokinet-vpn --up --exit "$2"
echo -n "lokinet --vpn --exit ""$2" echo -n "lokinet --vpn --exit "$2"\n"
lokinet-vpn --status
else else
lokinet-vpn --up --exit "$2" --token "$3" 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 fi
;; ;;

@ -1,6 +1,6 @@
<?php <?php
define('RASPI_VERSION', '2.4'); define('RASPI_VERSION', '2.5');
define('RASPI_CONFIG', '/etc/raspap'); define('RASPI_CONFIG', '/etc/raspap');
define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking'); define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking');
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');

@ -228,7 +228,11 @@ function ConvertToSecurity($security)
function DisplayLokinetConfig() function DisplayLokinetConfig()
{ {
exec('pidof lokinet | wc -l', $lokinetstatus); exec('pidof lokinet | wc -l', $lokinetstatus);
if ($lokinetstatus[0] != 0) {
$exitstatus = exec("lokinet-vpn --status"); $exitstatus = exec("lokinet-vpn --status");
} else {
$exitstatus = "no exits";
}
$rulestate = exec("ip rule show default | grep lokinet | awk {'print $5'}", $output); $rulestate = exec("ip rule show default | grep lokinet | awk {'print $5'}", $output);
$lokiversion = exec("dpkg -s lokinet | grep '^Version:'", $output); $lokiversion = exec("dpkg -s lokinet | grep '^Version:'", $output);
?> ?>
@ -263,10 +267,10 @@ function DisplayLokinetConfig()
<input type="text" class="form-control" placeholder="enter exit key here" id="exitkey" name="exitkey"> <input type="text" class="form-control" placeholder="enter exit key here" id="exitkey" name="exitkey">
<br/> <br/>
<?php <?php
if ($exitstatus == "no exits") { if ($exitstatus != "no exits") {
echo '<input type="submit" class="btn btn-success" name="StartExit" value="Start Exit" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopExit" value="Stop Exit" />' , PHP_EOL; echo '<input type="submit" class="btn btn-danger" name="StopExit" value="Stop Exit" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-success" name="StartExit" value="Start Exit" />' , PHP_EOL;
} }
if ($lokinetstatus[0] == 0) { if ($lokinetstatus[0] == 0) {
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL; echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL;
@ -365,7 +369,8 @@ function ActivateLokinetConfig()
//STOP //STOP
} elseif (isset($_POST['StopDaemon'])) { } 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(); DisplayLokinetConfig();
//START EXIT //START EXIT

@ -40,6 +40,15 @@ function RPiVersion() {
'a220a0' => 'Compute Module 3', 'a220a0' => 'Compute Module 3',
'a020a0' => 'Compute Module 3', 'a020a0' => 'Compute Module 3',
'a02100' => '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 //Orange Pi Boards
'orpi' => 'Orange Pi', 'orpi' => 'Orange Pi',
'orpizero' => 'Orange Pi Zero', 'orpizero' => 'Orange Pi Zero',

@ -10,9 +10,9 @@
* php5-cgi (I have version 5.4.4-12 installed via apt) * php5-cgi (I have version 5.4.4-12 installed via apt)
* along with their supporting packages, php5 will also need to be enabled. * along with their supporting packages, php5 will also need to be enabled.
* *
* @author TechnicalTumbleweed (Loki->Discord/Telegram) * @author TechnicalTumbleweed (Oxen-> Session Lokinet/Telegram Oxen Community)
* @license GNU General Public License, version 3 (GPL-3.0) * @license GNU General Public License, version 3 (GPL-3.0)
* @version 2.4 * @version 2.5
* @link https://github.com/necro-nemesis/LabyrinthAP * @link https://github.com/necro-nemesis/LabyrinthAP
*/ */

@ -1,34 +1,40 @@
raspap_dir="/etc/raspap" raspap_dir="/etc/raspap"
raspap_user="www-data" raspap_user="www-data"
webroot_dir="/var/www/html" webroot_dir="/var/www/html"
version=`sed 's/\..*//' /etc/debian_version` version=$(lsb_release -sc)
# Determine version, set default home location for lighttpd and # Determine version, set default home location for lighttpd and
# php package to install # php package to install
if [ $version -eq 11 ]; then if [ $version = "bullseye" ]; then
version_msg="11.0 (Bullseye)" version_msg="11.0 (Bullseye)"
sudo apt update --allow-releaseinfo-change # sudo apt update --allow-releaseinfo-change
php_package="php7.4-cgi" php_package="php7.4-cgi"
elif [ $version -eq 10 ]; then elif [ $version = "buster" ]; then
version_msg="10.0 (Buster)" version_msg="10.0 (Buster)"
php_package="php7.3-cgi" php_package="php7.3-cgi"
elif [ $version -eq 9 ]; then elif [ $version = "stretch" ]; then
version_msg="9.0 (Stretch)" version_msg="9.0 (Stretch)"
php_package="php7.0-cgi" php_package="php7.0-cgi"
elif [ $version = "focal" ]; then
version_msg="20.02 (Focal)"
php_package="php7.4-cgi"
elif [ $version = "jammy" ]; then
version_msg="22.04 (Jammy)"
php_package="php8.1-cgi"
else else
version_msg="Unmatched version use php7.4" version_msg="Unmatched version use php7.4"
php_package="php7.4-cgi" php_package="php7.4-cgi"
fi fi
phpcgiconf="" 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" phpcgiconf="/etc/php/7.4/cgi/php.ini"
elif [ "$php_package" = "php7.3-cgi" ]; then elif [ "$php_package" = "php7.3-cgi" ]; then
phpcgiconf="/etc/php/7.3/cgi/php.ini" phpcgiconf="/etc/php/7.3/cgi/php.ini"
elif [ "$php_package" = "php7.0-cgi" ]; then elif [ "$php_package" = "php7.0-cgi" ]; then
phpcgiconf="/etc/php/7.0/cgi/php.ini" phpcgiconf="/etc/php/7.0/cgi/php.ini"
elif [ "$php_package" = "php5.6-cgi" ]; then
phpcgiconf="/etc/php5/cgi/php.ini"
fi fi
# Outputs a RaspAP Install log line # Outputs a RaspAP Install log line
@ -96,15 +102,18 @@ function install_dependencies() {
function common_interfaces() { function common_interfaces() {
if [ -f /boot/armbianEnv.txt ]; then 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" else install_log "Armbian undetected no patching required"
fi fi
} }
# This section no longer used but may retain value for patching service
function stop_lokinet(){ function stop_lokinet(){
install_log "stop lokinet and patch hostapd restart to service"
sudo systemctl stop lokinet.service sudo systemctl stop lokinet.service
#Set sed lokinet.service for Hostapd to restart everytime after Lokinet restarts #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 sudo systemctl daemon-reload
} }
@ -230,7 +239,7 @@ function move_config_file() {
function network_tables() { function network_tables() {
install_log "Selecting iptables or nftable rules" install_log "Selecting iptables or nftable rules"
if [ $version -lt 12 ]; then if [ $version != "future_requirement" ]; then
install_log "Use iptables" install_log "Use iptables"
sudo apt-get -y install iptables sudo apt-get -y install iptables
tablerouteA='iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' tablerouteA='iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP'
@ -326,7 +335,7 @@ function patch_system_files() {
"/sbin/wpa_cli -i wlan[0-9] scan_results" "/sbin/wpa_cli -i wlan[0-9] scan_results"
"/sbin/wpa_cli -i wlan[0-9] scan" "/sbin/wpa_cli -i wlan[0-9] scan"
"/sbin/wpa_cli -i wlan[0-9] reconfigure" "/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" "/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf"
"/etc/init.d/hostapd start" "/etc/init.d/hostapd start"
"/etc/init.d/hostapd stop" "/etc/init.d/hostapd stop"
@ -390,14 +399,9 @@ function optimize_php() {
sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf" sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf"
sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini" sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini"
echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: " echo -n "Enabling HttpOnly for session cookies "
read answer 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 [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then if [ "$php_package" = "php7.0-cgi" ]; 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]: " echo -n "Enable PHP OPCache? [Y/n]: "
read answer read answer
if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then
@ -406,11 +410,12 @@ function optimize_php() {
# Make sure opcache extension is turned on. # Make sure opcache extension is turned on.
if [ -f "/usr/sbin/phpenmod" ]; then if [ -f "/usr/sbin/phpenmod" ]; then
sudo phpenmod opcache sudo phpenmod opcache
echo -n "PHP OPCache enabled"
else else
install_warning "phpenmod not found." install_warning "phpenmod not found."
fi fi
fi fi
fi fi
} }
function install_complete() { function install_complete() {
@ -429,16 +434,17 @@ function install_complete() {
} }
function install_raspap() { function install_raspap() {
test_root_user
display_welcome display_welcome
config_installation config_installation
update_system_packages update_system_packages
install_dependencies install_dependencies
patch_lokinet_service
create_raspap_directories
common_interfaces common_interfaces
stop_lokinet
check_for_networkmananger check_for_networkmananger
optimize_php optimize_php
enable_php_lighttpd enable_php_lighttpd
create_raspap_directories
check_for_old_configs check_for_old_configs
download_latest_files download_latest_files
change_file_ownership change_file_ownership

@ -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 wget -q ${UPDATE_URL}/installers/common.sh -O /tmp/raspapcommon.sh
source /tmp/raspapcommon.sh && rm -f /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() { function update_system_packages() {
install_log "Updating sources" install_log "Updating sources"
sudo apt-get update || install_error "Unable to update package list" sudo apt-get update || install_error "Unable to update package list"
@ -19,12 +26,21 @@ 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" 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. #Remove NetworkManager and install dhcpd if required Armbian.
function check_for_networkmananger() { function check_for_networkmananger() {
install_log "Checking for NetworkManager" install_log "Checking for NetworkManager"
echo "Checking for Network Manager" 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" echo "Network Manager found. Replacing with DHCPCD"
sudo apt-get -y purge network-manager sudo apt-get -y purge network-manager
sudo apt-get -y install dhcpcd5 sudo apt-get -y install dhcpcd5

Loading…
Cancel
Save