From 3228114dd876142ad731bb4c398f1305c604f893 Mon Sep 17 00:00:00 2001 From: Emmanuel Geoffray Date: Thu, 7 Dec 2017 19:00:48 +0000 Subject: [PATCH 1/4] add global to select wireless interface for wifi client --- includes/config.php | 1 + includes/configure_client.php | 4 ++-- includes/dashboard.php | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/includes/config.php b/includes/config.php index 58033aa4..40ecd922 100644 --- a/includes/config.php +++ b/includes/config.php @@ -3,6 +3,7 @@ define('RASPI_CONFIG', '/etc/raspap'); define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking'); define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); +define('RASPI_WIFI_CLIENT_INTERFACE', 'wifiKey'); // Constants for configuration file paths. // These are typical for default RPi installs. Modify if needed. diff --git a/includes/configure_client.php b/includes/configure_client.php index 4b1ede62..31a77e5e 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -134,7 +134,7 @@ function DisplayWPAConfig(){ } } - exec( 'iwconfig wlan0', $iwconfig_return ); + exec( 'iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $iwconfig_return ); foreach ($iwconfig_return as $line) { if (preg_match( '/ESSID:\"([^"]+)\"/i',$line,$iwconfig_ssid )) { $networks[$iwconfig_ssid[1]]['connected'] = true; @@ -149,7 +149,7 @@ function DisplayWPAConfig(){

showMessages(); ?>

-

Client settings

+

Client settings for interface

diff --git a/includes/dashboard.php b/includes/dashboard.php index 1f66542a..66bb6bfe 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -8,8 +8,8 @@ function DisplayDashboard(){ $status = new StatusMessages(); - exec( 'ip a s wlan0', $return ); - exec( 'iwconfig wlan0', $return ); + exec( 'ip a s ' . RASPI_WIFI_CLIENT_INTERFACE , $return ); + exec( 'iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $return ); $strWlan0 = implode( " ", $return ); $strWlan0 = preg_replace( '/\s\s+/', ' ', $strWlan0 ); @@ -58,17 +58,17 @@ function DisplayDashboard(){ } if( isset($_POST['ifdown_wlan0']) ) { - exec( 'ifconfig wlan0 | grep -i running | wc -l',$test ); + exec( 'ifconfig ' . RASPI_WIFI_CLIENT_INTERFACE . ' | grep -i running | wc -l',$test ); if($test[0] == 1) { - exec( 'sudo ip link set wlan0 down',$return ); + exec( 'sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' down',$return ); } else { echo 'Interface already down'; } } elseif( isset($_POST['ifup_wlan0']) ) { - exec( 'ifconfig wlan0 | grep -i running | wc -l',$test ); + exec( 'ifconfig ' . RASPI_WIFI_CLIENT_INTERFACE . ' | grep -i running | wc -l',$test ); if($test[0] == 0) { - exec( 'sudo ip link set wlan0 up',$return ); - exec( 'sudo ip -s a f label wlan0',$return); + exec( 'sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' up',$return ); + exec( 'sudo ip -s a f label ' . RASPI_WIFI_CLIENT_INTERFACE,$return); } else { echo 'Interface already up'; } @@ -85,7 +85,7 @@ function DisplayDashboard(){

Interface Information

-
Interface Name
wlan0
+
Interface Name

IP Address

Subnet Mask

Mac Address


@@ -126,9 +126,9 @@ function DisplayDashboard(){
'; + echo ''; } else { - echo ''; + echo ''; } ?> From 3bcf16a3bafeef37dfdfa0b9ae9f17a968c6f4b3 Mon Sep 17 00:00:00 2001 From: Emmanuel Geoffray Date: Thu, 7 Dec 2017 19:12:35 +0000 Subject: [PATCH 2/4] add globals to select visible services --- includes/config.php | 5 +++++ index.php | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/includes/config.php b/includes/config.php index 40ecd922..67a0b4cd 100644 --- a/includes/config.php +++ b/includes/config.php @@ -18,7 +18,12 @@ define('RASPI_OPENVPN_SERVER_CONFIG', '/etc/openvpn/server.conf'); define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc'); // Optional services, set to true to enable. +define('RASPI_HOTSPOT_ENABLED', false ); +define('RASPI_NETWORK_ENABLED', false ); +define('RASPI_DHCP_ENABLED', false ); define('RASPI_OPENVPN_ENABLED', false ); define('RASPI_TORPROXY_ENABLED', false ); +define('RASPI_CONFAUTH_ENABLED', false ); +define('RASPI_CHANGETHEME_ENABLED', false ); ?> diff --git a/index.php b/index.php index e6fc4e24..fa5ee301 100755 --- a/index.php +++ b/index.php @@ -118,15 +118,21 @@ $theme_url = 'dist/css/' . $theme;
  • Configure WiFi Client
  • +
  • Configure Hotspot
  • + +
  • Configure Networking
  • + +
  • Configure DHCP Server
  • +
  • Configure OpenVPN @@ -137,12 +143,16 @@ $theme_url = 'dist/css/' . $theme; Configure TOR proxy
  • +
  • Configure Auth
  • + +
  • Change Theme
  • +
  • System
  • From 674c38a54e0e1cb8d51705eca6228ca7dad1b399 Mon Sep 17 00:00:00 2001 From: Emmanuel Geoffray Date: Thu, 7 Dec 2017 20:14:20 +0100 Subject: [PATCH 3/4] Reset to default config --- includes/config.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/config.php b/includes/config.php index 67a0b4cd..9ce3b835 100644 --- a/includes/config.php +++ b/includes/config.php @@ -3,7 +3,7 @@ define('RASPI_CONFIG', '/etc/raspap'); define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking'); define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); -define('RASPI_WIFI_CLIENT_INTERFACE', 'wifiKey'); +define('RASPI_WIFI_CLIENT_INTERFACE', 'wlan0'); // Constants for configuration file paths. // These are typical for default RPi installs. Modify if needed. @@ -18,12 +18,12 @@ define('RASPI_OPENVPN_SERVER_CONFIG', '/etc/openvpn/server.conf'); define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc'); // Optional services, set to true to enable. -define('RASPI_HOTSPOT_ENABLED', false ); -define('RASPI_NETWORK_ENABLED', false ); -define('RASPI_DHCP_ENABLED', false ); +define('RASPI_HOTSPOT_ENABLED', true ); +define('RASPI_NETWORK_ENABLED', true ); +define('RASPI_DHCP_ENABLED', true ); define('RASPI_OPENVPN_ENABLED', false ); define('RASPI_TORPROXY_ENABLED', false ); -define('RASPI_CONFAUTH_ENABLED', false ); -define('RASPI_CHANGETHEME_ENABLED', false ); +define('RASPI_CONFAUTH_ENABLED', true ); +define('RASPI_CHANGETHEME_ENABLED', true ); ?> From 4325f9a9cf42edd13ad063a9969ac8576a8a3fcb Mon Sep 17 00:00:00 2001 From: Emmanuel Geoffray Date: Thu, 7 Dec 2017 20:49:12 +0100 Subject: [PATCH 4/4] Fixed memory used --- includes/system.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/system.php b/includes/system.php index 213e87a8..8f8c29e3 100755 --- a/includes/system.php +++ b/includes/system.php @@ -66,7 +66,7 @@ function DisplaySystem(){ // mem used $memused_status = "primary"; - exec("free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { print used/total*100}'", $memarray); + exec("free -m | awk '/Mem:/ { total=$2 ; used=$3 } END { print used/total*100}'", $memarray); $memused = floor($memarray[0]); if ($memused > 90) { $memused_status = "danger"; } elseif ($memused > 75) { $memused_status = "warning"; }