Skip to content

evuraan/Magan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magan

Magan is a DNS over HTTPS (DoH) server.

DNS dates back to the gentler days of Internet when clear text transmissions were considered quite OK.

Unencrypted DNS Traffic

These days, there is increasing awareness among users to encrypt their traffic, including DNS.

Magan handles your incoming DNS requests and retrieves appropriate responses from Google Public DNS over HTTPS - thereby encrypting your otherwise clear-text DNS traffic.

Encrypted DNS Traffic

The C version is recommended; also available are the Go and Python3 variants.

A few pre-built binaries for Linux and Windows are available here.

See here for running Magan as a Windows OS Service.

Build instructions

The C version

We need libcurl4-openssl-dev and libjson-c, usually installed on Debian thusly:

$ sudo apt install libjson-c libcurl4-openssl-dev

or, try

$ sudo apt install libjson-c-dev libcurl4-openssl-dev
Once all the pre-requisites are met, compile magan as:

$ gcc -Wall -Wvla -Wextra magan.c -pthread -lcurl -ljson-c -o magan-$(uname -m) 

(Also see make.sh.)

Building the Go variant

See make_go_binaries.sh

The Python3 Version

We need latest scapy:

$ pip3 install scapy

and then:

$ ./magan.py -h
Usage:
  -h  --help         print this usage and exit
  -p  --port         alternate port to listen
  -v  --version      print version information and exit

Basic Usage

$ ./magan --help
Usage: ./magan [options]
  -h  --help         print this usage and exit
  -p  --port         alternate port to listen
  -v  --version      print version information and exit

to listen on non-privileged port

You don't need root privileges if you are using port > 1024:

$ ./magan-armv7l -p 3131
Thu Apr  4 19:34:48 2019 Magan[26795]: Magan/1.2
Thu Apr  4 19:34:48 2019 Magan[26795]: Listening on port: 3131
Thu Apr  4 19:34:48 2019 Magan[26795]: Ready
..

to listen on privileged port

you'd need root privs if you want to listen in on port number less than 1024

$ sudo ./magan-armv7l 
Thu Apr  4 19:35:20 2019 Magan[26823]: Magan/1.2
Thu Apr  4 19:35:20 2019 Magan[26823]: Listening on port: 53
Thu Apr  4 19:35:20 2019 Magan[26823]: Ready
..

Startup

Startup can be as simple as adding a line to your /etc/crontab:

*/5 * * * *    someuser     /usr/local/bin/magan -p 1039 1>/dev/null 2>/dev/null

If you are running as root, then:

*/5 * * * *    root     /usr/local/bin/magan -p 53 1>/dev/null 2>/dev/null

Changelog

See Changelog