mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 20:55:28 +00:00
Add new CNAME-specific blocking modes [QUERY_GRAVITY_CNAME, QUERY_REGEX_CNAME, QUERY_BLACKLIST_CNAME] and show domain that was the reason for blocking during a CNAME inspection
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -195,6 +195,18 @@ function getQueryTypes() {
|
||||
queryType.push([6, 7, 8]);
|
||||
}
|
||||
|
||||
if ($("#type_gravity_CNAME").prop("checked")) {
|
||||
queryType.push(9);
|
||||
}
|
||||
|
||||
if ($("#type_regex_CNAME").prop("checked")) {
|
||||
queryType.push(10);
|
||||
}
|
||||
|
||||
if ($("#type_blacklist_CNAME").prop("checked")) {
|
||||
queryType.push(11);
|
||||
}
|
||||
|
||||
return queryType.join(",");
|
||||
}
|
||||
|
||||
@@ -282,13 +294,13 @@ $(document).ready(function() {
|
||||
break;
|
||||
case 4:
|
||||
color = "red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex/wildcard)";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
case 5:
|
||||
color = "red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(blacklist)";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(exact blacklist)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
@@ -307,6 +319,24 @@ $(document).ready(function() {
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(external, NXRA)";
|
||||
buttontext = "";
|
||||
break;
|
||||
case 9:
|
||||
color = "red";
|
||||
fieldtext = "Blocked (gravity, CNAME)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
case 10:
|
||||
color = "red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist, CNAME)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
case 11:
|
||||
color = "red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(exact blacklist, CNAME)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
default:
|
||||
color = "black";
|
||||
fieldtext = "Unknown";
|
||||
|
||||
@@ -166,7 +166,12 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
// Query status
|
||||
var blocked, fieldtext, buttontext, colorClass;
|
||||
var blocked,
|
||||
fieldtext,
|
||||
buttontext,
|
||||
colorClass,
|
||||
isCNAME = false;
|
||||
|
||||
switch (data[4]) {
|
||||
case "1":
|
||||
blocked = true;
|
||||
@@ -192,14 +197,14 @@ $(document).ready(function() {
|
||||
case "4":
|
||||
blocked = true;
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex/wildcard)";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
case "5":
|
||||
blocked = true;
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(blacklist)";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(exact blacklist)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
break;
|
||||
@@ -221,6 +226,30 @@ $(document).ready(function() {
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(external, NXRA)";
|
||||
buttontext = "";
|
||||
break;
|
||||
case "9":
|
||||
blocked = true;
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked (gravity, CNAME)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
isCNAME = true;
|
||||
break;
|
||||
case "10":
|
||||
blocked = true;
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist, CNAME)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
isCNAME = true;
|
||||
break;
|
||||
case "11":
|
||||
blocked = true;
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(exact blacklist, CNAME)";
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
isCNAME = true;
|
||||
break;
|
||||
default:
|
||||
blocked = false;
|
||||
colorClass = "text-black";
|
||||
@@ -228,15 +257,17 @@ $(document).ready(function() {
|
||||
buttontext = "";
|
||||
}
|
||||
|
||||
// Add extra label when blocking happend during deep CNAME inspection
|
||||
if (blocked && data.length > 6 && data[6] === "3") {
|
||||
fieldtext += "<br>CNAME";
|
||||
}
|
||||
|
||||
$(row).addClass(colorClass);
|
||||
$("td:eq(4)", row).html(fieldtext);
|
||||
$("td:eq(6)", row).html(buttontext);
|
||||
|
||||
// Add domain in CNAME chain causing the query to have been blocked
|
||||
var domain = data[2];
|
||||
var CNAME_domain = data[8];
|
||||
if (isCNAME) {
|
||||
$("td:eq(2)", row).text(domain + "\n(blocked " + CNAME_domain + ")");
|
||||
}
|
||||
|
||||
// Check for existence of sixth column and display only if not Pi-holed
|
||||
var replytext;
|
||||
if (data.length > 6 && !blocked) {
|
||||
|
||||
Reference in New Issue
Block a user