Implement IP range restrictions

This commit is contained in:
Akkadius 2017-09-06 04:07:50 -05:00
parent 88cba6d48a
commit ed83e014cd
2 changed files with 8 additions and 1 deletions

6
app.js
View File

@ -21,6 +21,12 @@ app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser()); app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));
if(glass_config.ip_ranges_to_allow) {
var ip_filter = require('express-ipfilter').IpFilter;
var ips = glass_config.ip_ranges_to_allow;
app.use(ip_filter(ips, {mode: 'allow'}));
}
/* Normal Web Routes */ /* Normal Web Routes */
app.use('/', require('./routes/index')); app.use('/', require('./routes/index'));
app.use('/users', require('./routes/users')); app.use('/users', require('./routes/users'));

View File

@ -8,5 +8,6 @@
"shared_network_warning_threshold": "80", "shared_network_warning_threshold": "80",
"slack_webhook_url": "https://hooks.slack.com/services/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", "slack_webhook_url": "https://hooks.slack.com/services/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",
"slack_alert_channel": "#alerting", "slack_alert_channel": "#alerting",
"leases_per_minute_threshold": "1000" "leases_per_minute_threshold": "1000",
"ip_ranges_to_allow": [""]
} }