WIP software to distribute your zones.
Go to file
southerntofu e25ec510fb Remove unused variant 2020-04-03 00:36:07 +02:00
src Remove unused variant 2020-04-03 00:36:07 +02:00
tests Small testing script for the API with individual payloads 2020-04-02 22:42:12 +02:00
.gitignore Initial commit 2020-04-02 16:37:57 -04:00
Cargo.toml Basic HTTP JSON API 2020-04-02 22:40:28 +02:00
LICENSE Initial commit 2020-04-02 16:37:57 -04:00
README.md Basic infos in README 2020-04-02 23:10:31 +02:00
curl.sh Small testing script for the API with individual payloads 2020-04-02 22:42:12 +02:00

README.md

zonegift - all zones are created equal

zonegift is a web API to manage your zone. It aims to Keep It Simple Stupid (KISS).

ATTENTION: This is very early work! There is no DNS software integration at the moment, just a JSON API skeleton. So basically it does really nothing.

Authentication

Authentication is managed by the HTTP reverse proxy securing access to zonegift. If a REMOTE_USER HTTP header is found, it will be used as a reference for the currently logged in username. The API can only be used when the client is authenticated.

The examples in the next subsections are based on the nginx web server. However, this kind of setup would work with any HTTP reverse proxy.

Basic auth

HTTP Basic Auth is a very simple and standard authentication mechanism. It matches user-supplied username/password with a file in which the password is hashed.

Example /etc/nginx/users.db (user/password):

user:is1LYO/kerx8I

Example nginx configuration block for zonegift:

	location /api {
		auth_basic "NEED TO LOGIN";
		auth_basic_user_file "users.test";
		proxy_set_header REMOTE_USER $remote_user;
		proxy_pass http://localhost:3030;
		proxy_set_header Host $host;
		proxy_set_header X-Forwarded-For $remote_addr;
		proxy_intercept_errors on;
		recursive_error_pages on;
	}

Authentication by subrequest

TODO: How to let nginx decide on authentication by performing an HTTP auth request This allows to plug in a 3rd party authentication mechanism that speaks HTTP.

API

There is an API endpoint exposed under the route "/api". You can try it out with the JSON payloads located in the tests/ folder. There is a convenient wrapper script to use those, called curl.sh:

$ ./curl.sh
Available test payloads:
bogus_command
bogus_method
stats
version
zone_list
zone_read
$ ./curl.sh version
0.0.1
$ ./curl.sh bogus_method
curl: (22) The requested URL returned error: 400 Bad Request
HTTP ERROR
$ ./curl.sh bogus_command
curl: (22) The requested URL returned error: 400 Bad Request
HTTP ERROR

The API has no specification yet.