Merge pull request #44 from necro-nemesis/master

Bring exit up to master branch
exit
necro-nemesis 3 years ago committed by GitHub
commit 232a3fb6d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,20 +1,20 @@
![](https://i.imgur.com/mXuacOH.jpg)
![](https://i.imgur.com/2ZrhaiH.png)
# `$ Lokiap-webgui` [![Release 1.9](https://img.shields.io/badge/Release-1.9-green.svg)](https://github.com/necro-nemesis/raspap-webgui/releases)
# `LabyrinthAP / Lokinet Access Point` [![Release 2.6](https://img.shields.io/badge/Release-2.6-green.svg)](https://github.com/necro-nemesis/raspap-webgui/releases)
LokiAP interfaces witht Lokinet daemon to facilitate connections to the Lokinet global privacy network. LokiAP 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.
### WHAT IS LOKI?
### WHAT IS LOKINET?
https://loki.network/
https://lokinet.org/
"Loki is a privacy network which will allow users to transact and communicate privately over the internet, providing a suite of tools to help maintain the maximum amount of anonymity possible while browsing, transacting and communication online. Using the decentralised nature of blockchain technology, Loki creates new private and secure methods of interacting with the internet, as well as building privacy-centric applications, such as messaging services, forums, online marketplaces, and social media platforms."
Lokinet is a privacy network which allows users to transact and communicate privately over the internet infrastructure using it's own onion routing network, encryption system and protocols. Lokinet requires no internet IP Address but instead provides it's own network addresses which can be either ephemeral, persistent or personalized depending on the users desired application. Information is onion routed through a globally distributed network of over one thousand nodes. Utilizing blockchain technology Lokinet is run on incentivized decentralized nodes that are paid by the network to maintain the privacy and decentralized aspects of the network. User need not pay for access to use Lokinet but may chose to subscribe to an exit provider should they wish to anonymously access the internet through such a provider. Additionally the network generally has free exit nodes available offered through individuals providing volunteerary support of the network.
Loki
LabyrinthAP is currently offered as a free software solution that runs Lokinet on a remote network connected device which creates a WiFi hostspot and/or Ethernet subnet to connect to Lokinet. Using LabyrinthAP not only ensures Lokinet is always connected and available but removes the requirement for installation on a single or group of end point devices. LabyrinthAP makes Lokinet platform agnostic meaning it can connect to a range of devices regardless of the type of hardware or software installed on them. LabyrinthAP is compatible with most web based applications and browsers and has a built in web based interface to manage and control.
![](https://i.imgur.com/fxKF4bi.jpg)
LabyrinthAP comes with it's own auto-installation scripts to set up Lokinet and the LabyrinthAP interface thereby providing an easy to create access point on very commonly available single board computer devices such as the Rapsberry Pi using Raspberry OS. It also supports device running Armbian such as the OrangePiR1 or OrangePi Zero + etc.
![](https://i.imgur.com/zdPU3Yj.png)
![](https://i.imgur.com/IbksKgc.png)
![](https://i.imgur.com/F83n7PF.jpg)
@ -26,18 +26,21 @@ Loki
- [Quick installer](#quick-installer)
- [Test Site](#test-site)
- [Connecting to an Exit Node](#connecting-to-an-exit-node)
- [Waveshare 4G Mobile Pi Hat](#waveshare-4G-mobile-pi-hat)
- [Support us](#support-us)
- [How to contribute](#how-to-contribute)
- [License](#license)
## Prerequisites
Start with a clean install of [Armbian](https://www.armbian.com/) or [Raspberry Pi OS](https://www.raspberrypi.org/downloads/raspberry-pi-os/) (currently Buster and Stretch are verified as working). Lite versions are recommended as all additional dependencies are added by the installer. If using Raspberry Pi OS you will need to elevate to root with ```sudo su``` before running the LokiAP installer script. This additional step is not required when using Armbian.
Start with a clean install of [Armbian](https://www.armbian.com/) or [Raspberry Pi OS](https://www.raspberrypi.org/downloads/raspberry-pi-os/) When using Armbian currently Bullseye and Buster are verified as working on OrangePi's and Armbian Focal CLI for Raspberry Pi. When using Raspberry Pi OS Buster lite is recommended. Lite versions are also recommended as all additional dependencies are added by the installer. If using Raspberry Pi OS you will need to elevate to root with ```sudo su``` before running the LabyrinthAP installer script. This additional step is not required when using Armbian.
For Orange Pi R1 use Armbian Buster found here: https://www.armbian.com/orange-pi-r1/. Recommend using "minimal" which is available for direct download at the bottom of the page or much faster download by .torrent also linked there.
For Raspberry Pi 4 use Armbian Focal found here: https://www.armbian.com/rpi4b/. Recommend using "cli" mininal version which is available for direct download at the bottom of the page or much faster download by .torrent also linked there.
For Orange Pi R1 use Armbian Bullseye found here: https://www.armbian.com/orange-pi-r1/. Recommend using "minimal" which is available for direct download at the bottom of the page or much faster download by .torrent also linked there.
Specific code has been incorporated to take advantage of the OrangePi R1's second ethernet interface. The AP will provide access via ethernet in addition to wifi when using this board.
For OrangePi Zero use Armbian Buster found here": https://www.armbian.com/orange-pi-zero/
For OrangePi Zero use Armbian Bullseye found here": https://www.armbian.com/orange-pi-zero/
Note:
@ -68,51 +71,64 @@ https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
3. Follow any first user password instructions provided once logged in.
4. If you want to get the lastest updates before installing LokiAP:
4. If you want to get the lastest updates before installing LabyrinthAP:
```
sudo apt-get update
sudo apt-get upgrade
sudo reboot
```
5. If you have an older Raspberry Pi without an onboard WiFi chipset, the [**Edimax Wireless 802.11b/g/n nano USB adapter**](https://www.edimax.com/edimax/merchandise/merchandise_detail/data/edimax/global/wireless_adapters_n150/ew-7811un) is an excellent option it's small, cheap and has good driver support.
5. Before installing the LabyrinthAP on the Raspberry pi you must log in to the shell prompt and set your WiFi "Localization Options" to the country code you are in. If this is not set WiFi will not be available on the Rasberry pi. Additionally if you are using the LabyrinthAP with a SIMCOM chip based mobile adapter for cellular connection to the net you will need to go into Interface Options -> serial -> answer "NO" when asked if you want login shell over serial and then answer "YES" when asked if you want the serial port hardware enabled. In order to set these options enter `sudo raspi-config` at the command line and use the menu to get to these settings. When exiting and asked to reboot answer yes and reboot for the settings to be enabled.
With the prerequisites done, you can now proceed with the Quick installer.
## Quick installer
Install LokiAP from shell prompt:
Install LabyrinthAP from shell prompt:
```sh
$ wget -q https://git.io/fjeSw -O /tmp/raspap && bash /tmp/raspap
wget -q https://git.io/fjeSw -O /tmp/raspap && bash /tmp/raspap
```
The installer will complete the installation steps for you. You will be occasionally prompted to answer `y` or `n`. Answering yes to all prompts will in almost all cases be the answer you want so if in doubt respond with `y` that you want the default set up and the AP will work.
After the reboot at the end of the installation the wireless network will be
configured as an access point as follows:
* AP GUI address: loki.ap.local or use IP address: 10.3.141.1
* AP GUI address: http://loki.ap.local or use IP address: 10.3.141.1
* Username: `admin`
* Password: `secret`
* DHCP range: 10.3.141.1 to 10.3.141.24
* SSID: `loki-access`
* SSID: `LabyrinthAP`
* Password: `ChangeMe`
## Test site
To test the connection navigate to Loki's wiki page found at
To test the connection navigate to Lokinet's wiki page found at
http://dw68y1xhptqbhcm5s8aaaip6dbopykagig5q5u1za4c7pzxto77y.loki/wiki/index.php?title=Main_Page
You can also access this page using it's ONS (Oxen Name Service) registered domain name at
http://probably.loki
## Connecting to an Exit Node
Exit nodes provide privacy on the internet through onion routing connections via the global network of Lokinet relay nodes and dedicated exit nodes. In order to connect to an exit node you will require the exit address from the exit node provider. These can be found through various social media linked at https://loki.network/. From the GUI this information can be entered and activated.
## Waveshare 4G Mobile Pi HAT
If you have a Waveshare 4G/3G/2G/GSM/GPRS/GNSS HAT for the Raspberry Pi the access point has built in support for it to use cellular data. When installed if Ethernet is available the access point will connect over Ethernet. If you wish to use cellular then booting without an Ethernet connection the access point will automatically switch over to cellular and connect to your provider. You will need to obtain a SIM card and it's APN address from your local cellular service provider. The APN addresses are usually obtainable with a quick online search. Once the software is installed you will need to navigate to the "Mobile APN" tab in the GUI under "Configure Lokinet" and enter in your APN address, set it and then reboot. It will now be saved for future use of the adapter.
![](https://i.imgur.com/eD82qCT.png)
![](https://i.imgur.com/feaC56c.png)
## Support us
LokiAP is free software, but powered by your support. If you find it beneficial or wish to contribute to inspire ongoing development your donations of any amount; be they even symbolic, are a show of approval and are greatly appreciated.
LabyrinthAP is free software but powered by your support. If you find it beneficial or wish to contribute to inspire ongoing development small donations are greatly appreciated.
Loki Donation Address:
- Oxen Donation Address:
```sh
LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh
```
- Donation Wallets
![](https://i.imgur.com/HGVuijh.jpg) ![](https://i.imgur.com/6dMgBVr.jpg) ![](https://i.imgur.com/gIhGB1X.jpg)
## How to contribute
1. File an issue in the repository, using the bug tracker, describing the

@ -10,7 +10,7 @@ require dhcp_server_identifier
slaac private
nohook lookup-hostname
# LokiAP-WebGui wireless configuration
# LabyrinthAP wireless configuration
{
interface wlan0
static ip_address=10.3.141.1/24

@ -1,12 +1,10 @@
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
auth_algs=1
wpa_key_mgmt=WPA-PSK
beacon_int=100
ssid=loki-access
ssid=LabyrinthAP
channel=6
hw_mode=g
ieee80211n=1
@ -27,7 +25,7 @@ ignore_broadcast_ssid=0
#beacon_int=100
#auth_algs=1
#wpa_key_mgmt=WPA-PSK
#ssid=loki-access
#ssid=LabyrinthAP
#channel=1
#hw_mode=g
#wpa_passphrase=ChangeMe

Binary file not shown.

@ -38,8 +38,15 @@ bootstrap)
;;
exitup)
if [ "$3" = "" ]; then
lokinet-vpn --up --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
;;
exitdown)
@ -47,6 +54,11 @@ exitdown)
lokinet-vpn --down
;;
whois)
echo -n "LNS Registration Information\n\n"
whois -h public.loki.foundation "$2"
;;
*)
echo "Usage: "$1" {start|stop|gen|bootstrap|exitup|exitdown}"
exit 1

@ -0,0 +1,16 @@
#!/bin/sh
# 4G
sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online' # power on module
# configure raw-ip protocol
sudo ip link set wwan0 down
echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
sudo ip link set wwan0 up
# connect to carrier
sudo qmicli -p -d /dev/cdc-wdm0 --wds-start-network="apn='your.apn.here',ip-type=4" --client-no-release-cid
# set default rout and IP
sudo udhcpc -i wwan0
# receive DHCP lease from network
ip a s wwan0
exit 0

@ -5,7 +5,7 @@
html * {
font-family: Arial, Andale Mono, monospace;
font-size: 10pt;
color: #33ff00;
color: #609aac;
background-color: #252525;
}
@ -27,12 +27,12 @@ html * {
}
.panel-primary {
border-color: #33ff00;
border-color: #609aac;
background-color: #0C1309;
}
.panel-primary>.panel-heading {
border-color: #33ff00;
border-color: #609aac;
background-color: #0C1309;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

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

@ -282,7 +282,7 @@ function DisplayWPAConfig(){
</form>
</div><!-- ./ Panel body -->
<div class="panel-footer"><?php echo _("<strong>Note:</strong> WEP access points appear as 'Open'. LokiAP does not currently support connecting to WEP"); ?></div>
<div class="panel-footer"><?php echo _("<strong>Note:</strong> WEP access points appear as 'Open'. LabyrinthAP does not currently support connecting to WEP"); ?></div>
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->

@ -4,23 +4,25 @@
function mask2cidr($mask)
{
$long = ip2long($mask);
$base = ip2long('255.255.255.255');
return 32-log(($long ^ $base)+1, 2);
$base = ip2long("255.255.255.255");
return 32 - log(($long ^ $base) + 1, 2);
}
/* Functions to write ini files */
function write_php_ini($array, $file)
{
$res = array();
$res = [];
foreach ($array as $key => $val) {
if (is_array($val)) {
$res[] = "[$key]";
foreach ($val as $skey => $sval) {
$res[] = "$skey = ".(is_numeric($sval) ? $sval : '"'.$sval.'"');
$res[] =
"$skey = " .
(is_numeric($sval) ? $sval : '"' . $sval . '"');
}
} else {
$res[] = "$key = ".(is_numeric($val) ? $val : '"'.$val.'"');
$res[] = "$key = " . (is_numeric($val) ? $val : '"' . $val . '"');
}
}
if (safefilerewrite($file, implode("\r\n", $res))) {
@ -32,15 +34,15 @@ function write_php_ini($array, $file)
function safefilerewrite($fileName, $dataToSave)
{
if ($fp = fopen($fileName, 'w')) {
if ($fp = fopen($fileName, "w")) {
$startTime = microtime(true);
do {
$canWrite = flock($fp, LOCK_EX);
// If lock not obtained sleep for 0 - 100 milliseconds, to avoid collision and CPU load
if (!$canWrite) {
usleep(round(rand(0, 100)*1000));
usleep(round(rand(0, 100) * 1000));
}
} while ((!$canWrite)and((microtime(true)-$startTime) < 5));
} while (!$canWrite and microtime(true) - $startTime < 5);
//file was locked so now we can store information
if ($canWrite) {
@ -54,145 +56,174 @@ function safefilerewrite($fileName, $dataToSave)
}
}
//Function to get string between used for Mobile.sh
function get_string_between($string, $start, $end)
{
$string = " " . $string;
$ini = strpos($string, $start);
if ($ini == 0) {
return "";
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
/**
*
* Add CSRF Token to form
*
*/
*
* Add CSRF Token to form
*
*/
function CSRFToken()
{
?>
<input id="csrf_token" type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token'], ENT_QUOTES);
; ?>" />
<input id="csrf_token" type="hidden" name="csrf_token" value="<?php echo htmlspecialchars(
$_SESSION["csrf_token"],
ENT_QUOTES
); ?>" />
<?php
}
/**
*
* Validate CSRF Token
*
*/
*
* Validate CSRF Token
*
*/
function CSRFValidate()
{
if (hash_equals($_POST['csrf_token'], $_SESSION['csrf_token'])) {
if (hash_equals($_POST["csrf_token"], $_SESSION["csrf_token"])) {
return true;
} else {
error_log('CSRF violation');
error_log("CSRF violation");
return false;
}
}
/**
* Test whether array is associative
*/
* Test whether array is associative
*/
function isAssoc($arr)
{
return array_keys($arr) !== range(0, count($arr) - 1);
}
/**
*
* Display a selector field for a form. Arguments are:
* $name: Field name
* $options: Array of options
* $selected: Selected option (optional)
* If $options is an associative array this should be the key
*
*/
*
* Display a selector field for a form. Arguments are:
* $name: Field name
* $options: Array of options
* $selected: Selected option (optional)
* If $options is an associative array this should be the key
*
*/
function SelectorOptions($name, $options, $selected = null, $id = null)
{
echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'"';
echo '<select class="form-control" name="' .
htmlspecialchars($name, ENT_QUOTES) .
'"';
if (isset($id)) {
echo ' id="' . htmlspecialchars($id, ENT_QUOTES) .'"';
echo ' id="' . htmlspecialchars($id, ENT_QUOTES) . '"';
}
echo '>' , PHP_EOL;
echo ">", PHP_EOL;
foreach ($options as $opt => $label) {
$select = '';
$select = "";
$key = isAssoc($options) ? $opt : $label;
if ($key == $selected) {
$select = ' selected="selected"';
}
echo '<option value="'.htmlspecialchars($key, ENT_QUOTES).'"'.$select.'>'.
htmlspecialchars($label, ENT_QUOTES).'</option>' , PHP_EOL;
echo '<option value="' .
htmlspecialchars($key, ENT_QUOTES) .
'"' .
$select .
">" .
htmlspecialchars($label, ENT_QUOTES) .
"</option>",
PHP_EOL;
}
echo '</select>' , PHP_EOL;
echo "</select>", PHP_EOL;
}
/**
*
* @param string $input
* @param string $string
* @param int $offset
* @param string $separator
* @return $string
*/
*
* @param string $input
* @param string $string
* @param int $offset
* @param string $separator
* @return $string
*/
function GetDistString($input, $string, $offset, $separator)
{
$string = substr($input, strpos($input, $string)+$offset, strpos(substr($input, strpos($input, $string)+$offset), $separator));
$string = substr(
$input,
strpos($input, $string) + $offset,
strpos(substr($input, strpos($input, $string) + $offset), $separator)
);
return $string;
}
/**
*
* @param array $arrConfig
* @return $config
*/
*
* @param array $arrConfig
* @return $config
*/
function ParseConfig($arrConfig)
{
$config = array();
$config = [];
foreach ($arrConfig as $line) {
$line = trim($line);
if ($line != "" && $line[0] != "#") {
$arrLine = explode("=", $line);
$config[$arrLine[0]] = (count($arrLine) > 1 ? $arrLine[1] : true);
$config[$arrLine[0]] = count($arrLine) > 1 ? $arrLine[1] : true;
}
}
return $config;
}
/**
*
* @param string $freq
* @return $channel
*/
*
* @param string $freq
* @return $channel
*/
function ConvertToChannel($freq)
{
if ($freq >= 2412 && $freq <= 2484) {
$channel = ($freq - 2407)/5;
$channel = ($freq - 2407) / 5;
} elseif ($freq >= 4915 && $freq <= 4980) {
$channel = ($freq - 4910)/5 + 182;
$channel = ($freq - 4910) / 5 + 182;
} elseif ($freq >= 5035 && $freq <= 5865) {
$channel = ($freq - 5030)/5 + 6;
$channel = ($freq - 5030) / 5 + 6;
} else {
$channel = -1;
}
if ($channel >= 1 && $channel <= 196) {
return $channel;
} else {
return 'Invalid Channel';
return "Invalid Channel";
}
}
/**
* Converts WPA security string to readable format
* @param string $security
* @return string
*/
* Converts WPA security string to readable format
* @param string $security
* @return string
*/
function ConvertToSecurity($security)
{
$options = array();
preg_match_all('/\[([^\]]+)\]/s', $security, $matches);
$options = [];
preg_match_all("/\[([^\]]+)\]/s", $security, $matches);
foreach ($matches[1] as $match) {
if (preg_match('/^(WPA\d?)/', $match, $protocol_match)) {
if (preg_match("/^(WPA\d?)/", $match, $protocol_match)) {
$protocol = $protocol_match[1];
$matchArr = explode('-', $match);
$matchArr = explode("-", $match);
if (count($matchArr) > 2) {
$options[] = htmlspecialchars($protocol . ' ('. $matchArr[2] .')', ENT_QUOTES);
$options[] = htmlspecialchars(
$protocol . " (" . $matchArr[2] . ")",
ENT_QUOTES
);
} else {
$options[] = htmlspecialchars($protocol, ENT_QUOTES);
}
@ -203,24 +234,32 @@ function ConvertToSecurity($security)
// This could also be WEP but wpa_supplicant doesn't have a way to determine
// this.
// And you shouldn't be using WEP these days anyway.
return 'Open';
return "Open";
} else {
return implode('<br />', $options);
return implode("<br />", $options);
}
}
/**
*
*
*/
*
*
*/
/*LOKINET FUNCTIONS ADDED HERE*/
function DisplayLokinetConfig()
{
exec('pidof lokinet | wc -l', $lokinetstatus);
$rulestate = exec("ip rule show default | grep lokinet | awk {'print $5'}", $output);
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);
?>
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
@ -231,146 +270,143 @@ function DisplayLokinetConfig()
<ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">Exit Node Settings</a>
</li>
<li><a href="#daemon" data-toggle="tab">Daemon Settings</a>
<li><a href="#Mobile" data-toggle="tab">Mobile APN</a>
</li>
<li><a href="#whois" data-toggle="tab">WHOIS</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-content">
<p><?php echo $status; ?></p>
<p><?php echo "Current Lokinet $lokiversion"; ?></p>
<div class="tab-pane fade in active" id="basic">
<div class="tab-pane fade in active" id="basic">
<form role="form" action="?page=save_hostapd_conf" method="POST">
<h5>Enter Exit Node Data to activate:</h5>
<h5>Enter Exit Node Data to activate:</h5>
<label for="exitaddress">Exit Address:</label>
<input type="text" class="form-control" placeholder="enter exit address here" id="exitaddress" name="exitaddress">
<label for="exitkey">Exit Key: (optional)</label>
<input type="text" class="form-control" placeholder="enter exit key here" id="exitkey" name="exitkey">
<br/>
<?php
GLOBAL $exitstatus;
if ($exitstatus == FALSE) {
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;
}
if ($lokinetstatus[0] == 0) {
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopDaemon" value="Stop Daemon" />' , PHP_EOL;
} ?><h5><?php echo _("Your development support is greatly appreciated | Loki Address:"); ?></h5>
<h5><pre><?php echo _("LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"); ?></pre></h5>
</div>
<div class="tab-pane fade" id="daemon">
<h4>Lokient Daemon</h4>
<div class="row">
<div class="col-lg-12">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#instruct">Instructions</button>
<div id="instruct" class="collapse">The 3 buttons below must be armed (red) to connect to Lokinet. If there isn't a current lokinet.ini file found on the system the "Generate.ini" button will be green. The .ini file must be generated prior to connecting to Lokinet by pressing the button which will automatically write the required .ini file. Similarly the absense of a valid bootstrap will be indicated by a green "Bootstrap" button. Applying a bootstrap by pressing the apply button without submitting a valid URL in the textbox area will apply the original default bootstrap in place of one being provided. Stopping the daemon also exits Lokinet. To summarize, if necessary generate the .ini and bootstrap Lokinet then you are able to connect to Lokinet by starting the daemon and letting the network establish itself.
</div>
<div class="row">
<div class="form-group col-lg-12">
<h5>Enter a valid bootstrap url below and apply to overwrite the current bootstrap:</h5>
<label for="lokinetbootstrap">Bootstrap url:</label>
<input type="url" class="form-control" placeholder="https://seed.lokinet.org/lokinet.signed" id="lokinetbootstrap" name="lokinetbootstrap">
<br/>
<?php
$filename = '/var/lib/lokinet/lokinet.ini';
if ($lokinetstatus[0] == 0) {
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopDaemon" value="Stop Daemon" />' , PHP_EOL;
}
if (file_exists($filename)) {
echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-success" name="GenerateLokinet" value="Generate .ini" />' , PHP_EOL;
} ?>
<input type="submit" class="btn btn-danger" name="ApplyLokinetSettings" value="Re-Bootstrap" />
<h5><?php echo _("Your development support is greatly appreciated | Loki Address:"); ?></h5>
<h5><pre><?php echo _("LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"); ?></pre></h5>
</form>
</div>
</div>
</div>
</div>
</div>
</div><!-- /.tab-content -->
</div><!-- /.panel-body -->
<div class="panel-footer">Contact Loki user groups on Session to obtain Exit Access</div>
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
if ($exitstatus != "no exits") {
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) {
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />', PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopDaemon" value="Stop Daemon" />', PHP_EOL;
}
?><h5><?php echo "Your development support is greatly appreciated <br>Independent LabyrinthAP developer TechnicalTumbleweed's OXEN wallet address:"; ?></h5>
<h5><pre><?php echo "LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"; ?></pre></h5>
</div>
<div class="tab-pane fade" id="Mobile">
<form role="form" action="?page=save_hostapd_conf" method="POST">
<h5>Enter mobile provider apn:</h5>
<label for="apn">Mobile Provider APN:</label>
<input type="text" class="form-control" placeholder="enter apn address here" id="apn" name="apn">
<br/>
<?php echo '<input type="submit" class="btn btn-success" name="apnaddress" value="Set APN" />',
PHP_EOL; ?><h5><?php echo "Your development support is greatly appreciated <br>Independent LabyrinthAP developer TechnicalTumbleweed's OXEN wallet address:"; ?></h5>
<h5><pre><?php echo "LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"; ?></pre></h5>
</div>
<div class="tab-pane fade" id="whois">
<form role="form" action="?page=save_hostapd_conf" method="POST">
<h5>Enter .loki Address:</h5>
<label for="lokiaddress">Loki Address:</label>
<input type="text" class="form-control" placeholder="enter lokinet address here" id="lokiaddress" name="lokiaddress">
<br/>
<?php echo '<input type="submit" class="btn btn-success" name="checkaddress" value="Submit" />',
PHP_EOL; ?><h5><?php echo "Your development support is greatly appreciated <br>Independent LabyrinthAP developer TechnicalTumbleweed's OXEN wallet address:"; ?></h5>
<h5><pre><?php echo "LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"; ?></pre></h5>
</div>
<?php
}
/**
*
*
*/
function ActivateLokinetConfig()
{
/* Lokinet script commands start HERE
/* Lokinet script commands start HERE
////
//// LOKINET
////
//*/
//START
if (isset($_POST['StartDaemon'])) {
exec('sudo /var/lib/lokinet/lokilaunch.sh start');
//STOP
} elseif (isset($_POST['StopDaemon'])) {
exec('sudo /var/lib/lokinet/lokilaunch.sh stop');
//START EXIT
} elseif (isset($_POST['StartExit'])) {
$exit = $_POST['exitaddress'];
$token = $_POST['exitkey'];
$exit=str_replace("'", "", $exit);
$token=str_replace("'", "", $token);
$output = shell_exec("sudo /var/lib/lokinet/lokilaunch.sh exitup '".$exit."''" .$token."'");
if (isset($_POST["StartDaemon"])) {
exec("sudo /var/lib/lokinet/lokilaunch.sh start");
DisplayLokinetConfig();
//STOP
} elseif (isset($_POST["StopDaemon"])) {
exec("sudo /var/lib/lokinet/lokilaunch.sh exitdown");
exec("sudo /var/lib/lokinet/lokilaunch.sh stop");
DisplayLokinetConfig();
//START EXIT
} elseif (isset($_POST["StartExit"])) {
$exit = $_POST["exitaddress"];
$token = $_POST["exitkey"];
$exit = str_replace("'", "", $exit);
$token = str_replace("'", "", $token);
$output = shell_exec(
"sudo /var/lib/lokinet/lokilaunch.sh exitup '" .
$exit .
"' '" .
$token .
"'"
);
$exitstatus = exec("lokinet-vpn --status");
if ($exitstatus != "no exits") {
?><div class="alert alert-info"><?php
echo "Exit Enabled";
?></div><?php
} else {
?><div class="alert alert-danger"><?php
echo "WARNING EXIT DID NOT CONNECT";
?></div><?php
}
echo "<pre><strong>$output</strong></pre>";
GLOBAL $exitstatus;
$exitstatus = TRUE;
//STOP EXIT
} elseif (isset($_POST['StopExit'])) {
exec ('sudo /var/lib/lokinet/lokilaunch.sh exitdown');
GLOBAL $exitstatus;
$exitstatus = FALSE;
//GENERATE LOKINET.INI
} elseif (isset($_POST['GenerateLokinet'])) {
?>
<div class="alert alert-success">
Generating Lokinet Configuration
</div>
<?php
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh gen');
echo "<pre><strong>$output</strong></pre>";
//REGENERATE LOKINET.INI
} elseif (isset($_POST['ReGenerateLokinet'])) {
?>
<div class="alert alert-success">
Regenerating Lokinet Configuration
</div>
<?php
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh gen');
?><form method="post"><?php
echo '<input type="submit" class="btn btn-success" name="Return" value="Return" />', PHP_EOL;
echo "\n";
?><form><br/><?php
//STOP EXIT
} elseif (isset($_POST["StopExit"])) {
exec("sudo /var/lib/lokinet/lokilaunch.sh exitdown");
DisplayLokinetConfig();
//WHOIS
} elseif (isset($_POST["checkaddress"])) {
$address = $_POST["lokiaddress"];
$output = shell_exec("sudo /var/lib/lokinet/lokilaunch.sh whois " . $address . "");
echo "<pre><strong>$output</strong></pre>";
//APPLY LOKINET-BOOTSTRAP
} elseif (isset($_POST['ApplyLokinetSettings'])) {
$bootstrap = $_POST['lokinetbootstrap'];
$bootstrap=str_replace("'", "", $bootstrap);
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh bootstrap '.$bootstrap.'');
$output = preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $output);
echo "<pre><strong>$output</strong></pre>";
}
DisplayLokinetConfig();
?><form method="post"><?php
echo '<input type="submit" class="btn btn-success" name="Return" value="Return" />', PHP_EOL;
echo "\n";
?><form><br/><?php
//Mobile
} elseif (isset($_POST["apnaddress"])) {
$apnvalue = $_POST["apn"];
$file = "/var/lib/lokinet/mobile.sh";
$input = file_get_contents($file);
$parsed = get_string_between($input, "apn='", "',ip");
$output = str_replace($parsed, $apnvalue, $input);
file_put_contents($file, $output);
echo "<pre><strong>Reboot required to start mobile. Reboot now?</strong></pre>";
?><form method="post"><?php
echo '<input type="submit" class="btn btn-success" name="Return" value="Reboot Later" />', PHP_EOL;
echo '<input type="submit" class="btn btn-success" name="Reboot" value="Activate Now" />', PHP_EOL;
echo "\n";
?><form><br/><?php
} elseif (isset($_POST["Return"])) {
DisplayLokinetConfig();
} elseif (isset($_POST["Reboot"])) {
shell_exec("sudo reboot now");
}
}
?>

@ -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',

@ -37,7 +37,7 @@ function DisplayThemeConfig(){
<div class="form-group col-md-6">
<label for="code"><?php echo _("Select a theme"); ?></label>
<select class="form-control" id="theme-select"><?php echo _("Select a Theme"); ?>
<option value="default" class="theme-link"<?php echo $cselected; ?>>LokiAP (default)</option>
<option value="default" class="theme-link"<?php echo $cselected; ?>>LabyrinthAP (default)</option>
<option value="hackernews" class="theme-link"<?php echo $hselected; ?>>HackerNews</option>
<option value="terminal" class="theme-link"<?php echo $tselected; ?>>Terminal</option>
</select>

@ -10,10 +10,10 @@
* php5-cgi (I have version 5.4.4-12 installed via apt)
* 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)
* @version 1.9
* @link https://github.com/necro-nemesis/Lokiap-webgui
* @version 2.6
* @link https://github.com/necro-nemesis/LabyrinthAP
*/
session_start();
@ -62,7 +62,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo _("LokiAP"); ?></title>
<title><?php echo _("LabyrinthAP"); ?></title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
@ -105,7 +105,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php"style="font-family: Arial;font-size: 20px; color: #33ff00"><?php echo _("LokiAP Mixnet Portal"); ?> v<?php echo RASPI_VERSION; ?></a>
<a class="navbar-brand" href="index.php"style="font-family: Arial;font-size: 20px; color: #609aac"><?php echo _("LabyrinthAP Mixnet Portal"); ?> v<?php echo RASPI_VERSION; ?></a>
</div>
<!-- /.navbar-header -->
@ -172,7 +172,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
<img class="logo" src="img/raspAP-logo.png" width="45" height="45">LokiAP
<img class="logo" src="img/raspAP-logo.png" width="45" height="45">LabyrinthAP
</h1>
</div>
</div><!-- /.row -->

@ -1,43 +1,50 @@
raspap_dir="/etc/raspap"
raspap_user="www-data"
webroot_dir="/var/www/html"
version=`sed 's/\..*//' /etc/debian_version`
version=$(lsb_release -sc)
# Determine version, set default home location for lighttpd and
# php package to install
if [ $version -eq 10 ]; then
if [ $version = "bullseye" ]; then
version_msg="11.0 (Bullseye)"
# sudo apt update --allow-releaseinfo-change
php_package="php7.4-cgi"
elif [ $version = "buster" ]; then
version_msg="10.0 (Buster)"
sudo apt update --allow-releaseinfo-change
php_package="php7.3-cgi"
elif [ $version -eq 9 ]; then
elif [ $version = "stretch" ]; then
version_msg="9.0 (Stretch)"
php_package="php7.0-cgi"
elif [ $version -eq 8 ]; then
version_msg="8.0 (Jessie)"
php_package="php5.6-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
version_msg="Earlier than 8.0 (Wheezy)"
webroot_dir="/var/www"
php_package="php5.6-cgi"
version_msg="Unmatched version use php7.4"
php_package="php7.4-cgi"
fi
phpcgiconf=""
if [ "$php_package" = "php7.3-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
function install_log() {
echo -e "\033[1;32mLokiAP Install: $*\033[m"
echo -e "\033[1;32mLabyrinthAP Install: $*\033[m"
}
# Outputs a RaspAP Install Error log line and exits with status code 1
function install_error() {
echo -e "\033[1;37;41mLokiAP Install Error: $*\033[m"
echo -e "\033[1;37;41mLabyrinthAP Install Error: $*\033[m"
exit 1
}
@ -49,16 +56,16 @@ function install_warning() {
# Outputs a welcome message
function display_welcome() {
raspberry='\033[0;35m'
green='\033[1;32m'
echo -e "${green}\n"
echo -e " ooooo oooo o8o .o. ooooooooo."
echo -e " 888 888 .888. 888 Y88."
echo -e " 888 .ooooo. 888 oooo oooo .8 888. 888 .d88"
echo -e " 888 d88 88b 888 .8P 888 .8 888. 888ooo88P"
echo -e " 888 888 888 888888. 888 .88ooo8888. 888"
echo -e " 888 o 888 888 888 88b. 888 .8 888. 888"
echo -e " o888ooooood8 Y8bod8P o888o o888o o888o o88o o8888o o888o"
cyan='\033[1;36m'
echo -e "${cyan}\n"
echo -e " _ _ _ _ _ _ ____ "
echo -e " | | __ _| |__ _ _ _ __(_)_ __ | |_| |__ / \ | _ \ "
echo -e " | | / _ | _ \| | | | __| | _ \| __| _ \ / _ \ | |_) | "
echo -e " | |__| (_| | |_) | |_| | | | | | | | |_| | | |/ ___ \| __/ "
echo -e " |_____\__,_|_.__/ \__, |_| |_|_| |_|\__|_| |_/_/ \_\_| "
echo -e " |___/ "
echo -e " by Minotaurware.net"
echo -e "${raspberry}"
echo -e "The Quick Installer will guide you through a few easy steps\n\n"
}
@ -95,13 +102,19 @@ 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
}
# 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
#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
sudo systemctl daemon-reload
}
# Replaces NetworkManager with DHCPD
@ -122,7 +135,7 @@ function enable_php_lighttpd() {
# Verifies existence and permissions of RaspAP directory
function create_raspap_directories() {
install_log "Creating LokiAP directories"
install_log "Creating LabyrinthAP directories"
if [ -d "$raspap_dir" ]; then
sudo mv $raspap_dir "$raspap_dir.`date +%F-%R`" || install_error "Unable to move old '$raspap_dir' out of the way"
fi
@ -159,7 +172,7 @@ function download_latest_files() {
fi
install_log "Cloning latest files from github"
git clone --depth 1 https://github.com/necro-nemesis/Lokiap-webgui /tmp/raspap-webgui || install_error "Unable to download files from github"
git clone --depth 1 https://github.com/necro-nemesis/LabyrinthAP /tmp/raspap-webgui || install_error "Unable to download files from github"
sudo mv /tmp/raspap-webgui $webroot_dir || install_error "Unable to move raspap-webgui to web root"
}
@ -226,7 +239,7 @@ function move_config_file() {
function network_tables() {
install_log "Selecting iptables or nftable rules"
if [ $version -lt 11 ]; 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'
@ -256,31 +269,34 @@ function default_configuration() {
sudo mv $webroot_dir/config/loki-whois /usr/local/bin/loki-whois || install_error "unable to move loki-whois binary"
sudo mv $webroot_dir/config/loki-whois.service /etc/systemd/system/loki-whois.service || install_error "unable to move loki-whois.service to system"
sudo systemctl enable --now loki-whois #start loki-whois as service
sudo rm /etc/resolv.conf
sudo ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf
sudo resolvconf -u || install_error "Unable to update resolv.conf"
# LokiPAP Batch file relocation and permissions in user loki-network directory
# LokiPAP Batch files relocation and permissions in user loki-network directory
sudo mv $webroot_dir/config/lokilaunch.sh /var/lib/lokinet/ || install error "Unable to move lokilaunch.sh, install Lokinet first"
sudo mv $webroot_dir/config/mobile.sh /var/lib/lokinet/ || install error "Unable to move mobile.sh, file not found"
#changes persmission on lokilaunch.sh
#changes persmission on lokilaunch.sh and mobile.sh
sudo chmod 755 /var/lib/lokinet/lokilaunch.sh
sudo chmod 777 /var/lib/lokinet/mobile.sh
# Generate required lines for Rasp AP to place into rc.local file.
# #RASPAP is for removal
lines=(
'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP'
#'if [ ! -f /etc/loki/lokinet.ini ]; then'
#'lokinet -g'
#'fi'
"$tablerouteA"
"$tablerouteB"
#'sudo \/var\/lib\/lokinet\/.\/lokilaunch.sh start #RASPAP'
# 'if ! [cat \/sys\/class\/net\/eth0\/carrier] ; then'
'\/var\/lib\/lokinet\/mobile.sh'
# 'fi #end'
)
for line in "${lines[@]}"; do
@ -310,7 +326,6 @@ function patch_system_files() {
#added for forced Lokinet
"/sbin/ip"
#
"/sbin/ifdown"
"/sbin/ifup"
"/bin/cat /etc/wpa_supplicant/wpa_supplicant.conf"
@ -320,7 +335,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"
@ -384,14 +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 "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 "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 "Enable PHP OPCache? [Y/n]: "
read answer
if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then
@ -400,11 +410,12 @@ 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
fi
fi
fi
}
function install_complete() {
@ -417,22 +428,23 @@ function install_complete() {
exit 0
fi
install_log "Shutting Down"
echo -n "Allow a minute for reinitialization then connect wifi to SSID loki-access and use default password 'ChangeMe'"
echo -n "Allow a minute for reinitialization then connect wifi to SSID LabyrinthAP and use default password 'ChangeMe'"
sleep 8
sudo shutdown -r now || install_error "Unable to execute shutdown"
}
function install_raspap() {
test_root_user
display_welcome
config_installation
update_system_packages
install_dependencies
patch_lokinet_service
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

@ -1,7 +1,14 @@
UPDATE_URL="https://raw.githubusercontent.com/necro-nemesis/Lokiap-webgui/master/"
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"
@ -11,18 +18,29 @@ function install_dependencies() {
install_log "Installing required packages"
sudo apt-get -y install curl
echo "Install public key used to sign the lokinet binaries."
curl -s https://deb.imaginary.stream/public.gpg | sudo apt-key add -
echo "deb https://deb.imaginary.stream $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/imaginary.stream.list
curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg
echo "deb https://deb.oxen.io $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/oxen.list
#curl -s https://deb.imaginary.stream/public.gpg | sudo apt-key add -
#echo "deb https://deb.imaginary.stream $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/imaginary.stream.list
sudo apt-get update
sudo yes | apt-get install whois lighttpd $php_package git resolvconf hostapd dnsmasq vnstat 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.
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

Loading…
Cancel
Save