Git Product home page Git Product logo

ky-rpz's Introduction

KY-RPZ (Kush-Yale RPZ)

A slick and DIY RPZ for people who want to roll their own.

This'll make the necessary config and zone file to make an rpz.blacklist Response Policy Zone configuration on modern BIND implementations.

Script config

An example configuration file is in ky-rpz.config.example. Copy this to ky-rpz.config and update the paths.

Variable Usage Default
TEMPDIR Temporary working dir, we suggest "/tmp" ./tmp
OUTPUTDIR Place where files are put after processing ./output
ZONEFILEDIR Where your zone files live /etc/bind/
NAMEDCONFIG The named.config filename you want to use (and add to BIND config) named.conf.ky-rpz
DBFILE The name of the zone file (in case of collisions) db.ky-rpz
SQUIDBLACKLIST The location of a squid blacklist. If you don't use squid, set it to /dev/null /etc/squid/ky-rpz.acl
FORWARDERS A semicolon-delimited list of upstream forwarders to connect to, eg "192.168.2.1;8.8.8.8" "" (disabled)

BIND Configuration

You'll need to enable the response-policy option in BIND. This requires version 9.9 and above. Add this line to /etc/bind/named.conf.options inside the existing squiggly braces: response-policy { zone "rpz.blacklist"; };

Make sure you add the blacklist zone file to your config. For example, I added include "/etc/bind/named.conf.ky-rpz"; to /etc/bind/named.conf.local on a Debian machine.

Docker Image

Building the image (necessary if you want custom options or upstream forwarders

Set your configuration variables in conf/env.env (an example is in conf/env.env.example) and run build.sh.

Setting custom forwarders

Put an entry in conf/env.env

Running it

To spin up a new instance: docker run --name "ky-rpz" -p 53:53/udp -p 53:53 --rm yaleman/ky-rpz

To force an update of the definitions (should happen hourly in cron): docker exec -it ky-rpz /opt/ky-rpz/bin/update.sh

Squid blocking

Below is a section of the default configuration file from Ubuntu's squid package (/etc/squid/squid.conf). We've added the kyrpz block to the top, just below the "INSERT YOUR OWN RULES" section. Do this yourself, and it'll do the needful.

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
acl kyrpz dstdomain "/etc/squid/ky-rpz.acl"
http_access deny kyrpz

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
#http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all

TODO

  • Test in production
  • Support a variable for "only leave these in the output dir"
  • Make the caching better

References

Thanks to

ky-rpz's People

Contributors

yaleman avatar kushfj avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.