2015-02-16 10:30:58 +01:00
|
|
|
<?php
|
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
/**
|
|
|
|
* Raspbian WiFi Configuration Portal
|
|
|
|
*
|
|
|
|
* Enables use of simple web interface rather than SSH to control wifi and hostapd on the Raspberry Pi.
|
|
|
|
* Recommended distribution is Raspbian Server Edition. Specific instructions to install the supported software are
|
|
|
|
* in the README and original post by @SirLagz. For a quick run through, the packages required for the WebGUI are:
|
|
|
|
* lighttpd (I have version 1.4.31-2 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.
|
|
|
|
*
|
2017-10-03 06:32:30 +02:00
|
|
|
* @author Lawrence Yau <sirlagz@gmail.com>
|
2015-02-25 14:06:48 +01:00
|
|
|
* @author Bill Zimmerman <billzimmerman@gmail.com>
|
2016-06-14 21:00:17 +02:00
|
|
|
* @license GNU General Public License, version 3 (GPL-3.0)
|
2017-10-03 19:34:44 +02:00
|
|
|
* @version 1.2.2
|
2016-06-14 21:00:17 +02:00
|
|
|
* @link https://github.com/billz/raspap-webgui
|
2015-02-25 14:06:48 +01:00
|
|
|
* @see http://sirlagz.net/2013/02/08/raspap-webgui/
|
|
|
|
*/
|
|
|
|
|
2016-05-29 17:38:43 +02:00
|
|
|
define('RASPI_CONFIG', '/etc/raspap');
|
2017-10-14 05:36:42 +02:00
|
|
|
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');
|
|
|
|
|
|
|
|
//if(file_exists(RASPI_CONFIG.'/raspap.auth')) {
|
|
|
|
// define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');
|
|
|
|
//} else {
|
|
|
|
// define('RASPI_ADMIN_DETAILS','');
|
|
|
|
//}
|
2016-05-29 17:38:43 +02:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
// Constants for configuration file paths.
|
|
|
|
// These are typical for default RPi installs. Modify if needed.
|
|
|
|
define('RASPI_DNSMASQ_CONFIG', '/etc/dnsmasq.conf');
|
|
|
|
define('RASPI_DNSMASQ_LEASES', '/var/lib/misc/dnsmasq.leases');
|
|
|
|
define('RASPI_HOSTAPD_CONFIG', '/etc/hostapd/hostapd.conf');
|
|
|
|
define('RASPI_WPA_SUPPLICANT_CONFIG', '/etc/wpa_supplicant/wpa_supplicant.conf');
|
|
|
|
define('RASPI_HOSTAPD_CTRL_INTERFACE', '/var/run/hostapd');
|
|
|
|
define('RASPI_WPA_CTRL_INTERFACE', '/var/run/wpa_supplicant');
|
|
|
|
define('RASPI_OPENVPN_CLIENT_CONFIG', '/etc/openvpn/client.conf');
|
|
|
|
define('RASPI_OPENVPN_SERVER_CONFIG', '/etc/openvpn/server.conf');
|
|
|
|
define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc');
|
|
|
|
|
2015-02-27 16:12:26 +01:00
|
|
|
// Optional services, set to true to enable.
|
|
|
|
define('RASPI_OPENVPN_ENABLED', false );
|
|
|
|
define('RASPI_TORPROXY_ENABLED', false );
|
|
|
|
|
2016-05-29 17:38:43 +02:00
|
|
|
include_once( RASPI_CONFIG.'/raspap.php' );
|
2017-10-23 19:37:59 +02:00
|
|
|
include_once( 'includes/locale.php');
|
2016-07-09 02:26:13 +02:00
|
|
|
include_once( 'includes/functions.php' );
|
2016-08-08 14:48:16 +02:00
|
|
|
include_once( 'includes/dashboard.php' );
|
2016-05-29 17:38:43 +02:00
|
|
|
include_once( 'includes/authenticate.php' );
|
|
|
|
include_once( 'includes/admin.php' );
|
2016-07-09 02:26:13 +02:00
|
|
|
include_once( 'includes/dhcp.php' );
|
2016-07-27 22:43:40 +02:00
|
|
|
include_once( 'includes/hostapd.php' );
|
2016-08-08 14:31:19 +02:00
|
|
|
include_once( 'includes/system.php' );
|
2016-08-12 19:00:43 +02:00
|
|
|
include_once( 'includes/configure_client.php' );
|
2017-10-07 01:08:06 +02:00
|
|
|
include_once( 'includes/themes.php' );
|
2015-02-25 14:06:48 +01:00
|
|
|
|
2015-02-16 10:30:58 +01:00
|
|
|
$output = $return = 0;
|
|
|
|
$page = $_GET['page'];
|
2016-06-24 23:39:39 +02:00
|
|
|
|
|
|
|
session_start();
|
|
|
|
if (empty($_SESSION['csrf_token'])) {
|
|
|
|
if (function_exists('mcrypt_create_iv')) {
|
|
|
|
$_SESSION['csrf_token'] = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
|
|
|
|
} else {
|
|
|
|
$_SESSION['csrf_token'] = bin2hex(openssl_random_pseudo_bytes(32));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$csrf_token = $_SESSION['csrf_token'];
|
2017-10-07 01:08:06 +02:00
|
|
|
|
|
|
|
if(!isset($_COOKIE['theme'])) {
|
2017-10-09 16:04:59 +02:00
|
|
|
$theme = "custom.css";
|
2017-10-07 01:08:06 +02:00
|
|
|
} else {
|
2017-10-09 16:04:59 +02:00
|
|
|
$theme = $_COOKIE['theme'];
|
2017-10-07 01:08:06 +02:00
|
|
|
}
|
2017-10-09 16:04:59 +02:00
|
|
|
$theme_url = 'dist/css/' . $theme;
|
2015-02-25 14:06:48 +01:00
|
|
|
?>
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2016-07-27 22:34:56 +02:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2015-02-25 14:06:48 +01:00
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta name="description" content="">
|
|
|
|
<meta name="author" content="">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2017-10-23 19:37:59 +02:00
|
|
|
<title><?php echo _("Raspbian WiFi Configuration Portal"); ?></title>
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Bootstrap Core CSS -->
|
|
|
|
<link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- MetisMenu CSS -->
|
|
|
|
<link href="bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Timeline CSS -->
|
|
|
|
<link href="dist/css/timeline.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Custom CSS -->
|
|
|
|
<link href="dist/css/sb-admin-2.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Morris Charts CSS -->
|
|
|
|
<link href="bower_components/morrisjs/morris.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Custom Fonts -->
|
|
|
|
<link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Custom CSS -->
|
2017-10-07 01:08:06 +02:00
|
|
|
<link href="<?php echo $theme_url; ?>" title="main" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-27 17:18:38 +01:00
|
|
|
<link rel="shortcut icon" type="image/png" href="../img/favicon.png">
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
|
|
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
|
|
|
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
|
|
|
<![endif]-->
|
2016-07-27 22:34:56 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="wrapper">
|
|
|
|
<!-- Navigation -->
|
|
|
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
|
|
|
<div class="navbar-header">
|
|
|
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
</button>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a class="navbar-brand" href="index.php"><?php echo _("RaspAP Wifi Portal v1.2.2"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</div>
|
|
|
|
<!-- /.navbar-header -->
|
|
|
|
|
|
|
|
<!-- Navigation -->
|
|
|
|
<div class="navbar-default sidebar" role="navigation">
|
|
|
|
<div class="sidebar-nav navbar-collapse">
|
|
|
|
<ul class="nav" id="side-menu">
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> <?php echo _("Dashboard"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> <?php echo _("Configure client"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=hostapd_conf"><i class="fa fa-dot-circle-o fa-fw"></i> <?php echo _("Configure hotspot"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=dhcpd_conf"><i class="fa fa-exchange fa-fw"></i> <?php echo _("Configure DHCP Server"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
<?php if ( RASPI_OPENVPN_ENABLED ) : ?>
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=openvpn_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure OpenVPN"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if ( RASPI_TORPROXY_ENABLED ) : ?>
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=torproxy_conf"><i class="fa fa-eye-slash fa-fw"></i> <?php echo _("Configure TOR proxy"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
<?php endif; ?>
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=auth_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure Auth"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2017-10-07 01:08:06 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=theme_conf"><i class="fa fa-wrench fa-fw"></i> <?php echo _("Change Theme"); ?></a>
|
2017-10-07 01:08:06 +02:00
|
|
|
</li>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><!-- /.navbar-collapse -->
|
|
|
|
</div><!-- /.navbar-default -->
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<div id="page-wrapper">
|
|
|
|
|
|
|
|
<!-- Page Heading -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<h1 class="page-header">
|
|
|
|
<img class="logo" src="img/raspAP-logo.png" width="45" height="45">RaspAP
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.row -->
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// handle page actions
|
|
|
|
switch( $page ) {
|
|
|
|
case "wlan0_info":
|
|
|
|
DisplayDashboard();
|
|
|
|
break;
|
|
|
|
case "dhcpd_conf":
|
|
|
|
DisplayDHCPConfig();
|
|
|
|
break;
|
|
|
|
case "wpa_conf":
|
|
|
|
DisplayWPAConfig();
|
|
|
|
break;
|
|
|
|
case "hostapd_conf":
|
|
|
|
DisplayHostAPDConfig();
|
|
|
|
break;
|
|
|
|
case "openvpn_conf":
|
|
|
|
DisplayOpenVPNConfig();
|
|
|
|
break;
|
|
|
|
case "torproxy_conf":
|
|
|
|
DisplayTorProxyConfig();
|
|
|
|
break;
|
|
|
|
case "auth_conf":
|
|
|
|
DisplayAuthConfig($config['admin_user'], $config['admin_pass']);
|
|
|
|
break;
|
|
|
|
case "save_hostapd_conf":
|
2016-08-05 22:38:02 +02:00
|
|
|
SaveTORAndVPNConfig();
|
2016-07-27 22:34:56 +02:00
|
|
|
break;
|
2017-10-07 01:08:06 +02:00
|
|
|
case "theme_conf":
|
|
|
|
DisplayThemeConfig();
|
|
|
|
break;
|
2016-07-27 22:34:56 +02:00
|
|
|
case "system_info":
|
|
|
|
DisplaySystem();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DisplayDashboard();
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div><!-- /#page-wrapper -->
|
2015-02-25 14:06:48 +01:00
|
|
|
</div><!-- /#wrapper -->
|
|
|
|
|
2015-02-27 16:12:26 +01:00
|
|
|
<!-- RaspAP JavaScript -->
|
|
|
|
<script src="dist/js/functions.js"></script>
|
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- jQuery -->
|
|
|
|
<script src="bower_components/jquery/dist/jquery.min.js"></script>
|
|
|
|
|
|
|
|
<!-- Bootstrap Core JavaScript -->
|
|
|
|
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
|
|
|
|
|
|
|
|
<!-- Metis Menu Plugin JavaScript -->
|
|
|
|
<script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>
|
|
|
|
|
|
|
|
<!-- Morris Charts JavaScript -->
|
|
|
|
<!--script src="bower_components/raphael/raphael-min.js"></script-->
|
|
|
|
<!--script src="bower_components/morrisjs/morris.min.js"></script-->
|
|
|
|
<!--script src="js/morris-data.js"></script-->
|
|
|
|
|
|
|
|
<!-- Custom Theme JavaScript -->
|
|
|
|
<script src="dist/js/sb-admin-2.js"></script>
|
2016-07-27 22:34:56 +02:00
|
|
|
</body>
|
2015-02-25 14:06:48 +01:00
|
|
|
</html>
|