|
@@ -39,10 +39,36 @@
|
|
<div>
|
|
<div>
|
|
<h3 class="ui header">
|
|
<h3 class="ui header">
|
|
Access Control
|
|
Access Control
|
|
- <div class="sub header">Manage IPs from accessing this host</div>
|
|
|
|
|
|
+ <div class="sub header">Manage IPs from logging into this host</div>
|
|
</h3>
|
|
</h3>
|
|
<div class="ui divider"></div>
|
|
<div class="ui divider"></div>
|
|
<h3><i class="ui green checkmark icon"></i> Whitelist</h3>
|
|
<h3><i class="ui green checkmark icon"></i> Whitelist</h3>
|
|
|
|
+ <div class="ui toggle checkbox">
|
|
|
|
+ <input type="checkbox" id="enableWhiteList" onchange="">
|
|
|
|
+ <label>Enable Whitelist Filtering</label>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ui inverted green segment" id="whitelistUpdateFeedback" style="display:none;">
|
|
|
|
+ <i class="ui checkmark icon"></i> Whitelist Status Updated
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="ui basic segment">
|
|
|
|
+ <p>Add or Remove new whitelisted IP range</p>
|
|
|
|
+ <div class="ui action fluid input">
|
|
|
|
+ <input type="text" id="whitelistIpRange" placeholder="192.168.1.100 - 192.168.1.250">
|
|
|
|
+ <button class="ui green button" onclick="whitelistIpRange();"><i class="ui checkmark icon"></i> Add</button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <table class="ui celled table">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr><th>IP Range</th>
|
|
|
|
+ <th>Remove</th>
|
|
|
|
+ </tr></thead>
|
|
|
|
+ <tbody id="whitelistTable">
|
|
|
|
+
|
|
|
|
+ </tbody>
|
|
|
|
+ </table>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
|
|
<div class="ui divider"></div>
|
|
<div class="ui divider"></div>
|
|
<h3><i class="ui red remove icon"></i> Blacklist</h3>
|
|
<h3><i class="ui red remove icon"></i> Blacklist</h3>
|
|
@@ -51,19 +77,10 @@
|
|
<label>Enable Blacklist Filtering</label>
|
|
<label>Enable Blacklist Filtering</label>
|
|
</div>
|
|
</div>
|
|
<div class="ui inverted green segment" id="blacklistUpdateFeedback" style="display:none;">
|
|
<div class="ui inverted green segment" id="blacklistUpdateFeedback" style="display:none;">
|
|
- <i class="ui checkmark icon"></i> Status Updated
|
|
|
|
|
|
+ <i class="ui checkmark icon"></i> Blacklist Status Updated
|
|
</div>
|
|
</div>
|
|
<div class="ui basic segment">
|
|
<div class="ui basic segment">
|
|
- <div class="ui grey message">
|
|
|
|
- <p>Block certain IP or IP range from logging into the system. Syntax Examples:</p>
|
|
|
|
- <div class="ui bulleted list">
|
|
|
|
- <div class="item">192.168.1.100</div>
|
|
|
|
- <div class="item">123.36.53.100</div>
|
|
|
|
- <div class="item">192.168.0.100 - 192.168.0.250</div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <p>Add or Edit new banned IP range</p>
|
|
|
|
|
|
+ <p>Add or Remove new banned IP range</p>
|
|
<div class="ui action fluid input">
|
|
<div class="ui action fluid input">
|
|
<input type="text" id="blacklistIpRange" placeholder="192.168.1.100 - 192.168.1.250">
|
|
<input type="text" id="blacklistIpRange" placeholder="192.168.1.100 - 192.168.1.250">
|
|
<button class="ui red button" onclick="blacklistIpRange();"><i class="ui lock icon"></i> Ban</button>
|
|
<button class="ui red button" onclick="blacklistIpRange();"><i class="ui lock icon"></i> Ban</button>
|
|
@@ -85,6 +102,17 @@
|
|
<div class="ui divider"></div>
|
|
<div class="ui divider"></div>
|
|
<h3>Regional Block</h3>
|
|
<h3>Regional Block</h3>
|
|
|
|
|
|
|
|
+
|
|
|
|
+ <div class="ui divider"></div>
|
|
|
|
+ <div class="ui grey message">
|
|
|
|
+ <p><i class="ui info circle icon"></i> For Whitelist and Blacklist, you can enter either a single IP or an IP range. IP range syntax examples as follows.</p>
|
|
|
|
+ <div class="ui bulleted list">
|
|
|
|
+ <div class="item">192.168.1.100</div>
|
|
|
|
+ <div class="item">123.36.53.100</div>
|
|
|
|
+ <div class="item">192.168.0.100 - 192.168.0.250</div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <br><br>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -92,6 +120,106 @@
|
|
var preloading = true;
|
|
var preloading = true;
|
|
$(".checkbox").checkbox();
|
|
$(".checkbox").checkbox();
|
|
initBlacklist();
|
|
initBlacklist();
|
|
|
|
+ initWhiteList();
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ Whitelist Related
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ function initWhiteList(){
|
|
|
|
+ //Get the whitelist enable state
|
|
|
|
+ $.get("../../system/auth/whitelist/enable", function(data){
|
|
|
|
+ if (data == true){
|
|
|
|
+ //Whitelist is enabled
|
|
|
|
+ $("#enableWhiteList").parent().checkbox("set checked");
|
|
|
|
+ }else{
|
|
|
|
+ $("#enableWhiteList").parent().checkbox("set unchecked");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $("#enableWhiteList").on("change", function(){
|
|
|
|
+ //Toggle enable
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: "../../system/auth/whitelist/enable",
|
|
|
|
+ method: "POST",
|
|
|
|
+ data: {enable: this.checked},
|
|
|
|
+ success: function(data){
|
|
|
|
+ $("#whitelistUpdateFeedback").stop().finish().slideDown("fast").delay(3000).slideUp("fast");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //Get the whitelist table
|
|
|
|
+ $("#whitelistTable").html(`<tr>
|
|
|
|
+ <td colspan="3"><i class="loading spinner icon"></i> Loading</td>
|
|
|
|
+ </tr>`);
|
|
|
|
+ $.get("../../system/auth/whitelist/list", function(data){
|
|
|
|
+ $("#whitelistTable").html('');
|
|
|
|
+ data.forEach(entry => {
|
|
|
|
+ //Strip out all space from record
|
|
|
|
+ displayEntry = entry.split(" ").join("");
|
|
|
|
+
|
|
|
|
+ //Check if this is reserved ip range
|
|
|
|
+ var enableRemove = true;
|
|
|
|
+ if (entry == "127.0.0.1"){
|
|
|
|
+ enableRemove = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var removeButtonClass = ""
|
|
|
|
+ if (!enableRemove){
|
|
|
|
+ removeButtonClass = "disabled";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $("#whitelistTable").append(`<tr>
|
|
|
|
+ <td>${displayEntry}</td>
|
|
|
|
+ <td><button class="ui basic red ${removeButtonClass} icon button" onclick="removeWhitelistforIpRange(this);" range="${entry}"><i class="ui white remove icon"></i></button></td>
|
|
|
|
+ </tr>`);
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if (data.length == 0){
|
|
|
|
+ $("#whitelistTable").html(`<tr>
|
|
|
|
+ <td colspan="3"><i class="remove icon"></i> No Whitelisted IPs</td>
|
|
|
|
+ </tr>`);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function whitelistIpRange(){
|
|
|
|
+ var targetIP = $("#whitelistIpRange").val();
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: "../../system/auth/whitelist/set",
|
|
|
|
+ method: "POST",
|
|
|
|
+ data: {iprange: targetIP},
|
|
|
|
+ success: function(data){
|
|
|
|
+ if (data.error != undefined){
|
|
|
|
+ alert(data.error);
|
|
|
|
+ }else{
|
|
|
|
+ $("#whitelistIpRange").val('')
|
|
|
|
+ initWhiteList();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function removeWhitelistforIpRange(object){
|
|
|
|
+ var unbanIpRange = $(object).attr("range");
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: "../../system/auth/whitelist/unset",
|
|
|
|
+ method: "POST",
|
|
|
|
+ data: {iprange: unbanIpRange},
|
|
|
|
+ success: function(data){
|
|
|
|
+ if (data.error != undefined){
|
|
|
|
+ alert(data.error);
|
|
|
|
+ }else{
|
|
|
|
+ $("#whitelistIpRange").val('')
|
|
|
|
+ initWhiteList();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
/*
|
|
|
|
|