19 January 2015

Introduction"

This class was created to be exactly what it's called, damn simple white-listing. (And for those captain-obvious' out there, yes, you can make it a black-list too. I'm so proud of you!)

You can pass it whitelists if the form of a file. The default location for the WHITELIST_FILE is /etc/whitelist, and takes 1 IP range or host per line. It will only parse legit IP's, which are validated using the IPAddress gem.

You can also pass a hard-coded array in WHITELIST_IPS. These are good for local addresses that should never be blocked.

Note: This script does require a 3rd-party library, ipaddress. You can get that installed using gem install ipaddress.

Usage

I don't think it can get much easier than this:

If you want to get all whitelisted IP addresses, you can use the #all method.

Tagged under ip, network, ruby, whitelist, blacklist, and others
Mike Mackintosh

This post was written by Mike Mackintosh, a decorated security professional.




Related Posts