LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 05-31-2012, 08:09 AM   #1
klauriens
LQ Newbie
 
Registered: Jan 2011
Posts: 10

Rep: Reputation: 0
Blacklist a page inside a whitelisted website


Hi,

We are using squid as proxy. We are whitelisting sites and the rest are denied. I need a help in blacklisting a certain webpage or section inside a whitelisted website. Say, we whitelisted "www.myweb.com". I need to allow all its content excep "www.myweb.com/denyme".

Thanks a lot
 
Old 05-31-2012, 08:41 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,973

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Hi,

You can use:
Code:
acl denyme url_regex -i ^http://www.myweb.com/denyme
...
## put the following before the ACL allowing access to http://www.myweb.com
http_access deny denyme
...
Regards
 
1 members found this post helpful.
Old 06-20-2012, 10:20 AM   #3
klauriens
LQ Newbie
 
Registered: Jan 2011
Posts: 10

Original Poster
Rep: Reputation: 0
Hi,

Sorry for the late reply on this. I have tried your suggestion but it still doesn't work. Our linux system was created in a way like we are only defining what to whitelist and the rest are blacklisted. That is why I think blacklisting doesn't apply to our system.
What do you think of that? Is there other way to block that webpage.

Thanks,
 
Old 07-02-2012, 05:59 PM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,973

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
What happens if you put the "http_access deny denyme" before any other "http_access ..." directive?
If it still doesn't work, you could post squid.conf, so we can understand better your ACLs
 
Old 07-09-2012, 08:33 AM   #5
klauriens
LQ Newbie
 
Registered: Jan 2011
Posts: 10

Original Poster
Rep: Reputation: 0
Hi, please bear with me..here are the codes. I dont really know from where to where should I copy and post here but the codes below are the ones that I only play around.

#
http_access allow localhost

acl managers src "/etc/squid/managers"
acl whitelist dstdomain -i "/etc/squid/whitelist"
acl youtubelink url_regex -i "/etc/squid/youtubelinks"

http_access allow managers
http_access allow whitelist all
http_access allow youtubelink all

http_access deny all
#

Thanks,
 
Old 07-09-2012, 09:52 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,973

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Ok
Put the acl from post #2 along with the others and the "http_access deny .." before any "http_access allow ..."
E.g.
Code:
#
http_access allow localhost

acl managers src "/etc/squid/managers"
acl whitelist dstdomain -i "/etc/squid/whitelist"
acl youtubelink url_regex -i "/etc/squid/youtubelinks"
acl denyme url_regex -i ^http://www.myweb.com/denyme

http_access deny denyme
http_access allow managers
http_access allow whitelist all
http_access allow youtubelink all

http_access deny all
#
Note that the "http_access .." directives are read from top to bottom, so if for example you want to allow access to the denyme URL for your managers, you should move the "http_access allow managers" before the one denying access to it.
 
1 members found this post helpful.
Old 07-10-2012, 11:06 AM   #7
klauriens
LQ Newbie
 
Registered: Jan 2011
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks bathory but it is still not working.

here is my current code now:
#
http_access allow localhost

acl managers src "/etc/squid/managers"
acl whitelist dstdomain -i "/etc/squid/whitelist"
acl youtubelink url_regex -i "/etc/squid/youtubelinks"
acl denyme url_regex -i ^https://test.myweb.com/denyme.aspx

http_access deny denyme
http_access allow managers
http_access allow whitelist all
http_access allow youtubelink all

http_access deny all
#

Notice that I changed the url into: https://test.myweb.com/denyme.aspx
That is because that's the format of the actual url. I'm sorry if I don't mentioned earlier because I'm thinking there is no such difference.

I am whitelisting "test.myweb.com" inside the "whitelist" acl so that everything under test.myweb.com will be whitelisted except for "test.myweb.com/denyme.aspx" which I want to blacklist.
Inside "whitelist" acl, we dont define if it is an "http" or "https" so when we put "test.myweb.com", it whitelisted it whether it is an https or http only.

Please help me out.

Thanks,
LA
 
Old 07-10-2012, 06:48 PM   #8
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,973

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
That is because that's the format of the actual url. I'm sorry if I don't mentioned earlier because I'm thinking there is no such difference.
Unfortunately it makes a big difference.
When you use squid to access an SSL site, you can block the entire site, but not a specific url of that site, because the url is transferred encrypted. Thus you can use:
Code:
acl denyme dstdomain test.myweb.com
act CONNECT method CONNECT
http_access deny CONNECT denyme
But not
Code:
acl denyme url_regex -i ^https://test.myweb.com/denyme.aspx
act CONNECT method CONNECT
http_access deny CONNECT denyme
Quote:
Inside "whitelist" acl, we dont define if it is an "http" or "https" so when we put "test.myweb.com", it whitelisted it whether it is an https or http only.
I guess you can still access a https site that is not in the whitelist file.
 
1 members found this post helpful.
Old 07-11-2012, 07:38 AM   #9
klauriens
LQ Newbie
 
Registered: Jan 2011
Posts: 10

Original Poster
Rep: Reputation: 0
Hi bathory,

I see. That is also what I am thinking that is why I posted a new thread last Jul 4th. http://www.linuxquestions.org/questi...80#post4719080

We cannot access https site if it is not inside the "whitelist" file because it seems that we have blocked the SSL ports.

That means we can never block a certain url inside a site. Please confirm. Is there no other workaround?
if there is none, then that would be the end of it and I will immediately inform my supers.

Thanks,
LA
 
Old 07-11-2012, 09:20 AM   #10
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,973

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
That means we can never block a certain url inside a site. Please confirm. Is there no other workaround?
AFAIK there is no way to block specific URLs inside a https site. You may see this for an explanation

Regards
 
  


Reply

Tags
blacklist, linux, proxy, squid, whitelist


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UBUNTU 11.10 apache do not process PHP code inside HTML page dvah Linux - Newbie 11 05-27-2012 09:08 AM
modem-manager: (tty/ttyS0): port's parent platform driver is not whitelisted jonaskellens Linux - Newbie 0 09-09-2011 07:40 AM
Can't see internally hosted website when inside the network xmrkite Linux - Software 1 02-09-2011 06:05 PM
linux website configuration - home page casperdaghost Linux - Newbie 2 03-25-2010 06:36 PM
Allow/Deny access to page on website in RHEL5 sandeshsk007 Linux - Server 0 10-26-2007 12:15 PM


All times are GMT -5. The time now is 11:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration