mini-waf
v0.4.99
Published
Create a safety NodeJS server with Minimalistic WAF library based on deflectjs hook engine.
Downloads
97
Maintainers
Readme
Mini WAF
Getting started into Mini-WAF!
Installation
npm install mini-waf --save
First use of Mini-WAF with Express
const express = require("express");
const app = express();
const Waf = require('mini-waf/wafbase');
const wafrules = require('mini-waf/wafrules');
//Register the middleware of Mini-WAF with standard rules.
app.use(Waf.WafMiddleware(wafrules.DefaultSettings));
//Create your routes in your way!
app.use((req, res) => {
//Do your work in anywhere.
res.send('Some data...');
res.end();
});
app.listen(55100, function () {
console.log("Running server on port 55100!");
});
Mini-WAF blocking Denial of Service attacks
Dacls: [
{
NetworkLayers: Waf.WAF_NETWORK_LAYER.PROTOCOL_IPV4,
MatchTypes: Waf.WAF_MATCH_TYPE.MATCH_METHOD_TYPE,
ManageType: Waf.WAF_MANAGE_TYPE.BLOCK,
Directions: Waf.WAF_RULE_DIRECTION.INBOUND,
MethodTypes: "GET|POST|PUT|DELETE|PATCH",
Description: 'Blocking GET, POST, PUT, DELETE, PATCH request methods.'
}
]
Dacls: [
{
NetworkLayers: Waf.WAF_NETWORK_LAYER.PROTOCOL_IPV4,
MatchTypes: Waf.WAF_MATCH_TYPE.MATCH_IP,
ManageType: Waf.WAF_MANAGE_TYPE.BLOCK,
Directions: Waf.WAF_RULE_DIRECTION.INBOUND,
Ipv4Address: '206.189.180.4',
Description: 'Blocking a specific IP address.'
}
]