1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Merge pull request #248 from D9ping/hidden-ssid

Hidden SSID and not secured hotspot.
This commit is contained in:
Bill Zimmerman 2018-10-14 10:21:29 +02:00 committed by GitHub
commit 3b9c478a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ function DisplayHostAPDConfig()
$arrConfig = array(); $arrConfig = array();
$arr80211Standard = array('a','b','g','n'); $arr80211Standard = array('a','b','g','n');
$arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2'); $arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None"));
$arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP');
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
@ -139,7 +139,7 @@ if (in_array($arrConfig['country_code'], $countries_max11channels)) {
$selectablechannels = range(1, 14); $selectablechannels = range(1, 14);
} }
} }
SelectorOptions('channel', $selectablechannels, intval($arrConfig['channel']), 'cbxchannel') ?> SelectorOptions('channel', $selectablechannels, intval($arrConfig['channel']), 'cbxchannel'); ?>
</div> </div>
</div> </div>
</div> </div>
@ -183,18 +183,31 @@ if (in_array($arrConfig['country_code'], $countries_max11channels)) {
<h4><?php echo _("Advanced settings"); ?></h4> <h4><?php echo _("Advanced settings"); ?></h4>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="form-check"> <div class="form-check">
<label class="form-check-label" for="chxlogenable"> <label class="form-check-label" for="chxlogenable"><?php echo _("Enable logging");
<?php echo _("Enable logging");
$checkedLogEnabled = ''; $checkedLogEnabled = '';
if ($arrHostapdConf['LogEnable'] == 1) { if ($arrHostapdConf['LogEnable'] == 1) {
$checkedLogEnabled = ' checked="checked"'; $checkedLogEnabled = ' checked="checked"';
} }
?> ?>
</label> </label>
<input id="chxlogenable" name="logEnable" type="checkbox" class="form-check-input" value="1"<?php echo $checkedLogEnabled; ?> /> <input id="chxlogenable" name="logEnable" type="checkbox" class="form-check-input" value="1"<?php echo $checkedLogEnabled; ?> />
</div>
</div> </div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-check">
<label class="form-check-label" for="chxhiddenssid"><?php echo _("Hide SSID in broadcast");
$checkedHiddenSSID = '';
if ($arrConfig['ignore_broadcast_ssid'] == 1 || $arrConfig['ignore_broadcast_ssid'] == 2) {
$checkedHiddenSSID = ' checked="checked"';
}
?> </label>
<input id="chxhiddenssid" name="hiddenSSID" type="checkbox" class="form-check-input" value="1"<?php echo $checkedHiddenSSID; ?> />
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -533,11 +546,26 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$good_input = false; $good_input = false;
} }
if (strlen($_POST['wpa_passphrase']) < 8 || strlen($_POST['wpa_passphrase']) > 63) { if ($_POST['wpa'] !== 'none' &&
(strlen($_POST['wpa_passphrase']) < 8 || strlen($_POST['wpa_passphrase']) > 63)) {
$status->addMessage('WPA passphrase must be between 8 and 63 characters', 'danger'); $status->addMessage('WPA passphrase must be between 8 and 63 characters', 'danger');
$good_input = false; $good_input = false;
} }
if (isset($_POST['hiddenSSID'])) {
if (!is_int((int)$_POST['hiddenSSID'])) {
$status->addMessage('Parameter hiddenSSID not a number.', 'danger');
$good_input = false;
} elseif ((int)$_POST['hiddenSSID'] < 0 || (int)$_POST['hiddenSSID'] >= 3) {
$status->addMessage('Parameter hiddenSSID contains invalid configuratie value.', 'danger');
$good_input = false;
} else {
$ignore_broadcast_ssid = $_POST['hiddenSSID'];
}
} else {
$ignore_broadcast_ssid = '0';
}
if (! in_array($_POST['interface'], $interfaces)) { if (! in_array($_POST['interface'], $interfaces)) {
// The user is probably up to something here but it may also be a // The user is probably up to something here but it may also be a
// genuine error. // genuine error.
@ -577,6 +605,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
fwrite($tmp_file, 'wpa='.$_POST['wpa'].PHP_EOL); fwrite($tmp_file, 'wpa='.$_POST['wpa'].PHP_EOL);
fwrite($tmp_file, 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL); fwrite($tmp_file, 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL);
fwrite($tmp_file, 'country_code='.$_POST['country_code'].PHP_EOL); fwrite($tmp_file, 'country_code='.$_POST['country_code'].PHP_EOL);
fwrite($tmp_file, 'ignore_broadcast_ssid='.$ignore_broadcast_ssid.PHP_EOL);
fclose($tmp_file); fclose($tmp_file);
system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return ); system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return );