GithubHelp home page GithubHelp logo

volroom / expunji Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 0.0 121 KB

DNS Sinkhole made with Elixir

License: GNU General Public License v3.0

Elixir 98.91% Shell 0.63% Euphoria 0.45%
elixir dns dns-server pi-hole ad-blocker

expunji's Introduction

Expunji

DNS Sinkhole made with Elixir

Setup

  • Install Elixir - https://elixir-lang.org/install.html
  • Install dependencies - mix deps.get
  • Download some blocklists, and copy/symlink them to hosts/
  • Start server with iex -S mix phx.server or build with MIX_ENV=prod mix release (you may need to manually grant permissions to listen on port 53 depending on your operating system)
  • An example SystemD service is included at priv/expunji.service

Done! Now start sending it DNS requests.

All domains present in your hosts files will be answered with 0.0.0.0, all others will be sent real answers.

Metrics are made available by a Prometheus endpoint, the default address is: http://localhost:4000/metrics. An example Grafana dashboard is included at priv/dashboard.json and an example Prometheus config is included at priv/prometheus.yml.

Configuration

The following environment variables may be used to configure Expunji:

EXPUNJI_BLOCKED_IP - IP address to answer blocked domains with (default 0.0.0.0)
EXPUNJI_CLIENT_SOCKET_PORT - Port number to listen for DNS requests on (default 53)
EXPUNJI_HOSTS_DIR - Directory where hosts files are located (default "hosts/")
EXPUNJI_HTTP_PORT - Port number for the prometheus endpoint (default 4000)
EXPUNJI_LOG_LEVEL - Log level - info/error/debug/warn (default "info"). Set to "error" if you want to hide loglines for
successful DNS queries.
EXPUNJI_NAMESERVER_IP - The IP address of the nameserver to forward requests to (default 1.1.1.1)
EXPUNJI_NAMESERVER_DEST_PORT - Port number to forward requests to on nameserver (default 53)
EXPUNJI_NAMESERVER_SOCKET_PORT - Port number to send forwarded requests from (default 0 - i.e. random available port)
EXPUNJI_WHITELIST_PATH - Path of whitelist file (defaults to a file called "whitelist" in project root)

Whitelist

To make automatic updates of hosts files easier, a whitelist can be used to exclude certain domains. Add the domains you'd like to whitelist to a file and make it available to Expunji.

Maintenance

To reload hosts files, run Expunji.Server.reload_hosts() An example shell script that can be used to auto-update hosts is included at priv/reload_hosts.sh

Other Tasks

  • Format: mix format
  • Lint: mix credo
  • Run Tests: mix test
  • Get Coverage: mix coveralls

expunji's People

Contributors

dependabot[bot] avatar volroom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.