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

    easyrule block and alias not working

    General pfSense Questions
    2
    5
    171
    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

      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
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

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

        Steve

        D 1 Reply Last reply Reply Quote 0
        • D
          david_moo @stephenw10
          last edited by

          @stephenw10

          Bug submitted..

          1 Reply Last reply Reply Quote 1
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

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

            D 1 Reply Last reply Reply Quote 0
            • D
              david_moo @stephenw10
              last edited by

              @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
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.