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

    Country Block

    Scheduled Pinned Locked Moved pfSense Packages
    691 Posts 79 Posters 708.4k 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.
    • N
      natgear2510
      last edited by

      I upgraded to the 2.0 beta built on Saturday. I uninstalled Country Block rebooted. Then reinstalled country blocks. I selected all countries
      and unchecked Untied States. Then I commited the countries, checked enable, then click save. The program no longer hangs. The countryblock.txt List file does get updated. It will just not run. I have tried from command line countyrblock.sh and execute.sh. Nothing! No errors or anything. I just cant get it to run. I also have Snort installed.

      1 Reply Last reply Reply Quote 0
      • N
        natgear2510
        last edited by

        I believe that the problem may be within Apply changes. I just uninstalled and reinstalled, commited countries, hit enable the save, it prompts you to apply changes. Current Satus = not running  / You are blocking 0 networks.

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

          Country Block has not been running or would not stay running for a few versions now for me. I am running 1.2.3 release. When I try to run countryblock.sh from shell I get this.

          countryblock.sh: 43: Syntax error: "done" unexpected (expecting "then")

          1 Reply Last reply Reply Quote 0
          • N
            natgear2510
            last edited by

            php: /packages/countryblock/countryblock.php: The command 'sh execute.sh' returned exit code '2', the output was '^M: not found ^M: not found pfctl: Unknown table command 'kill^M' usage: pfctl [-AdeghmNnOqRrvz] [-a anchor] [-D macro=value] [-F modifier] [-f file] [-i interface] [-K host | network] [-k host | network ] [-b host | network ] [-o [level]] [-p device] [-s modifier ] [-t table -T command [address …]] [-x level] sed: /tmp/rules.debug^M: No such file or directory ^M: not found ^M: not found ^M: not found execute.sh: arith: syntax error: "72^M+1" '

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

              I found out that bash scripts will sometimes operate weird with foreign spaces and what not. While trying to debug the script I noticed it the file was in DOS format when saving. Creating a new file and pasting the script into it fixed my problem.

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

                Hey natgear. Seeing all those control codes (^M) makes me think you are having a similar problems.

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

                  I know the problem. Windows likes to format my code before I upload it. I'm re-committing the package so hopefully it will be fixed here in the next 15 min.

                  -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
                  • T
                    tommyboy180
                    last edited by

                    @g4m3c4ck:

                    I found out that bash scripts will sometimes operate weird with foreign spaces and what not. While trying to debug the script I noticed it the file was in DOS format when saving. Creating a new file and pasting the script into it fixed my problem.

                    Exactly right. I removed the weird windows spacing and it corrected the problem. Just need to re-commit those changes.

                    -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
                      g4m3c4ck
                      last edited by

                      Yeah, execute.sh had the problem too. :) After fixing it everything worked again. In pfSense 1.2.3 that is

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

                        Hey Tommy. It says

                        Current Status = Running

                        You are blocking 0 Networks

                        yet says Currently 251 of 252 selected.

                        Kind of funny if you ask me :)

                        Edit:
                        Looked into it a little more.

                        pfctl -T show -t countryblock |grep -v -c Z
                        pfctl: Table does not exist.

                        After looking which tables existed in pfctl mine showed only

                        countryblockW

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

                          Okay. It should be fixed. I just verified it working on 1.2.3 and 2.0BETA 5.

                          Go ahead and uninstall your current package and then install the package. If it isn't working when you re-install then reboot. I had to do that for 1.2.3 for some reason.

                          Thanks for notifying me it wasn't working.

                          -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
                          • N
                            natgear2510
                            last edited by

                            **Current Status = Running

                            You are blocking 71147 Networks**

                            Looks like your magic has worked!!!!!! Installed and running good on 2.0 beta 5

                            Thanks for the quick update!!!!!!!! Awesome!!!!!!!

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

                              Mine still has same issue.

                              Current Status = Running

                              You are blocking 0 Networks

                              I have uninstalled it and reinstalled it and rebooted

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

                                Ok I found out why I was having problems and others were not. I am running pfSense webGUI on an non-standard port.

                                This line of code is the culprit to my problem.

                                exec("fetch -o lists/temp http://127.0.0.1/packages/countryblock/CIDR/{$line}_cidr.txt");

                                Using this method will also cause problems with people using https with the webgui as well.

                                I changed it to this to fix it

                                exec("cat CIDR/{$line}_cidr.txt >> lists/countries.txt");

                                Using fetch to get a local file was kind of ridiculous anyways but I know why you did it  ;D

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

                                  It is much quicker loading Tom :)

                                  Thx mate!

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

                                    @g4m3c4ck:

                                    Ok I found out why I was having problems and others were not. I am running pfSense webGUI on an non-standard port.

                                    This line of code is the culprit to my problem.

                                    exec("fetch -o lists/temp http://127.0.0.1/packages/countryblock/CIDR/{$line}_cidr.txt");

                                    Using this method will also cause problems with people using https with the webgui as well.

                                    I changed it to this to fix it

                                    exec("cat CIDR/{$line}_cidr.txt >> lists/countries.txt");

                                    Using fetch to get a local file was kind of ridiculous anyways but I know why you did it  ;D

                                    Yeah, I did that to cut down on bandwidth usage for countryipblocks but I never thought about https. I will update the package when I get home to correct this issue. Thank you for posting the fix.

                                    -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
                                      g4m3c4ck
                                      last edited by

                                      No problem! I enjoyed figuring it out. ;)

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

                                        I pushed the update and tested on 2.0BETA 5. I left a little something in the source for you g4m3c4ck.

                                        -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
                                          g4m3c4ck
                                          last edited by

                                          Thanks man I appreciate it. Hopefully I can find more time to be more active in the community.

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

                                            @g4m3c4ck:

                                            Thanks man I appreciate it. Hopefully I can find more time to be more active in the community.

                                            It's a lot of fun. You get to create packages that are used to help other people. All credit goes to you but other people also get to build off of your work.

                                            Right now I'm working on a dspam package. If you want you could write the GUI for it while I do the back end. I can start you off with what I have. Let me know if you want to.

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