LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-29-2008, 10:53 AM   #16
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380

Quote:
Originally Posted by chlee97 View Post
Code:
iptables -I FORWARD -p TCP -i $LAN_IFACE -o $WAN_IFACE \
-m multiport --dports 80,443 -m state --state NEW -j REJECT
above code is to block 80 and 443 port only. How about if i wan to block ALL port but except 25, 110 and 8080 ports? what should i type in iptables?
You could do it like this:
Code:
iptables -P FORWARD DROP

iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A FORWARD -p TCP -i $LAN_IFACE -o $WAN_IFACE \
-m multiport --dports 25,110,8080 -m state --state NEW -j ACCEPT

iptables -A FORWARD -i $LAN_IFACE -o $WAN_IFACE -j REJECT
EDIT: Of course, this assumes a clean FORWARD chain when you start.

Last edited by win32sux; 04-29-2008 at 11:11 AM.
 
Old 04-30-2008, 02:23 AM   #17
chlee97
Member
 
Registered: Sep 2007
Posts: 30

Original Poster
Rep: Reputation: 15
hi win32sux,

since skype hard to block, so can i just block all the ports from internal to external, then only allow some of the port like 25, 110, 143 able to access to external. So from here i can prevent user to use skype and bittorrent download, besides that force user to use proxy server, then only can access to net.

anyway will it have any disadvantages?

by the way, if i have blocked all port (which included my proxy port 8080), can my user still use my proxy server to surf net? or i need to allow the proxy port in iptables, then my user only can access internet with my proxy server?

Thank you

Regards,
Kenny
 
Old 04-30-2008, 06:37 AM   #18
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by chlee97 View Post
since skype hard to block, so can i just block all the ports from internal to external, then only allow some of the port like 25, 110, 143 able to access to external. So from here i can prevent user to use skype and bittorrent download, besides that force user to use proxy server, then only can access to net.
Yes, you can do that. The commands in my last post allow the clients to start outgoing connections to ports 25, 110, and 8080. I don't know if it'll stop Skype and/or BitTorrent, though.

Quote:
anyway will it have any disadvantages?

by the way, if i have blocked all port (which included my proxy port 8080), can my user still use my proxy server to surf net? or i need to allow the proxy port in iptables, then my user only can access internet with my proxy server?
Yes, you can simply disable forwarding and require all users to connect to the proxy. The advantage to this is you pretty much get to control all their access via proxy ACLs. I don't know if it will stop Skype, though. I mean, AFAIK Skype will indeed work through a proxy.
 
  


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
Firewall settings for Thunderbird sleekmason Linux - Software 1 06-27-2006 11:10 PM
Firewall settings aren't saved Error1312 Mandriva 10 05-31-2004 10:47 AM
How to check the firewall settings paulvl Linux - Networking 4 02-19-2004 07:18 AM
firewall- cannot modify settings rob7712 Linux - Networking 3 04-01-2003 04:13 AM
firewall settings? akebono Linux - General 0 09-27-2001 05:55 PM

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

All times are GMT -5. The time now is 04:42 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