17

I have to find a way to block porn sites on all browsers through something system-wide like iptables (just an idea)... Is there any way that I can do that.

9
  • 13
    If you do this yourself: your list of blocked sites is open ended so impossible to set up (porn sites pop up faster than you can block them). The better option is to -white-list what is acceptable for users to visit. Otherwise you will need to depend on an app for that specific browser or a DNS that blocks it for you
    – Rinzwind
    Nov 9, 2015 at 14:07
  • 4
    You don't need to block them yourself, you should use a more sane approach like using OpenDNS category blocks instead. No maintenance and almost impossible to evade (if you know your stuff).
    – Braiam
    Nov 9, 2015 at 14:08
  • I did this myself with my router running dd-wrt and pixelserver. It isn't that difficult. This way you can block porn on your entire lan network (including advertisements). Just add a porn dns database. If you just want to block porn on that one pc this isn't for you. try opendns instead. howtogeek.com/51477/…
    – Akisame
    Nov 9, 2015 at 14:45
  • 5
    On a related note - is there one that unblocks it? :) Nov 9, 2015 at 19:54
  • 2
    @Braiam I think you're severely underestimating the amount of time and effort teenagers will spend to get to porn :-) I learned more about networking in High school from getting WoW to play on the school network than in any class in university (ok that might be slight hyperbole)
    – Voo
    Nov 9, 2015 at 22:08

7 Answers 7

18

You can also use the service openDNS, which limits the name resolution based on the pre-set filters. Compared to the solution proposed for the /etc/hosts file it allows you to not have to constantly update the list. Once you have set your own filters just use openDNS as name server. https://www.opendns.com/home-internet-security/

7
  • 3
    Additionally, you can do this at router level, covering all devices. It doesn't stop somebody just specifying 8.8.8.8 as their DNS server though. That would bypass this immediately.
    – Oli
    Nov 9, 2015 at 14:10
  • 2
    @Oli not at all. Just preventing forwarding of port 53 should be enough.
    – Braiam
    Nov 9, 2015 at 14:11
  • using a proxy server or proxy chain is best, but you have to subscribe to a blacklist of some sort.
    – Panther
    Nov 9, 2015 at 14:16
  • OpenDNS is awesome, but just make sure you set everything up right, because there's some configuration.
    – Daniel
    Nov 9, 2015 at 14:22
  • @Braiam So use a DNS server on another port. If necessary, set yourself as the DNS server, and proxy DNS requests to a server outside the firewall.
    – user253751
    Nov 10, 2015 at 6:03
7

There are several ways to do this

  • Easiest, IMHO, is to use opendns

Opendns has been asked here:

How to configure OpenDns

Once it is configured you configure it here - https://www.opendns.com/welcome/

The advantage is that blacklists are then maintained by opendns.

  • The second method is to install and configure a proxy server . You can do this with dansguardian, privoxy, or squid to name a few. You then configure iptables to route all traffic through the proxy or proxy chain.

http://blog.bodhizazen.com/linux/web-content-filtering-made-easy/

http://blog.bodhizazen.com/linux/how-to-transparent-proxy/

The disadvantage of this method is that you have to manually update and maintain the blacklist.

http://www.squidguard.org/blacklists.html or subscribe to a service.

  • You can use iptables, but iptables is inefficient, and you again have to manually maintain a blacklist.

  • you can use a hosts file. You have to obtain and update the list yourself.

http://winhelp2002.mvps.org/hosts.htm

The above link is more for adblock.

The "problem" is that these sites tend to change ip and host names ;)

5

There's no such thing as "software that blocks porn" -- artifical intelligence is nowhere near up to the job. All you can get is software that blocks websites that someone has blacklisted -- they may be diligently identifying and blocking porn websites, in which case they'll block some (but far from all) porn, or they may be blacklisting their competitors' websites or sites that they object to ideologically.

2
  • 1
    Do you have any evidence that blacklists actually exist which are maintained by porn website operators in order to block their competitor's websites?
    – jwg
    Nov 10, 2015 at 11:06
  • 2
    Not porn website operators, but Internet censorship companies. And no, I don't have any evidence, because such companies don't publish their blacklists, so they're completely unaccountable for them.
    – Mike Scott
    Nov 10, 2015 at 11:43
2

Various software like Net Nanny, etc. can be used. Alternatives of Net Nanny for linux users may be:

  1. Pluckeye: http://www.pluckeye.net/
  2. e2guardian: http://e2guardian.org/
  3. NxFilter :http://www.nxfilter.org/
1
  • DansGuardian is outdated and no longer maintained. Its successor is named e2guardian: e2guardian.org. If you wanted to use DansGuardian, you should use e2guardian instead. May 10, 2017 at 23:00
1

Every tool and way fights only with the sites existing at the time of creation of that tool, which are already quite many (sadly). No software or black list can predict what is going to appear. So every tool will be a temporary remedy. It is impossible to solve such problems with software.

Find such a tool inside yourself and the people who use computer.

0

You can do this easily by editing the file /etc/hosts. Simply add lines for sites you wish to block by referring the site to an IP address of 0.0.0.0, like this:

127.0.0.1   localhost
127.0.1.1   mycomputer

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

0.0.0.0 site.to.block.com
0.0.0.0 another.site.net
7
  • 3
    This is a "good idea", but like my comments to the other answer, editing this one by one will cause a massive headache and a lot of edits needing to be done regularly. I think they're looking for a parental / content control solution that doesn't need manual intervention.
    – Thomas Ward
    Nov 9, 2015 at 14:07
  • 2
    that list is going to so long it will eat up all your memory when it is getting parsed.
    – Rinzwind
    Nov 9, 2015 at 14:08
  • 2
    This is just impractical if it's a entire category of sites. This would be "ok" it it was 10 or 20 sites, but there are just so much porn hosts everywhere.
    – Braiam
    Nov 9, 2015 at 14:10
  • My list is some 15,000 items long. I use this: winhelp2002.mvps.org/hosts.htm
    – chili555
    Nov 9, 2015 at 14:26
  • @chili555 - FYI - That list is mainly adblock and will allow pR0n
    – Panther
    Nov 9, 2015 at 14:50
0

Try adding an entry to the /etc/hosts file. Open up your terminal and type:

sudo -H gedit /etc/hosts

Add a line for every site you want to block, e.g.

127.0.0.1   www.example.com

Then save the file. You may need to restart in order for the changes to take effect.

Note: this will block access to the particular host from all software, not only the browsers.

3
  • 2
    This doesn't solve what the OP wants - they want complete blocking of certain types of sites, managing that manually is infinitely difficult.
    – Thomas Ward
    Nov 9, 2015 at 14:04
  • 1
    @ThomasW. I think if OP does a little bit of research re will find good host files for him.
    – Marton
    Nov 9, 2015 at 14:09
  • 2
    @Marton Agreed, however there is a hugely massive list of things - they'd be better off to whitelist things, such as in the firewall, or implement a proxy on their network that all data routes through. Either way, there's headaches.
    – Thomas Ward
    Nov 9, 2015 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .