• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

easyrule block and alias not working

Scheduled Pinned Locked Moved General pfSense Questions
5 Posts 2 Posters 171 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    david_moo
    last edited by Jun 9, 2024, 8:34 PM

    If I type from cli:

    easyrule block wan Kids_Devices
    Tried to block invalid address: Kids_Devices
    

    I get the above error.

    The 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.");
    }
    
    1 Reply Last reply Reply Quote 0
    • S
      stephenw10 Netgate Administrator
      last edited by Jun 9, 2024, 10:29 PM

      Hmm, that does appear to be the case. Did you open a bug report?

      Steve

      D 1 Reply Last reply Jun 10, 2024, 12:01 AM Reply Quote 0
      • D
        david_moo @stephenw10
        last edited by Jun 10, 2024, 12:01 AM

        @stephenw10

        Bug submitted..

        1 Reply Last reply Reply Quote 1
        • S
          stephenw10 Netgate Administrator
          last edited by Jun 10, 2024, 12:17 AM

          What's in that alias? A series of separate IPs?

          D 1 Reply Last reply Jun 10, 2024, 12:51 AM Reply Quote 0
          • D
            david_moo @stephenw10
            last edited by Jun 10, 2024, 12:51 AM

            @stephenw10

            Yes.

            Kids_Devices Host(s) 10.10.10.50, 10.10.10.51, 10.10.10.52, 10.10.10.53, 10.10.10.54, 10.10.10.55, 10.10.10.56, 10.10.10.57, 10.10.10.58, 10.10.10.59…

            1 Reply Last reply Reply Quote 1
            1 out of 5
            • First post
              1/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received