diff --git a/app.js b/app.js index a27c3ca..b1a4d81 100644 --- a/app.js +++ b/app.js @@ -21,6 +21,12 @@ app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); 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 */ app.use('/', require('./routes/index')); app.use('/users', require('./routes/users')); diff --git a/config/glass_config.json b/config/glass_config.json index 9ea9574..159e611 100644 --- a/config/glass_config.json +++ b/config/glass_config.json @@ -8,5 +8,6 @@ "shared_network_warning_threshold": "80", "slack_webhook_url": "https://hooks.slack.com/services/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", "slack_alert_channel": "#alerting", - "leases_per_minute_threshold": "1000" + "leases_per_minute_threshold": "1000", + "ip_ranges_to_allow": [""] }