Project

General

Profile

Feature #15550

Updated by Jim Pingle about 1 month ago

If I type from cli: 

 <pre><code class="shell"> 
 easyrule block wan Kids_Devices 
 Tried to block invalid address: Kids_Devices 
 </code></pre> 

 The "eaysrule docs":https://docs.netgate.com/pfsense/en/latest/firewall/easyrule.html [[docs]https://docs.netgate.com/pfsense/en/latest/firewall/easyrule.html] 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. 

 <pre><code class="php"> 
 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."); 
 } 
 </code></pre> 

Back