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

    IP-Blocklist

    Scheduled Pinned Locked Moved pfSense Packages
    496 Posts 86 Posters 556.6k 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.
    • T
      tommyboy180
      last edited by

      The lists can be any format such as .txt, .list, .IPs, and even no extention as long as they are plain text lists. If they are compressed then .gz is the only supported compression.

      You list (http://www.countryipblocks.net/e_country_data/Asia_cidr.txt) is not in the correct format. Lists have to be in the PG2 format (Asia:58.16.15.56-58.100.0.100)

      For country IPs you can either find countries at http://iblocklist.com/lists.php or make you own list.

      I make my own lists at http://gskinner.com/RegExr/
      For example I want to convert a .csv of IPs from www.stopforumspam.com to the PG2 format.

      • Paste all the IPs in http://gskinner.com/RegExr/

      • Click find a replace, do a find for "\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b" and a replace for "\nIP:$&-$&"

      Now that only works for single IP addresses

      Since your list (http://www.countryipblocks.net/e_country_data/Asia_cidr.txt) is in CIDR format then you will have to find a script or online application to convert CIDR to IP range.
      Here is a link that can help you convert CIDR to IP range: http://www.unix.com/shell-programming-scripting/34301-get-ip-list-cidr-2.html
      Once you convert your list to IP range then you have to convert to PG2 format with http://gskinner.com/RegExr/

      If you are going to use www.countryipblocks.net then download the "IP range" list and convert to PG2 Format

      -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
      • H
        Hugovsky
        last edited by

        speaking of iblocklist.com, it's as simple as copying the "http://list.iblocklist.com/?list=bt_level1" to add list url and that's it? or do I have to do it some other way?

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

          It is that simple.  :)

          Just make sure you get the true url. Since the link you posted is a pointer to several mirrors that host that file you need to click that link and then copy the url to paste into the package.

          Example: http://list.iblocklist.com/?list=bt_level1  points to http://iblocklist.dbnservers.net/files/bt_level1.gz
          So you would paste http://iblocklist.dbnservers.net/files/bt_level1.gz into the package.

          -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
          • H
            Hugovsky
            last edited by

            got it! thanks mate ;) This package is very nice.

            1 Reply Last reply Reply Quote 0
            • jimpJ
              jimp Rebel Alliance Developer Netgate
              last edited by

              @tommyboy180:

              Since your list (http://www.countryipblocks.net/e_country_data/Asia_cidr.txt) is in CIDR format then you will have to find a script or online application to convert CIDR to IP range.

              That is a large step backward. CIDR lists are much faster since pf supports them natively, and your app has to translate them back into CIDR lists anyhow. Converting them away from CIDR format will only slow things down.

              It should be fairly easy to add support for CIDR lists to your app, or the person who wants to use CIDR lists can just use the URL Table Alias package instead, which currently only does CIDR or IP lists, since that's pf's desired format.

              Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

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

                I still get this when hitting save/update

                Warning: file_get_contents(wlists.txt): failed to open stream: No such file or directory in /usr/local/www/packages/ipblocklist/ipblocklist.php on line 30

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

                  @jimp:

                  @tommyboy180:

                  Since your list (http://www.countryipblocks.net/e_country_data/Asia_cidr.txt) is in CIDR format then you will have to find a script or online application to convert CIDR to IP range.

                  That is a large step backward. CIDR lists are much faster since pf supports them natively, and your app has to translate them back into CIDR lists anyhow. Converting them away from CIDR format will only slow things down.

                  It should be fairly easy to add support for CIDR lists to your app, or the person who wants to use CIDR lists can just use the URL Table Alias package instead, which currently only does CIDR or IP lists, since that's pf's desired format.

                  Jimp,
                  I completely agree with you. In fact CIDR is supported in pf (edit-I see you pointed that out above). The reason is because my package is specifically written for a specific format, the PG2 format. This PG2 format requires IP address ranges. The package then converts the ranges to CIDR format to import into a pf table.

                  With this being said I know it seems completely backwards to begin with but for those who have wanted PeerGuardian2 or Peer Block at the router level can defiantly appreciate this package and the list format it requires.

                  My suggestion for those who want to block countries is to first look at iblocklist.com for that country, if they don’t have your country then download the IP range list and convert.

                  @g4m3c4ck:

                  I still get this when hitting save/update

                  Warning: file_get_contents(wlists.txt): failed to open stream: No such file or directory in /usr/local/www/packages/ipblocklist/ipblocklist.php on line 30

                  Browse to the Whitelist page, the error will go away.

                  EDIT2:
                  If there are enough people out there that would like to see a Country block package, I can make that in a couple hours. Just keep in mind that iblocklist.com has several countries already in the PG2 format and I am sure you can find every country in this format somewhere in the intertubes.

                  -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

                    YES PLEEEEASE!! ;)

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

                      Haha.

                      Well I think that's enough for me. Look for the Country Block package here soon.

                      -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
                      • K
                        killervette
                        last edited by

                        Will this allow me to block all countries except the US?

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

                          Yes…

                          @killervette:

                          Will this allow me to block all countries except the US?

                          1 Reply Last reply Reply Quote 0
                          • M
                            mgc6288
                            last edited by

                            I got most of the PG2 packages installed from iblocklist.com except the country ones which didn't come up in .gz format.  Reading the previous posts, I went to www.countryipblocks.net and made the "IP Range" for the countries desired and then attempted the gskinner.com which got me all confused.  I didn't understand the "find a replace, do a find for… and a replace for..." in reply #53.

                            This leads me to my question - is there a simple PG2 file that has all the countries in one and then if I were to add individual countries on the whitelist would that override the manual list?

                            I ask this so that everything is blocked by default unless I were to specifiy otherwise without having to reparse a new list (or add every single country individually) everytime I need to give access to a certain country.

                            Otherwise this is a really cool package and thank you!

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

                              Good morning

                              I just want to block the ip of at least 4 websites ip.. How to do that? What if they will use https?

                              jigp
                              1.2.2 pfsense

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

                                @jigpe:

                                Good morning

                                I just want to block the ip of at least 4 websites ip.. How to do that? What if they will use https?

                                jigp
                                1.2.2 pfsense

                                You will need to create a small list

                                Website1:192.168.1.100-192.168.1.100
                                website2:192.168.1.101-192.168.1.101
                                website3:192.168.1.102-192.168.1.102
                                website4:192.168.1.103-192.168.1.103
                                

                                That list will work perfect. Now just upload the list to a site where you can download and add to the package.

                                -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
                                • H
                                  Hugovsky
                                  last edited by

                                  Anothe thing: I use my pfsense box to establish adsl connection with isp. Whenever it reconnects, ip-blocklist is disabled because pfsense reloads stuff. Can this be corrected?

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

                                    thanks for the reply, but its about exceptions tom..i have two users.user1 is allowed to access https site2 and https site1 but is not allowed to access https site3..user2 is not allowed to access https site2 and https site3 but allowed to access https site1..i can block http sites but i cannot block https :(..i need to open 443 because i use gmail and other email that uses 443..the sites that im going to block is facebook.com, youtube.com,friendster.com and multiply.com. i already block http using squid..but user will use https, i cannot block https :( please share your knowledge…thanks

                                    jigp
                                    1.2.2

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mgc6288
                                      last edited by

                                      Here's a question.  I have taken this as straight forward but apparently I'm doing something wrong.  I installed the package, added the URLs (with .gz), rebooted, and then "Save/Update" however the status continues to say "NOT running" and even after rebooting.

                                      I did find a post mentiong a possible uninstall/reboot/reinstall/reboot/add .gz URLs/reboot/enable would work but alas it has not.  Please verify what I may be doing wrong.  Thank you.

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

                                        Use Firefox as a browser….. I did an it worked...

                                        @mgc6288:

                                        Here's a question.  I have taken this as straight forward but apparently I'm doing something wrong.  I installed the package, added the URLs (with .gz), rebooted, and then "Save/Update" however the status continues to say "NOT running" and even after rebooting.

                                        I did find a post mentiong a possible uninstall/reboot/reinstall/reboot/add .gz URLs/reboot/enable would work but alas it has not.  Please verify what I may be doing wrong.  Thank you.

                                        1 Reply Last reply Reply Quote 0
                                        • M
                                          mgc6288
                                          last edited by

                                          @Supermule:

                                          Use Firefox as a browser….. I did an it worked...

                                          Hey good idea lol…I normally use Opera and when things don't work I try out IE which seems to be the "overall default" of web designers.  Here is what I receive when I used Firefox:

                                          (after a minute and by itself)
                                          Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 81 bytes) in /etc/inc/util.inc on line 380

                                          (right below "Current Status = NOT running")
                                          /tmp/rules.debug:90: syntax error

                                          I did upgrade my system from 256MB to 768MB even though the above bytes considered 128MB...some allocation somewhere that needs to be set?

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

                                            @mgc6288:

                                            @Supermule:

                                            Use Firefox as a browser….. I did an it worked...

                                            Hey good idea lol…I normally use Opera and when things don't work I try out IE which seems to be the "overall default" of web designers.  Here is what I receive when I used Firefox:

                                            (after a minute and by itself)
                                            Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 81 bytes) in /etc/inc/util.inc on line 380

                                            (right below "Current Status = NOT running")
                                            /tmp/rules.debug:90: syntax error

                                            I did upgrade my system from 256MB to 768MB even though the above bytes considered 128MB...some allocation somewhere that needs to be set?

                                            The Allowed memory error is the webserver hitting a limit set in php.ini. You can increase this limit if you like, however the package will still work properly just let it finish before you refresh the page. In FF you can still see the loading animation in the tab even with that error, wait for that to finish.

                                            Take a look at Cino's post on page 2 http://forum.pfsense.org/index.php/topic,24769.msg130002.html#msg130002

                                            EDIT: You only get this error when you use large lists or a huge collection of lists.

                                            -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.