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

    Country Block

    pfSense Packages
    79
    691
    663.7k
    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.
    • T
      tommyboy180
      last edited by

      @JackANSI:

      @tommyboy180:

      Check block outbound.
      Re-save/update countryblock so the rules are re-applied.
      Ping a country that is blocked (check the country txt file if your unsure of any ip ranges)
      It should show in the firewall logs and you should get an error that says "operation not permitted" meaning it's working!

      Even gave it a reboot.  I'm not getting anything at all on a traceroute to 3 different hosts (I picked ones that are already in my log) so I'm pretty sure its blocking, but nothing in my logs yet.

      I just did those options and I found countryblock logs within the firewall logs.
      The attached screenshot is from just now.
      Edit: if the webGUI says it's running then it's running. There's no way it can be a false positive since it actually checks to make sure the countryblock tables are in pfctl.

      Edit2: It only logs attempt coming inbound. If you try to ping out then it's not logged. Sorry for that confusion.

      block.jpg
      block.jpg_thumb

      -Tom Schaefer
      SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

      Please support pfBlocker | File Browser | Strikeback

      1 Reply Last reply Reply Quote 0
      • G
        ghm
        last edited by

        @tommyboy180:

        I'm having problems getting embedded running for a test VM. At this time I cannot troubleshoot embedded images. If you can help out and find out where the problem is. Hopefully I will get embedded running soon!

        will try but am not entirely clear how. As a first step, I think this message here is key:

        Current Status = NOT running
        /tmp/rules.debug:79: cannot load "/usr/local/www/packages/countryblock/lists/countries.txt": No such file or directory
        You are blocking 0 Networks
        

        I see that after having executed the script from the command window. Pretty much what cron would do. WebIF then still says "not running".

        But I don't have the foggiest idea why I can enable Country Block by checking the box on the WebIF - no errors then and works until PPPOE reset or Firewall rules change - restart script does not work, have to restart using WebIF.

        1 Reply Last reply Reply Quote 0
        • S
          Supermule Banned
          last edited by

          Exactly what I see now…. and thats why I asked for the cron command. It doesnt work....

          @ghm:

          But I don't have the foggiest idea why I can enable Country Block by checking the box on the WebIF - no errors then and works until PPPOE reset or Firewall rules change - restart script does not work, have to restart using WebIF.

          1 Reply Last reply Reply Quote 0
          • T
            tommyboy180
            last edited by

            @Supermule:

            Exactly what I see now…. and thats why I asked for the cron command. It doesnt work....

            @ghm:

            But I don't have the foggiest idea why I can enable Country Block by checking the box on the WebIF - no errors then and works until PPPOE reset or Firewall rules change - restart script does not work, have to restart using WebIF.

            It's because he's using embedded. It works just fine on full installs. I need to get an embedded test system going or have someone help me out. In the mean time embedded installs wont be fully supported.

            -Tom Schaefer
            SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

            Please support pfBlocker | File Browser | Strikeback

            1 Reply Last reply Reply Quote 0
            • S
              Supermule Banned
              last edited by

              I am running a full install in VmWare…..

              The cronjob doesnt start countryblock....

              1 Reply Last reply Reply Quote 0
              • T
                tommyboy180
                last edited by

                @Supermule:

                I am running a full install in VmWare…..

                The cronjob doesnt start countryblock....

                I took a look at your PM and the youtube video. I have determined that you have a typo in your command on the cron job.

                -Tom Schaefer
                SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                Please support pfBlocker | File Browser | Strikeback

                1 Reply Last reply Reply Quote 0
                • S
                  Supermule Banned
                  last edited by

                  Thx :)

                  @tommyboy180:

                  @Supermule:

                  I am running a full install in VmWare…..

                  The cronjob doesnt start countryblock....

                  I took a look at your PM and the youtube video. I have determined that you have a typo in your command on the cron job.

                  1 Reply Last reply Reply Quote 0
                  • J
                    JackANSI
                    last edited by

                    @tommyboy180:

                    I just did those options and I found countryblock logs within the firewall logs.
                    The attached screenshot is from just now.
                    Edit: if the webGUI says it's running then it's running. There's no way it can be a false positive since it actually checks to make sure the countryblock tables are in pfctl.

                    Edit2: It only logs attempt coming inbound. If you try to ping out then it's not logged. Sorry for that confusion.

                    Still have not figured out the logging thing, but if I bring up pfTop and switch to the rules view I can see quite a few entries that contain "<countryblock>" and "<countryblockw>" (like "drop inet from <countryblock>to #") that have a byte and packet count >0.

                    So it is working for sure and I can monitor that directly.</countryblock></countryblockw></countryblock>

                    1 Reply Last reply Reply Quote 0
                    • T
                      tommyboy180
                      last edited by

                      @JackANSI:

                      @tommyboy180:

                      I just did those options and I found countryblock logs within the firewall logs.
                      The attached screenshot is from just now.
                      Edit: if the webGUI says it's running then it's running. There's no way it can be a false positive since it actually checks to make sure the countryblock tables are in pfctl.

                      Edit2: It only logs attempt coming inbound. If you try to ping out then it's not logged. Sorry for that confusion.

                      Still have not figured out the logging thing, but if I bring up pfTop and switch to the rules view I can see quite a few entries that contain "<countryblock>" and "<countryblockw>" (like "drop inet from <countryblock>to #") that have a byte and packet count >0.

                      So it is working for sure and I can monitor that directly.</countryblock></countryblockw></countryblock>

                      The actual logging portion that goes the to firewall logs Tab is controlled by pfctl and only incoming traffic is logged. So browsing a blacklisted IP will not create a log entry but someone from that country hitting the pfsense box will generate a log entry. Hope that clears it up some.

                      -Tom Schaefer
                      SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                      Please support pfBlocker | File Browser | Strikeback

                      1 Reply Last reply Reply Quote 0
                      • D
                        dlawley
                        last edited by

                        Current Status = NOT running
                        /tmp/rules.debug:18: Rules must be in order: options, normalization, queueing, translation, filtering

                        Starting to get this now.  I have uninstalled, reinstalled, no joy.

                        I have noticed every time I save/update it adds another line after "set limit table-entries 900000", from that line till your rules a newline is added at each save.

                        This is also where the error above is occuring.

                        pfsense 1.2.3, CB 0.2.0, any ideas?

                        –------------------------

                        dang, I went into my rules and turned one off then back on... now CB will save and run...  somethings up but at least running now.

                        1 Reply Last reply Reply Quote 0
                        • _
                          _igor_
                          last edited by

                          Installed countryblock on pf 2.0 RC1 from 26 Feb (full install, amd64), it starts but stops instantly. And on the interface-side, i don't have any option to enable/disable any interface. Only lan, which was enabled by default.

                          Other thing which is more conflicting to understand: at the box to enable you wrote "enable/disable". So any explanation would be right:

                          enable with box checked
                          disable with box checked.

                          Which one is the right? Seems to be new to put that inconsistent "enable/disable" to packages…

                          See picture to explain the "missing" interfaces:

                          countryblock.gif
                          countryblock.gif_thumb

                          1 Reply Last reply Reply Quote 0
                          • S
                            Supermule Banned
                            last edited by

                            Have you enabled the WAN interface?

                            1 Reply Last reply Reply Quote 0
                            • D
                              dlawley
                              last edited by

                              Just FYI, I had another error like before and it might be worthwhile to get your rules resaved.  I just disabled one and re enabled it and was able to go back without any issue with CB.

                              1 Reply Last reply Reply Quote 0
                              • _
                                _igor_
                                last edited by

                                @ supermule: Maybe i was not clear, so see the attached pic. I cannot activate nor deactivate wan, the checkbox is not preset!

                                It was just an installation and on overlooking the options to set them it was like shown at the pic.
                                @ dlawley: Which rules to resave? If you mean the country election, these ones i enabled and disabled all, selected only the "top ten", nothing changed the behaviour. Even deinstalled and installed newly, no change. :(

                                edit:

                                Looked at the interfaces.txt, which had this entries:

                                __csrf_magic
                                em0

                                deleted that entries and added "any" (only the word). Saved the file and reviewed the interface-section in webgui. Same as before. Only LAN, which is checked, the other 2 interfaces (WAN and GRE) don't have the check-boxes. If i save the setting, the 2 mentioned lines appear again in the interfaces.txt.
                                But now countryblock starts and seems to work.
                                Added the cron-entry. Maybe this could be made by the installer?

                                Thanks for help

                                1 Reply Last reply Reply Quote 0
                                • ?
                                  Guest
                                  last edited by

                                  Using cron w/ the command /usr/local/etc/rc.d/countryblock.sh with */1 * * * * root, I am unable to get country block to auto-start after it stops (from either a reboot or updating to the latest snapshot). Any tips by chance?

                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    tommyboy180
                                    last edited by

                                    This is what my cron job looks like. If you still can't get the cron to work, try executing the cron command from console to view any errors that it may be having.

                                    Untitled.png
                                    Untitled.png_thumb

                                    -Tom Schaefer
                                    SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                                    Please support pfBlocker | File Browser | Strikeback

                                    1 Reply Last reply Reply Quote 0
                                    • ?
                                      Guest
                                      last edited by

                                      That's exactly how mine looks as well :-(. Once it is on, I'm good to go. It's only when I restart the server or hit the auto-update firmware. I can then get it to start again easily using the GUI, I was hoping the cron would solve my woes. I have an update now to do so I will apply that and see if it happens again. As with through out this topic, thank you for being so active :-) I know how hard it is to dedicate the time we have so little of today to help others.

                                      Ah well maybe it is because it reinstalls the apps after the update, that would make sense no? lol, sorry I didn't think about it :-P

                                      1 Reply Last reply Reply Quote 0
                                      • _
                                        _igor_
                                        last edited by

                                        The "Enable/disable" checkbox does what?

                                        If countryblock is enabled, the box is not checked, so i check it and press "apply", countryblock ends disabled.
                                        If cb is disabled, the checkbox is disabled too. checking the box and pressing "apply" cb ends enabled. So is he function of this box as it says "enable/disable" or is there anything running wrong with cb? The checkbox is always not checked.

                                        I did a reinstall today due to updating pfSense (2.0 snap, amd64, full install) and the weird interfaces-section is still like before: Only lan has a checkbox, which is checked, the other interfaces don't have any checkboxes. Nor is anything checked. Interfaces.txt still contains "any".

                                        countryblock.gif
                                        countryblock.gif_thumb

                                        1 Reply Last reply Reply Quote 0
                                        • ?
                                          Guest
                                          last edited by

                                          I read your previous posts and didn't see this, but could you give us more information about your set up? Is this a virtual machine? What NIC hardware are you using per interface? Are you running other services?

                                          Also about this button that says both "enable/disable", where do you see this? Mine only says "Enable Country block" so with that in mind, by checking it you're enabling it.

                                          It's a little quircky to enable, first you select the countries you want to block, you click commit. After that it writes the information to a file. Then you check the box for "Enable Country Block"

                                          Though this is only useful once you're able to activate it once your WAN interface allows you to check it :-)

                                          @_igor_:

                                          The "Enable/disable" checkbox does what?

                                          If countryblock is enabled, the box is not checked, so i check it and press "apply", countryblock ends disabled.
                                          If cb is disabled, the checkbox is disabled too. checking the box and pressing "apply" cb ends enabled. So is he function of this box as it says "enable/disable" or is there anything running wrong with cb? The checkbox is always not checked.

                                          I did a reinstall today due to updating pfSense (2.0 snap, amd64, full install) and the weird interfaces-section is still like before: Only lan has a checkbox, which is checked, the other interfaces don't have any checkboxes. Nor is anything checked. Interfaces.txt still contains "any".

                                          countryblock.png
                                          countryblock.png_thumb

                                          1 Reply Last reply Reply Quote 0
                                          • ?
                                            Guest
                                            last edited by

                                            Also,

                                                    /* Go through the list of ports selected by the user,
                                                       build a list of port-to-interface mappings in portifmap */
                                                       conf_mount_rw();
                                                       $myFile = "interfaces.txt";
                                                                    $fh = fopen($myFile, 'w+');
                                            

                                            this is going to over-write any changes you make to interfaces.txt when you click save/apply or any other modifier that runs that script.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.