-
Notifications
You must be signed in to change notification settings - Fork 90
Description
`var failCallback = function (req, res, next, nextValidRequestDate) {
console.log("DDOS Attempt Ip now Blocked");
res.sendStatus(429); // brute force protection triggered, send them back to the login page
};
var ExpressBrute = require('express-brute'),
RedisStore = require('express-brute-redis');
var store = new RedisStore({
host: process.env.REDIS_PORT_6379_TCP_ADDR||'localhost', port: process.env.REDIS_PORT_6379_TCP_PORT||6379,no_ready_check: true,auth_pass:'mypassword'
});
var handleStoreError = function (error) {
log.error(error); // log this error so we can figure out what went wrong
// cause node to exit, hopefully restarting the process fixes the problem
throw {
message: error.message,
parent: error.parent
};
}
module.exports.globalBruteforce = new ExpressBrute(store, {
freeRetries: 1000,
attachResetToRequest: false,
refreshTimeoutOnRequest: false,
minWait: 2560601000, // 1 day 1 hour (should never reach this wait time)
maxWait: 2560601000, // 1 day 1 hour (should never reach this wait time)
lifetime: 246060, // 1 day (seconds not milliseconds)
failCallback: failCallback,
handleStoreError: handleStoreError
});
`