Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
| 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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-23-2009, 11:07 AM
|
#1
|
|
LQ Newbie
Registered: Nov 2009
Posts: 8
Rep:
|
iptables + WAN and LAN per user
Greets all, first time poster here.
I have a Linux server that has two network interfaces
eth0 has a direct connection to the internet with a static IP address
eth1 is a 192.168.x.x network to the local LAN.
I allow some external internet users shell access to the system, however, not all of them should be able to access the LAN.
I'm pretty sure iptables can now do per-user blocking, but I'm not sure what the rule would be.
For example, say that eth0 is 70.70.70.70 (for ease of use) and eth1 is 192.168.1.5 and I have three users, Fred, John and Albert. I would like Albert to be able to access anything on the 192.168.x.x network as well as the internet, and John and Fred only have access to the internet.
How would I implement that in iptables?
Thanks,
Nigel
|
|
|
|
11-23-2009, 11:47 AM
|
#2
|
|
Member
Registered: Feb 2009
Location: Iowa
Distribution: Ubuntu 9.10
Posts: 164
Rep:
|
Quote:
|
For example, say that eth0 is 70.70.70.70 (for ease of use) and eth1 is 192.168.1.5 and I have three users, Fred, John and Albert. I would like Albert to be able to access anything on the 192.168.x.x network as well as the internet, and John and Fred only have access to the internet.
|
Are John, Fred, and Albert already inside your network, or are they trying to access your network from the internet? If they're inside your network then your firewall server won't block John and Fred from accessing a server in your network. You'd have to configure ipTables on those servers to accept connections from Albert's IP address and to not accept connections from John and Fred's IP addresses. And that would work only so long as John, Fred and Albert did not change their IP address.
Or you could use something like openLDAP and PAM to force Albert, John and Fred to authenticate with the server, and then not allow John and Fred to get in once authenticated.
If they're all outside your network, then you can configure your firewall server to block all IP addresses except Albert's, but that would work only so long as Albert kept that IP address. Or you could use Radius to allow authenticated access through your firewall based on username and password, rather than IP address. You can even integrate Radius, openLDAP and PAM together so that Radius challenged users at the firewall, using the directory data in openLDAP to only let Albert, John and Fred through the firewall, and then use the pam_ldap PAM module to have the servers authenticate users against the same openLDAP directory, so that Albert is allowed access to the server but Fred and John are denied access.
openLDAP: http://www.openldap.org/
PAM: http://www.kernel.org/pub/linux/libs/pam/
Radius: http://freeradius.org/
Centralized Logins Using LDAP and RADIUS: http://www.linuxhomenetworking.com/w...DAP_and_RADIUS
|
|
|
|
11-23-2009, 03:09 PM
|
#3
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally Posted by nelgin
Greets all, first time poster here.
I have a Linux server that has two network interfaces
eth0 has a direct connection to the internet with a static IP address
eth1 is a 192.168.x.x network to the local LAN.
I allow some external internet users shell access to the system, however, not all of them should be able to access the LAN.
I'm pretty sure iptables can now do per-user blocking, but I'm not sure what the rule would be.
For example, say that eth0 is 70.70.70.70 (for ease of use) and eth1 is 192.168.1.5 and I have three users, Fred, John and Albert. I would like Albert to be able to access anything on the 192.168.x.x network as well as the internet, and John and Fred only have access to the internet.
How would I implement that in iptables?
Thanks,
Nigel
|
Here's an example of how you could do it (sans context):
Code:
iptables -A OUTPUT -o eth0 -j ACCEPT
iptables -A OUTPUT -o eth1 -m owner --uid-owner Albert -j ACCEPT
iptables -A OUTPUT -o eth1 -j REJECT
That's pretty much the gist of it (let me know if you have any questions).
BTW, welcome to LQ! 
Last edited by win32sux; 11-23-2009 at 03:12 PM.
|
|
|
|
11-23-2009, 11:12 PM
|
#4
|
|
LQ Newbie
Registered: Nov 2009
Posts: 8
Original Poster
Rep:
|
Quote:
Originally Posted by Jim Bengtson
Are John, Fred, and Albert already inside your network, or are they trying to access your network from the internet? If they're inside your network then your firewall server won't block John and Fred from accessing a server in your network. You'd have to configure ipTables on those servers to accept connections from Albert's IP address and to not accept connections from John and Fred's IP addresses. And that would work only so long as John, Fred and Albert did not change their IP address.
|
They have ssh access to the server so will have a physical shell on 70.70.70.70. I would only want certain people to have access to other servers on the 192.168.x.x network. Albert, for example, would have access to any NFS mounts, Samba shares, network printers, ssh to other hosts on the internet network etc. The other users shouldn't even be able to send a ping down eth1.
|
|
|
|
11-23-2009, 11:13 PM
|
#5
|
|
LQ Newbie
Registered: Nov 2009
Posts: 8
Original Poster
Rep:
|
Quote:
Originally Posted by win32sux
Here's an example of how you could do it (sans context):
Code:
iptables -A OUTPUT -o eth0 -j ACCEPT
iptables -A OUTPUT -o eth1 -m owner --uid-owner Albert -j ACCEPT
iptables -A OUTPUT -o eth1 -j REJECT
That's pretty much the gist of it (let me know if you have any questions).
BTW, welcome to LQ! 
|
Hmm, that looks almost too simple to be true  I'll go ahead and give it a try.
Thanks for the welcome.
I'm pretty proficient with Linux, but I can never get my head around iptables. It doesn't delve deep enough into the security side often enough. 
|
|
|
|
11-24-2009, 01:03 AM
|
#6
|
|
LQ Newbie
Registered: Nov 2009
Posts: 8
Original Poster
Rep:
|
Thanks, win32sux. I just gave it a try by opening up a PC's remote desktop connection. I can telnet to the port as one user but not ask the blocked user. Thanks for your help.
|
|
|
|
11-24-2009, 07:45 AM
|
#7
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Sounds like you've got it working, given the telnet test results. Let me know if you hit any snags.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:41 PM.
|
|
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
|
|