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

    How to block HTTPS website?

    Scheduled Pinned Locked Moved General pfSense Questions
    21 Posts 10 Posters 76.1k 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.
    • M
      mdima
      last edited by

      Quite easy… even if it needs some maintenance sometimes.

      1. Get the info about the Facebook public IPs
      2. Create an alias that contains all the Facebook networks
      3. Create a firewall rule that block that traffic

      For the details:
      Facebook IPs
      I got them from ARIN (http://whois.arin.net/rest/org/THEFA-3.html, click on related networks). They are:
      69.171.224.0/19
      74.119.76.0/22
      204.15.20.0/22
      66.220.144.0/20
      69.63.176.0/20
      173.252.64.0/18

      Alias
      Just create an Alias:
      Name: Facebook_Network (for example)
      Type: Network(s)
      Networks: All the above networks. Pay attention to the CIDR (/XX in the above entries) that must be specified with the dropdown-list

      Firewall rule
      Once you save and apply the alias, go on firewall, rules, LAN, add new rule. Just specify:
      Action: Block
      Interface: LAN
      Protocol: Any
      Source: Any
      Destination: Singole host or alias, then type Facebook_Network (or the name of the alias you typed before)
      Description: Blocks Facebook Networks (or whatever you want to type here)

      Save the rule.
      After that you should put that rule in the FIRST row of the table in order to avoid that before this rule other "pass" rules are applied. For this, just select the rule you just created (checkbox), then click the "<" arrow of the first rule in the table, this will put your "Blocks Facebook Networks" on top of the list.

      That's it.

      If you close and reopen all your browsers you should not be able to open facebook. If you are bored about the "keep alive" connections, just:

      1. Force a "reload filter" from the "Status=>Filter reload" menu;
      2. If it still persists (keep alive connections), reset the states (Diagnostic=>States=>Reset states)

      I hope everything is clear and easy…

      Michele

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

        Yes, your list of IPs looks much better!  ;)
        Also happy to see our instructions seem to match up.

        Steve

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

          but your answer is better, I don't have any screenshot… :D
          we were answering in the same time...

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

            Glad if any of three same kind suggestions may help

            1 Reply Last reply Reply Quote 0
            • marcellocM
              marcelloc
              last edited by

              an alias to apps.facebook.com can do the job also.

              Treinamentos de Elite: http://sys-squad.com

              Help a community developer! ;D

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

                @stephenw10:

                Squid can't proxy https traffic. You have to block all https to force people to use the proxy.

                You could block all https and then allow it only to sites you need.

                As Metu69salemi suggested, create an alias containing all of facebook's IPs and block that.

                Steve

                Squid can indeed proxy HTTPS traffic. I think what you refer to is due to the design of the HTTPS protocol it is not possible (with any software) to setup a transparent HTTPS proxy.

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

                  Hmm, I stand corrected.
                  I would think, though, that in this case it wouldn't be useful since as you say it can't be transparent.
                  This raises some interesting questions about the end-to-end encryption of https.  :-
                  More reading required….

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • marcellocM
                    marcelloc
                    last edited by

                    Squid can indeed proxy HTTPS traffic. I think what you refer to is due to the design of the HTTPS protocol it is not possible (with any software) to setup a transparent HTTPS proxy.

                    It could be done, but requires some 'nasty' configuration.

                    You have to create a local CA, install CA certificate on users machines and forward all https to your local web server with proxy mode, just like man-in-the-middle attack.

                    Imspector has this options to proxy msn_https communication and create self-signed certificates to match common-name client check.

                    Treinamentos de Elite: http://sys-squad.com

                    Help a community developer! ;D

                    1 Reply Last reply Reply Quote 0
                    • S
                      sudo
                      last edited by

                      Hi All,

                      Thank you so much for suggestions.

                      thx.

                      1 Reply Last reply Reply Quote 0
                      • E
                        emel_punk
                        last edited by

                        Well….

                        i have recently discover on linux how to block sites per contain so any string that contains facebook, will be block

                        iptables -A FORWARD -p tcp -m string --string "facebook" --algo kmp -j DROP

                        i works for me... i do not know if with ipfw will  have some simillar parameter ... i hope seo because im about to migrate to pfsense

                        @sudo:

                        Hi All,

                        Anybody know how to block HTTPS base sites. (ex. https://facebook.com) without blocking only 443 port. because It block all the https base site. I want to block only mail sites.

                        Thanks in Advance

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

                          pfSense uses pf(4) not ipfw. Though it does use ipfw for the captive portal function.
                          I think you may out of luck translating that from iptables.  :-\

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • johnpozJ
                            johnpoz LAYER 8 Global Moderator
                            last edited by

                            "This raises some interesting questions about the end-to-end encryption of https."

                            Depends on how your doing it – by default its just a Tunnel that squid passes the packets through - it has no understanding of what is inside the tunnel.  Which is why it can be difficult to filter on https urls, etc.

                            here is a good read on how squid can handle https and or any other protocol you want to allow through the proxy
                            http://wiki.squid-cache.org/Features/HTTPS

                            An intelligent man is sometimes forced to be drunk to spend time with his fools
                            If you get confused: Listen to the Music Play
                            Please don't Chat/PM me for help, unless mod related
                            SG-4860 24.11 | Lab VMs 2.8, 24.11

                            1 Reply Last reply Reply Quote 0
                            • R
                              rjcrowder
                              last edited by

                              @stephenw10:

                              pfSense uses pf(4) not ipfw. Though it does use ipfw for the captive portal function.
                              I think you may out of luck translating that from iptables.  :-\

                              Steve

                              If you don't mind setting up the rules manually, you can activate the portal and then create your own ipfw rules. The only trick is to make the last step in your rules skip over the portal rules (assuming you don't want captive portal functionality).

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