node.js iptables module help needed

edited May 2014 in JavaScript

Hi there,

I found this node.js iptables module. (node-iptables) I want to modify it(if it even needs modifying) so that it can do more than what it already does but I'm not a very good programmer..wondering if anyone can give me some help to get my task completed.

I have a internal website where I want to have users go to the website and have the website automatically find the clients IP address, show the address to the client, have the client confirm it then send the IP address information over to my other server that will run node.js and accept the IP information which then it will add or remove the IP address that is presented to it.

my iptable rules usually are like so:
iptables -A INPUT -s x.x.x.x/32 -j ACCEPT

if you see node-iptables it has an example:

" var iptables = require('iptables');

        protocol : tcp,
        src : '',
        dport : 34567,
        sudo : true

        protocol : 'tcp',
        dport : 34567,
        sudo : true

This allows connections to port 34567 from and drops connections from
the same port from everyone else."

would this be what I use? to get the same affect as: iptables -A INPUT -s x.x.x.x/32 -j ACCEPT

 var iptables = require('iptables');

        src : 'x.x.x.x/32',
        sudo : true

If that is the correct code for what I want, how would I go about later updating the IP address and removing the old IP from iptables with this script? I see there is a export deleterule function I believe.

How would you write the removal of 'x.x.x.x/32' from iptables via node-iptables script?

Does the script itself need to be modified to have that feature?

any help would be much appreciated. thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!