-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge draad branch in openstad branch
- Loading branch information
Showing
6 changed files
with
3,355 additions
and
5,892 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Netmask = require('netmask').Netmask; | ||
|
||
exports.preventCiscoRequest = (req, res, next) => { | ||
|
||
// Fix for local IP | ||
if (req.ip == '::1') { | ||
return next(); | ||
} | ||
|
||
// CIDRs for Cisco Umbrella | ||
// See https://support.umbrella.com/hc/en-us/articles/360059292052-Additional-Egress-IP-Address-Range | ||
const cidrs = ['146.112.0.0/16', '155.190.0.0/16']; | ||
|
||
// Check if IP is in cidr | ||
const isIpInCidr = cidrs.some(cidr => { | ||
const block = new Netmask(cidr); | ||
return block.contains(req.ip); | ||
}); | ||
|
||
if (!isIpInCidr) { | ||
return next(); | ||
} | ||
|
||
console.log('IP is in CIDRs to block', req.ip, cidrs, isIpInCidr); | ||
|
||
req.flash('error', {msg: 'De url is geen geldige login url, wellicht is deze verlopen'}); | ||
return res.redirect(`/auth/url/login?clientId=${req.query.clientId}`); | ||
|
||
} |
Oops, something went wrong.
0403ced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Published new image:
openstad/auth:feature-dhv3-0403ced