Skip to contentSkip to conversation

providing partial access to iptables for non root user

DISCUSSION Michael Jürgens 4 participants 4 messages Feb 21, 2005 – Feb 23, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I´m looking for a solution to provide a non root user write access to a chain.

In this special case I have to provide the a mechanism to block some ip adresses to connect to http.
But this should be done by a non root user. The non root user should not change any other rule.

Any ideas?

regards,
Michael

#1 lore raw
Quoted 3 lines · Michael Jürgens

I´m looking for a solution to provide a non root user write access to a chain.

I've written up some stuff using sudo in order to create an auditing trail. You can read about it here:

http://www.loganalysis.org/sections/parsing/application-specific/firewall-logging.html#iptables

Quoted 4 lines

his special case I have to provide the a mechanism to block some ip adresses to connect to http.
But this should be done by a non root user. The non root user should not change any other rule.

The problem is you can not set permissions to different iptables switches. So granting a person access to the binary implies they will be able to do pretty much anything they want.

You might be able to create a front end that accepts just an IP address, and then the back end fills out the rest of the command, but you would need really good data scrubbing to ensure that only IP addresses are accepted, not command line switches. You would also need to ensure that the user does not have direct access to the binary.

HTH,
Chris

#2 lore raw
In reply to Michael Jürgens
Quoted 11 lines · Michael Jürgens

Hi,

I´m looking for a solution to provide a non root user write access to a chain.

In this special case I have to provide the a mechanism to block some ip adresses to connect to http.
But this should be done by a non root user. The non root user should not change any other rule.

Any ideas?

use sudo?

Host_Alias LOCALHOST = thishostname

User_Alias U_HTTP = youruser

Cmnd_Alias C_HTTP = /sbin/iptables -A blockhttp -s * -j DROP

U_HTTP LOCALHOST = C_HTTP

...or if is this is scripted:

U_HTTP LOCALHOST = NOPASSWD: C_HTTP

obviously--there's opportunity for abuse here--but it's the best i've come up with. if you front-end this with a script, it will allow you to scrub/check/validate the input much more extensively (which is what i actually do).

-j

--
"Oh look at me! I'm making people happy! I'm the magical man from
Happyland, in a gumdrop house on Lollipop Lane!"
--The Simpsons

#3 lore raw
Quoted 6 lines · Jason Opperisano
Quoted 5 lines · Michael Jürgens

Hi,

I´m looking for a solution to provide a non root user write access to a chain.

Quoted 7 lines
Quoted 6 lines

In this special case I have to provide the a mechanism to block some ip adresses to connect to http.
But this should be done by a non root user. The non root user should not change any other rule.

Any ideas?

Why not to use a conf file with proper right ?
selected user could add rules in the script that will be automatically inserted into the firewall via a cron task or a sudo script ?

BR,

Signature · 2 lines
Eric Leblond <[email protected]>
INL