Networking Forums

Networking Forums > Computer Networking > Linux Networking > Restricting Internal Users Ports

Reply
Thread Tools Display Modes

Restricting Internal Users Ports

 
 
teknoe@gmail.com
Guest
Posts: n/a

 
      10-29-2005, 04:43 AM
I am attempting to setup an internal network on my Ubuntu machine. I
have taken a look at the various iptables rules and believe I have a
rather complex setup. I need to use IP Masquerading for the internal
network, but I only want the internal users to be able to use SSH (port
22). Once the users are connected, I want them to be able to access
any established port so that I can use SSH tunneling for web/mail
access to the external network. The main reason behind this is I will
be using a wireless network and wish to use SSH in addition to the
standard WAP protection, because I have "snoopers" in my neighborhood.
For the IP Masquerading, I have used:
iptables --table nat --append POSTROUTING --jump MASQUERADE --source
192.168.0.0/24

I am thinking that before this line I need to use:
iptables -A INPUT -i eth1 -s 192.168.0.0/24 --dport 22 -j ACCEPT

My external device is eth0, and my internal device is eth1. Any help
would be appreciated. Thank you.

 
Reply With Quote
 
 
 
 
Eric
Guest
Posts: n/a

 
      10-29-2005, 10:49 AM
(E-Mail Removed) wrote:
> I am attempting to setup an internal network on my Ubuntu machine. I
> have taken a look at the various iptables rules and believe I have a
> rather complex setup. I need to use IP Masquerading for the internal
> network, but I only want the internal users to be able to use SSH (port
> 22). Once the users are connected, I want them to be able to access
> any established port so that I can use SSH tunneling for web/mail
> access to the external network. The main reason behind this is I will
> be using a wireless network and wish to use SSH in addition to the
> standard WAP protection, because I have "snoopers" in my neighborhood.
> For the IP Masquerading, I have used:
> iptables --table nat --append POSTROUTING --jump MASQUERADE --source
> 192.168.0.0/24
>
> I am thinking that before this line I need to use:
> iptables -A INPUT -i eth1 -s 192.168.0.0/24 --dport 22 -j ACCEPT
>
> My external device is eth0, and my internal device is eth1. Any help
> would be appreciated. Thank you.
>


If you want to use an encrypted internal network, you need a VPN. You
cannot just use port 22 for any traffic such as web, mail aso except you
first connect to your router with ssh, but i don't think it is what you
want.

To forward traffic from inside to outside you need the following rules:

iptables -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -s 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -i eth0 -m state --state ESTABLISHED -j ACCEPT

Eric
 
Reply With Quote
 
teknoe@gmail.com
Guest
Posts: n/a

 
      10-29-2005, 11:41 AM

Eric wrote:
> (E-Mail Removed) wrote:
> > I am attempting to setup an internal network on my Ubuntu machine. I
> > have taken a look at the various iptables rules and believe I have a
> > rather complex setup. I need to use IP Masquerading for the internal
> > network, but I only want the internal users to be able to use SSH (port
> > 22). Once the users are connected, I want them to be able to access
> > any established port so that I can use SSH tunneling for web/mail
> > access to the external network. The main reason behind this is I will
> > be using a wireless network and wish to use SSH in addition to the
> > standard WAP protection, because I have "snoopers" in my neighborhood.
> > For the IP Masquerading, I have used:
> > iptables --table nat --append POSTROUTING --jump MASQUERADE --source
> > 192.168.0.0/24
> >
> > I am thinking that before this line I need to use:
> > iptables -A INPUT -i eth1 -s 192.168.0.0/24 --dport 22 -j ACCEPT
> >
> > My external device is eth0, and my internal device is eth1. Any help
> > would be appreciated. Thank you.
> >

>
> If you want to use an encrypted internal network, you need a VPN. You
> cannot just use port 22 for any traffic such as web, mail aso except you
> first connect to your router with ssh, but i don't think it is what you
> want.
>
> To forward traffic from inside to outside you need the following rules:
>
> iptables -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
> iptables -A FORWARD -i eth1 -s 192.168.0.0/24 -j ACCEPT
> iptables -A FORWARD -i eth0 -m state --state ESTABLISHED -j ACCEPT
>
> Eric


What I was going to do was allow anyone on the internal network
(wireless router) to only be able to connect to port 22. That way the
user can login remotely via SSH and setup tunneling from there. I
suppose it would be like a VPN. I would need the firewall to restrict
incoming ports to port 22, but allow any established outgoing ports so
say for instance POP could be tunnelled over SSH. This way a user
would only be able to connect to port 22, but could still get to other
services once they were connected. As I understand it, with the
masquerading rules above, it's forward all or nothing. No choice on
what traffic passes through the internal interface.

Thanks.

 
Reply With Quote
 
Eric
Guest
Posts: n/a

 
      10-30-2005, 08:30 AM
(E-Mail Removed) wrote:
>
> What I was going to do was allow anyone on the internal network
> (wireless router) to only be able to connect to port 22. That way the
> user can login remotely via SSH and setup tunneling from there. I
> suppose it would be like a VPN. I would need the firewall to restrict
> incoming ports to port 22, but allow any established outgoing ports so
> say for instance POP could be tunnelled over SSH. This way a user
> would only be able to connect to port 22, but could still get to other
> services once they were connected. As I understand it, with the
> masquerading rules above, it's forward all or nothing. No choice on
> what traffic passes through the internal interface.
>
> Thanks.
>


Do you have a tunnel server running on your router? If so you don't need
any postrouting or forwarding rules, because your tunnel server should
handle the traffic. In this case yhou only need input/output rules set up.
If not, there is another way to do it, use a VPN, then you can postroute
and forward your internal traffic using the vpn network devices (i.E.
vpn0 instead of eth1) in your firewalll configuration.

If your clients just connect to the ssh2 deamon, it wont work as you
wish. The ssh deamon does not know how to handle your traffic such as
POP or WWW aso.

Eric
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting access to internal hosts Dugg80 Windows Networking 1 11-12-2009 12:43 PM
Restricting access to internal hosts Dugg80 Wireless Networks 1 11-12-2009 12:42 PM
RAS - Restricting VPN User to certain Internal IPs? tigenet@gmail.com Windows Networking 0 11-16-2006 05:18 PM
restricting users bill Windows Networking 2 07-22-2005 08:40 PM
NIS restricting users on specific hosts Ryan Hubbard Linux Networking 0 01-26-2004 07:32 PM



1 2 3 4 5 6 7 8 9 10 11