April 26, 2024, 05:27:15 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: How to block a particular website?  (Read 17443 times)

Offline neilg_cebu

  • Linux Noob !
  • *
  • Posts: 16
How to block a particular website?
« on: April 25, 2005, 07:41:57 AM »
Hi,

Is it possible to block a particular website? Our Linux box is being used as internet server. Client Computers will connect to internet thru this Linux server. Now, I want to block a website so that client computers will not be able to open them. Is that possible? How?


Thanks In Advance,
Neil

Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
How to block a particular website?
« Reply #1 on: April 25, 2005, 08:56:42 AM »
Ya
U can do this by making entry.... in /etc/squid/squid.conf file
open /etc/squid/squid.conf file in your favourite editor
acl blocksite  url_regex [-i]  www.yahoo.com
http_access deny blocksite
http_access  alllow all
 { Here www.yahoo.com is the name of site u want to block, U can block more aother sites also by mentioning it there}}


After that restart the service as:
#service squid restart
Aftaer that it will work
Enjoy
Gaurav

Offline neilg_cebu

  • Linux Noob !
  • *
  • Posts: 16
How to block a particular website?
« Reply #2 on: April 26, 2005, 02:11:31 AM »
Hi,

I tried as you suggested exactly the same but it did not block yahoo.

I tried opening yahoo and it still can open it. what am i missing here?

I am using Redhat Linux 9.0.

Regards,
Neil

Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
How to block a particular website?
« Reply #3 on: April 26, 2005, 03:35:39 AM »
ok

Did u restarted ur squid service after making changes.??
by
#service squid restart

if still the pb come... then ...
Send ur squid.conf file.??........., i willl check then i will suggest u .. what u r missing

i have to look upon that fiile... so if possible give ur squid.conf file

Enjoy
Gaurav

Offline neilg_cebu

  • Linux Noob !
  • *
  • Posts: 16
How to block a particular website?
« Reply #4 on: April 26, 2005, 03:52:47 AM »
y i restarted the service. it's was ok. but i still able to open yahoo.

i am not sure how to attach a file here. squid.conf is quite long to post here. where can I send it or how to attach a file here?

Many Thanks.

Neil

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
How to block a particular website?
« Reply #5 on: April 26, 2005, 04:08:16 PM »
umm..

Just post your acl part and http_access part .
BTW.. instead of modifying the original squid.conf, just create your own squid.conf with only directives which you want to modify, this way that will be easier to maintain. !

Offline rohitb

  • Linux Noob !
  • *
  • Posts: 8
Re: How to block a particular website?
« Reply #6 on: June 02, 2005, 09:21:26 AM »
Quote from: "neilg_cebu"
Hi,

Is it possible to block a particular website? Our Linux box is being used as internet server. Client Computers will connect to internet thru this Linux server. Now, I want to block a website so that client computers will not be able to open them. Is that possible? How?


Thanks In Advance,
Neil

What software r u using for sharing internet  "Squid or natting with iptables" If you are using iptables just add a rule to drop all connection to yahoo.com.It will block all the ip under that doamin.

Offline neilg_cebu

  • Linux Noob !
  • *
  • Posts: 16
How to block a particular website?
« Reply #7 on: June 03, 2005, 02:40:39 AM »
Hi Rohit,

Thanks for your reply. You might got me the other way around. I'd like to clarify my case:

We dont have any website, outside world is not connecting into us. In our LAN, I would like to limit users from browsing the internet. Such that, I would like to block them from accessing a particular website/webpage. So, in my case, I want to block outgoing... not incoming.

Can you please give a little example. I am using iptables not squid.

Thanks a lot,
Neil

Offline rohitb

  • Linux Noob !
  • *
  • Posts: 8
How to block a particular website?
« Reply #8 on: June 03, 2005, 04:34:29 AM »
Quote from: "neilg_cebu"
Hi Rohit,

Thanks for your reply. You might got me the other way around. I'd like to clarify my case:

We dont have any website, outside world is not connecting into us. In our LAN, I would like to limit users from browsing the internet. Such that, I would like to block them from accessing a particular website/webpage. So, in my case, I want to block outgoing... not incoming.

Can you please give a little example. I am using iptables not squid.

Thanks a lot,
Neil

Thats what i ment.You are using a single internet connection between your local lan.You just have to create a rule in iptables like this

iptables -A POSTROUTING -d sitename.com -p tcp -m tcp -j DROP

This will drop all connection to that site from lan.
DONE!!

Offline neilg_cebu

  • Linux Noob !
  • *
  • Posts: 16
How to block a particular website?
« Reply #9 on: June 03, 2005, 04:41:04 AM »
great! thank you so much rohit.

more power!

Offline mum_1978

  • New Member
  • Posts: 1
How to block a particular website?
« Reply #10 on: June 21, 2005, 10:03:10 AM »
Hi!
I am new here and this is the first time I am posting here. Ok, now I will try to solve this problem in this way assuming that u have 2 lan cards, one for your local lan, and u have iptables, then u may use this command or write it to your firewall script in order to host based website blocking (i.e blocking a particular site for a perticular host) :

iptables -A OUTPUT -s (ur source host IP here) -d (ur destination site name here) -j DROP

Offline ashishraj

  • Linux Noob !
  • *
  • Posts: 19
How to block a particular website?
« Reply #11 on: July 12, 2005, 05:06:40 AM »
hi gaurav

i want to block .exe files to stop downloading...
so what i do in squid.conf ?

and also adult websites there is lots of adult sites how can i do it ?

i m new in linux so explain in brief plz...
i m using redhat9 with squid.

Offline ilias

  • Linux Learner
  • ***
  • Posts: 116
How to block a particular website?
« Reply #12 on: July 12, 2005, 07:26:35 AM »
the below code is to blcok adult websites


#----------------blocked WEB--------------------
acl badURL url_regex -i kiran simran kamal actress vagina sex xxx slng adult tv valgur pets music greetings vikatan actor porno cinema actors datemanager cricinfo tamilsongs pics gallery Fashion wallpaper screensaver icontool games movie penis viagra insutall mx17183 sunpictures sexual dating  RealMedia game

#-----------------blocked SITES------------------------------
acl blocked_sites url_regex kathalnet.com cupidbay.com freeindianezines.com sushikids.nu elboricua.net adultplayerclub.com vorras.net kathala.com indiangirls.com indiaglitz.com dinamalar.com ferryhalim.com unclemelon.com infospace.com bidtxt.whenu.com qcpps.aol.com desibaba.com indiandreamgril.com schoolgirls.com pussy.com formatureaudienceonly.com cockpits.com 204.177.92.193 orgyfilms.com dinamaler.com kumudam.com chatting.com mallaimalar.com dinakaran.com dinamani.com msg.yahoo.com indiafm.com savenow.com tradeexit.com savenow.com g.corcme.gator.com xnxx.com archies.indiatimes.com 89.com indianmasaala.com precision-time.com sunnetwork.org datemanager.com screensaver.com downlood.com 123greetings.com dgreetings.com cricket.indiatimes.com greetwell.com espnstar.com cricinfo.com usa.cricinfo.com img.cricinfo.com suntv.com venus.goclick.com rosecards.com webpdp.gator.com dinamai.com miniclip.com empirepoker.com t45ol.com results.searchscout.com daily.webshots.com 2000greetings.com birthdaycards.com passionup.com us.greet1.yimg.com matchmaker.rediff.com dailythanthi.com tamlisex.com cgi.sexlist.com cinesouth.com naguever.com cini.com tamilcini.com cricketnext.com match.com ads.indiatimes.com indiamatch.com galatta.com kamalhaasan.net sulekha.com tamilmaasala.com masaalatime.com masti.net fad-408.mtl4.targetnet.com tamilmovies.com 1000download.com bignaturals.com privatehots.com mx17183.ff02.com mx18244.hh02.com peeperdorm.com ohmygoodies.com getweathercast.com worldsex.com virtuagirl2.com allposters.com ohmygoodies.com aishwaraya-rai.com simplysimran.com srija4u.com 1greatcelebsite.com pornstarbucks.com rock.com chellamay.com manmathan.com

http_access deny blocked_sites
http_access deny badURL

it svery simple, u have to write acl for that for eg

acl (acl_name) url_regex -i < add the name of the adult site>
acl adult_sites url_regex -i sex adult pussy

url_regex is the key word -i is to aviod case sentiviteness

then deny the above sites using acl

http_access deny adult_sites

I hope i would helped you

Offline ashishraj

  • Linux Noob !
  • *
  • Posts: 19
How to block a particular website?
« Reply #13 on: July 12, 2005, 11:07:49 AM »
yes thanks friend...

but what about .exe downloads ?
i want to stop downloads on clients machine.
only i can download sapratly.

Offline ilias

  • Linux Learner
  • ***
  • Posts: 116
How to block a particular website?
« Reply #14 on: July 13, 2005, 06:38:03 AM »
do write this acl to block download

acl download urlpath_regex .exe .zip
http_access deny download