Actions
Feature #15550
openSupport using aliases/macros for sources when creating a block rule with ``easyrule`` in the CLI
Status:
New
Priority:
Normal
Assignee:
-
Category:
Rules / NAT
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Plus Target Version:
Release Notes:
Default
Description
If I type from cli:
easyrule block wan Kids_Devices
Tried to block invalid address: Kids_Devices
The eaysrule docs claim:
The source of traffic to block.
Can be an IPv4/IPv6 address, subnet, alias name, or special network name such as any, pppoe or l2tp.
The GUI code seems to only allow IP's and subnets.
function easyrule_parse_block($int, $src) {
if (!empty($src) && !empty($int)) {
$src = trim($src, "[]");
if (!is_ipaddr($src) && !is_subnet($src)) {
return gettext("Tried to block invalid address:") . ' ' . htmlspecialchars($src);
}
$int = easyrule_find_rule_interface($int);
if ($int === false) {
return gettext("Invalid interface for block rule.");
}
switch ((string)easyrule_block_host_add($src, $int)) {
case "exists":
return gettext("Block entry already exists.");
break;
case "invalid":
return gettext("Invalid address.");
break;
case "1":
return gettext("Block added successfully");
break;
case "":
default:
return gettext("Failed to create block rule, alias, or add entry.");
break;
}
} else {
return gettext("Tried to block but had no address or interface");
}
return gettext("Unknown block error.");
}
Actions