Executing iptables command from module

arosolino nginx-forum at nginx.us
Thu Jul 12 05:24:46 UTC 2012

Well if you are running nginx as a non root user. Then you need to add
the following lines to /etc/sudoers
Defaults:nginx !requiretty
nginx   ALL=(root)      NOPASSWD: /sbin/iptables

The above is necessary because iptables can only be modified as root.

I can't dump the code here for my module because it's irrelevant, but
you can basically use the system() command at this point to add an entry
from IP tables.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,228416,228523#msg-228523

More information about the nginx mailing list