Results 1 to 5 of 5
i want to write to iptables file (where iptables rules saved) through php code.
i mean that instead of writing iptables rules on the command line i want to design ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-09-2008 #1Just Joined!
- Join Date
- Apr 2008
- Posts
- 38
write into file in php
i want to write to iptables file (where iptables rules saved) through php code.
i mean that instead of writing iptables rules on the command line i want to design php interface to allow entering iptables rules through this interface .
now i try to use fwrite php function to write rules into /etc/sysconfig/iptables but i failed.please help me.
- 06-09-2008 #2
First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-----
FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org
- 06-09-2008 #3Just Joined!
- Join Date
- Apr 2008
- Posts
- 38
how i can know apache user?
- 06-09-2008 #4
I think it's not apache user - just normal user.
We used a user name called oss and to allow this user to have root access
we added following line in /etc/sudoers file.
Note : I'm just giving some hints ...as i didn't have enough knowledege in web applicationsCode:oss ALL=(ALL) NOPASSWD:ALL
May be try and execute your php file from command prompt and check it's results ..First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-----
FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org
- 06-15-2008 #5Just Joined!
- Join Date
- Sep 2007
- Location
- Lafayette, IN
- Posts
- 83
I'd suggest not giving your apache user full sudo access. That leaves you far more exposed to an attack. First of all, I'd make sure your php script can only be run locally (perhaps use an .htaccess file to restrict the web directory in which it resides). Then you could add a line like the following to your sudoers file (might want to double-check my syntax)
Code:apache ALL = NOPASSWD: /usr/sbin/iptables


Reply With Quote

