Burak Karabıyık
Burak Karabıyık

Reputation: 41

How can I configure the firewall with node js?

How can I configure the firewall with node js?Could you give me a sample project?

Upvotes: 2

Views: 10623

Answers (3)

Ali Azhar
Ali Azhar

Reputation: 1803

This is a valid question. Network firewall and application firewall both can co-exist together.

Upvotes: 0

Kostas Minaidis
Kostas Minaidis

Reputation: 5412

Both Windows and Mac (and of course Linux) enable you to view and modify the firewall settings via some kind of command line tool.

For example, this post talks about modifying Windows firewall settings through the netsh command, and this post covers command line firewall management in OSX (Mac).

Since Node.js is able to execute command line commands via Child Processes, theoretically, you can modify a system's firewall settings through code running in Node.js.

There's also an npm package called firewall which claims to "Add or remove system firewall rules using Node.js.".

Upvotes: 1

jfriend00
jfriend00

Reputation: 707158

A firewall is a completely different piece of network infrastructure than node.js which is an application environment. So while the two may be used in the same deployment, they are different tools for different jobs. You would not typically "configure the firewall with nodejs". Your firewall would usually have its own admin interface that you can login to and then make configuration changes.

If your firewall had a secure HTTP API for doing firewall administration, you could build a node.js app to login and then send HTTP requests to the firewall to modify its configuration. The details of how to do that depend entirely upon what the HTTP API is in the firewall so we'd need to see that in order to recommend anything more specific. In general, one can make an HTTP request from a node.js app to another HTTP server using the request-promise module in NPM.

Upvotes: 3

Related Questions