LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-20-2007, 09:32 PM   #1
soumalya
Member
 
Registered: Nov 2006
Posts: 260

Rep: Reputation: 31
Preventing file downloads with Squid


Sir

in my office i facing a prob in linux internet server running squid.

there is one ip is downloading huge files everyday thats why our download limit is crossed.

i can stop him doing this.

is there any way to stop downloading .exe, .mp3,.rar,.zip,.doc files for ta perticular ip. he can access website but cant download these type file from internet anyway.

thanks in advance
 
Old 11-20-2007, 09:39 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Sure, one way would be to use regular expression ACLs on his IP, like:
Code:
acl bandwidth_hog src 192.168.1.104
acl exe urlpath_regex -i \.exe$
acl mp3 urlpath_regex -i \.mp3$
acl rar urlpath_regex -i \.rar$
acl zip urlpath_regex -i \.zip$
acl doc urlpath_regex -i \.doc$
http_access deny bandwidth_hog exe mp3 rar zip doc
I think you can also specify multiple patterns on a single line, like:
Code:
acl bandwidth_hog src 192.168.1.104
acl bad_extensions urlpath_regex -i \.exe$ \.mp3$ \.rar$ \.zip$ \.doc$
http_access deny bandwidth_hog bad_extensions
Of course, you can also call a separate file with all the extension's expressions in it, like:
Code:
acl bandwidth_hog src 192.168.1.104
acl bad_extensions urlpath_regex -i "/etc/bad-extensions.txt"
http_access deny bandwidth_hog bad_extensions
I don't have access to a Squid box to test at this precise moment so take these examples with a grain of salt.

NOTE: I've edited the thread title, as "squid" is just way too vague.

Last edited by win32sux; 11-20-2007 at 10:11 PM.
 
Old 11-21-2007, 11:09 PM   #3
soumalya
Member
 
Registered: Nov 2006
Posts: 260

Original Poster
Rep: Reputation: 31
than you 4 ur reply

i have tried 2nd solution and its working.


can u pls tell me how to write the extensions in bad-extensions.txt in ur 3rd solution.

how to do same think more than one or all ip ?


thanks again
 
Old 11-22-2007, 02:48 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by soumalya View Post
can u pls tell me how to write the extensions in bad-extensions.txt in ur 3rd solution.
IIRC, just put one expression per line in the file, like:
Code:
\.exe$
\.mp3$
\.rar$
\.zip$
\.doc$
Quote:
how to do same think more than one or all ip ?
To affect only specific IPs, you can use an ACL for each, like:
Code:
acl bandwidth_hog1 src 192.168.1.104
acl bandwidth_hog2 src 192.168.1.111
acl bandwidth_hog3 src 192.168.1.159
acl bad_extensions urlpath_regex -i \.exe$ \.mp3$ \.rar$ \.zip$ \.doc$
http_access deny bandwidth_hog1 bad_extensions
http_access deny bandwidth_hog2 bad_extensions
http_access deny bandwidth_hog3 bad_extensions
Or you can specify a range of IPs instead, like:
Code:
acl bandwidth_hogs src 192.168.1.110-192.168.1.166
acl bad_extensions urlpath_regex -i \.exe$ \.mp3$ \.rar$ \.zip$ \.doc$
http_access deny bandwidth_hogs bad_extensions
To affect everyone, use the "all" ACL, which should exist by default:
Code:
acl bad_extensions urlpath_regex -i \.exe$ \.mp3$ \.rar$ \.zip$ \.doc$
http_access deny all bad_extensions

Last edited by win32sux; 11-22-2007 at 03:02 AM.
 
Old 11-23-2007, 02:53 AM   #5
soumalya
Member
 
Registered: Nov 2006
Posts: 260

Original Poster
Rep: Reputation: 31
thank you Sir.
 
  


Reply



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
preventing deletion of an opened file sayarsoft Programming 3 02-05-2007 07:05 PM
Squid: Stopping downloads heavy mail attachments dpballey Linux - Networking 0 03-04-2006 02:06 AM
Squid ACL to regulate uploads & downloads ~=gr3p=~ Linux - Networking 1 02-08-2006 12:03 AM
Squid limited to 3 concurrent downloads lukebeales Linux - Software 0 06-14-2004 12:40 PM
Preventing single file from deletion Eisenbart Linux - Newbie 5 05-01-2002 06:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:18 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
Open Source Consulting | Domain Registration