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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-27-2012, 03:26 PM
|
#1
|
LQ Newbie
Registered: May 2012
Posts: 12
Rep:
|
squid3 acl's
Hi, I need some help with squid acl that doesn't seems to be working. I have install squid3 and it seems to be routing the traffic. In the squid.conf file I have put a acl but it's not working.
Code:
acl bad_sites dstdomain .facebook.com
http_access deny bad_sites
I can post the config file but not sure how to easily remove comments from the config file. Thanks
|
|
|
05-27-2012, 05:03 PM
|
#2
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,198
|
Hi,
Quote:
I can post the config file but not sure how to easily remove comments from the config file.
|
You can use:
Code:
grep -v ^# squid.conf > squid.conf.txt
Regards
|
|
|
05-27-2012, 05:32 PM
|
#3
|
LQ Newbie
Registered: May 2012
Posts: 12
Original Poster
Rep:
|
Thanks!!!. Here is the conf file
Code:
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl bad_sites dstdomain *.facebook.com
acl nav src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow nav
http_access deny bad_sites
http_access deny all
http_port 8080
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
|
|
|
05-28-2012, 12:19 AM
|
#4
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,198
|
So, what exactly is not working?
If you want to deny access to bad_sites for your LAN, you should use the "http_access deny bad_sites" directive, before the "http_access allow nav"
Code:
<snip>
http_access deny bad_sites
http_access allow nav
http_access deny all
<snip>
Regards
|
|
|
05-28-2012, 01:23 AM
|
#5
|
Senior Member
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,638
Rep:
|
What if you try to change the acl from dstdomain to url_regex or url_path_regex? Does this work? But this will be more restrictive and you need to understand how it will work.
|
|
|
05-28-2012, 07:58 AM
|
#6
|
LQ Newbie
Registered: May 2012
Posts: 12
Original Poster
Rep:
|
Thanks!!!. I will give this both suggestions a try later today and let you know the results.
The bad_sites .facebook.com is not blocked by the acl. And I will try to read up on regex as well and see how that works. Thanks!
|
|
|
05-28-2012, 05:54 PM
|
#7
|
LQ Newbie
Registered: May 2012
Posts: 12
Original Poster
Rep:
|
Thanks!!!..that was it. Putting the bad_sites before nav fixed it!!
The only other thing is that I have to reboot the server for the changes to take effect. I have tried restarting squid3 by "sudo squid3 restart" but that does not work. I do not get any errors with the command it's just any changes won't take effect until I reboot. Is there any trick to restarting squid without rebooting the server? Thanks!
I have ubuntu 12.04 running in VMware Player. Thanks!
|
|
|
05-28-2012, 06:06 PM
|
#8
|
Member
Registered: Jul 2006
Distribution: Debian, Ubuntu, W7, openSUSE, Centos
Posts: 152
Rep:
|
Shouldn't have to reboot. Try sudo squid stop then watch it stop and start squid. Then check the logs for any error messages.
|
|
|
05-28-2012, 06:18 PM
|
#9
|
LQ Newbie
Registered: May 2012
Posts: 12
Original Poster
Rep:
|
Thanks Zetec!...so I followed your instructions and found something interesting
While watching the cache.log of squid with "tail -f" whenever I do a "sudo squid3 stop" in the log it says "Squid is already running Proccess ID 733"
So it looks like that might be the culprit. Any ideas?. I will do a google search in the meantime. Thanks!
|
|
|
05-28-2012, 06:23 PM
|
#10
|
LQ Newbie
Registered: May 2012
Posts: 12
Original Poster
Rep:
|
so google found me a command that seemed to have worked "sudo squid3 -k shutdown".
Wondering why the "sudo squid3 stop" didn't work. Thanks for all the help!
EDIT: lol looking at squid3 --help says to use "sudo squid3 -k shutdown" command. I guess the old squid version used the stop command not this one. Thanks for all the help guys!!
Last edited by jat421; 05-28-2012 at 06:27 PM.
|
|
|
05-28-2012, 09:00 PM
|
#11
|
Member
Registered: Jul 2006
Distribution: Debian, Ubuntu, W7, openSUSE, Centos
Posts: 152
Rep:
|
There you go. Glad you got it sorted. . Beats rebooting the server every time. .
|
|
|
05-29-2012, 12:42 AM
|
#12
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,198
|
Quote:
so google found me a command that seemed to have worked "sudo squid3 -k shutdown".
Wondering why the "sudo squid3 stop" didn't work. Thanks for all the help!
EDIT: lol looking at squid3 --help says to use "sudo squid3 -k shutdown" command. I guess the old squid version used the stop command not this one.
|
You can use:
Code:
sudo /etc/init.d/squid3 restart
|
|
|
All times are GMT -5. The time now is 04:56 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|