running a csf command from php

2 posts / 0 new
Last post
#1 Thu, 11/19/2015 - 18:49
edwardsmarkf

running a csf command from php

hello - i am trying to run the following csf command from inside a php script:

 $ipNbr = 199.231.184.25 ;   // for example
 $csfCommand = 'sudo  /usr/sbin/csf  --tempdeny ' . $ipNbr . ' 3600;'  ;    
 $csfResult = shell_exec($csfCommand) ;  

 $csfResult = exec($csfCommand) ;  // i also tried this

so far it does not do anything at all, include return any sort of error message.

i put the following line inside of visudo:

 visudo ;
 marksdomain.com    ALL=(ALL)       NOPASSWD: /usr/sbin/csf

any ideas how i can fire off the csf command from inside the php script ??

thank you all very much.

Fri, 11/20/2015 - 14:06
edwardsmarkf

solution:

$csfCommand = '/usr/bin/sudo -u root -s /usr/sbin/csf --tempdeny ' . $ipNbr . ' 3600;'

marksDomain(dot)com ALL=(ALL:ALL) NOPASSWD: /bin/sh marksDomain(dot)com ALL=(ALL:ALL) NOPASSWD: /usr/sbin/csf

Topic locked