• Stars
    star
    114
  • Rank 298,630 (Top 7 %)
  • Language
    Perl
  • License
    GNU Affero Genera...
  • Created almost 11 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

git-based zone management tool for static and dynamic domains

gitzone

About

Gitzone is a git-based zone file management tool for BIND. Users can update their zones in a git repository then during a push the zone files are checked, updated & reloaded from git receive hooks. If there’s an error in a file being pushed then the push is rejected, thus only correct files are stored on the server. Gitzone is written in Perl.

Gitzone-shell is similar to git-shell but it restricts the user to the zones repository and provides some additional commands for dynamic DNS updates & SSH key management.

Installation (semi-automatic)

First install Bind9 (not covered by this documentation).

Then install all scripts in the prefix /bin path and /libexec

# make install

Once the binaries are in place, to enable gitzone for a user there is a relatively simple script: gitzone-install. Usage synopsis:

# gitzone-install username id_rsa.pub

This script assumes that a user with ‘username’ (first argument) already exists: anyone with access to this user will be in control of gitzone, since access is managed via ssh authentication.

Second argument is the first public ssh key which will have write permissions to change zones (more keys can be added later).

If you intend to use the dynamic DNS feature via the gitzone-shell, then you’d better create a specific user only for gitzone.

Once ready, run the script with all the arguments in place.

Then create /etc/bind/repos/${user}.conf and put inside:

zone "domain.com" {
	type master;
	notify yes;
	file "/var/cache/bind/$user/domain.com";
	allow-transfer { transfer; };
};

Where ‘domain.com’ is the first domain you are managing with gitzone. There can be more domains and for each of them the above configuration section must be created.

Now clone the gitzone repository from another user that has access to the ssh secret key configured in gitzone-install. The git url will be composed of the hostname of the machine where is has been installed and the username chosen:

git clone [email protected]:zones/username gitzone-admin

The command above will clone the new gitzone repository into a directory gitzone-admin. If you aren’t familiar with git, this is a good time to go study it.

Create a file named ‘domain.com’ inside gitzone-admin and fill it in as a canonical DNS zone file for bind9. Then add, commit and push:

cd gitzone-admin; vim domain.com
 (edit the zone file according to bind9 documentation)
git add domain.com
git commit -m "initial zone commit for domain.com"
git push

If the domain.com file contains any errors, gitzone will not accept the push and will report an error among the screen messages.

If all went well, restart the bind9 daemon and you’ll see that the zone for domain.com is served by your new DNS. One can check using nslookup.

Gitzone can be installed on multiple users on the same machine, this way there can be different admins (or groups of admins) for different zones all on the same machine.

Installation (in close detail)

  • set PREFIX in Makefile and make sure the paths in the hooks are correct, then
    # make install
        
  • edit path settings in gitzone-shell
  • create users with ssh access and set their shell to gitzone-shell
  • create a zones repo for each user and set receive.denyCurrentBranch to ignore, this allows pushing to a checked out repository. The checked out files are used for incrementing serials and validating the zones with named-checkzone.
    # mkdir -p ~$user/zones
    # cd ~$user/zones
    # git init $user
    # cd $user
    # git config receive.denyCurrentBranch ignore
    # cd .git/hooks
    # ln -s /usr/libexec/gitzone/pre-receive
    # ln -s /usr/libexec/gitzone/post-receive
        
  • if you want to use a repository locally add these hooks as well / instead:
    # ln -s /usr/libexec/gitzone/pre-commit
    # ln -s /usr/libexec/gitzone/post-commit
        
  • create a .gitconfig for each user that contains user name & user email (used for auto increment commits):
    # git config -f ~$user/.gitconfig user.name $user
    # git config -f ~$user/.gitconfig user.email "[email protected]"
        
  • add ssh keys to ~$user/.ssh/authorized_keys and enable ssh key editing if desired:
    # touch ~$user/.ssh/authorized_keys_edit_allowed
        
  • make sure the user’s HOME directory has correct permissions:
    # chown -R $user:users ~$user
        
  • edit the settings in gitzone.conf
  • create a directory for each user in $zone_dir and chown them to the users, this will contain a clone of the user’s repository, the zone files here should be included in named.conf.
    # cd $zone_dir
    # mkdir $user
    # chown $user:$group $user
        
  • edit named.conf
    • set directory in options to $zone_dir, this is needed to make relative file names work in $INCLUDE:
      options {
        directory "/var/named";
        // ...
      }
              
    • put user zone configuration in a separate file for each user and include them:
      include "/etc/bind/repos/user1.conf";
      include "/etc/bind/repos/user2.conf";
      include "/etc/bind/repos/user3.conf";
              

Usage

Git repository

To make changes to the zones you need to clone the git repository, edit the files, commit the changes and finally push the changes to the server. If you use the auto increment feature you also need to pull after a push as the receive hooks on the server make commits to the repository during a push.

% git clone ns.example.net:zones/$user zones
% # or if you're using gitzone-shell you can use any path:
% git clone ns.example.net:zones
% cd zones
% # edit files
% git add .
% git commit -m 'commit msg'
% git push origin && git pull

SSH commands

The following SSH commands are provided by gitzone-shell:

  • update-record <filename> <record>: updates the IP address of the first matched record in the given file to the SSH client’s IP address.
    % ssh ns.example.net update-record example.net somehost IN A
        
  • SSH key management commands, to use these do:
    touch .ssh/authorized_keys_edit_allowed
        

    in the users’ home directories.

    • list-keys: list added ssh keys
      % ssh ns.example.net list-keys
              
    • add-key: add a new ssh key
      % ssh ns.example.net add-key `cat id_rsa.pub`
              

      or only allow one specific command:

      % ssh ns.example.net add-key 'command="update-record example.net somehost IN A"' `cat id_rsa.pub`
              
    • del-key: delete an ssh key from the config
      % ssh ns.example.net del-key user@somewhere
              

Dynamic DNS

In order to do automatic dynamic DNS updates, create an SSH key without a password and use the add-key command to add it with a command= parameter which has an update-record command in it, see the example in the previous section. This way the host doing the updates does not have access to the git repository as it is restricted to the specified command only. Then all you have to do to update your IP is:

% ssh ns.example.net

Run this command whenever the IP changes or the interface comes up.

Debian, Ubuntu

On Debian-like systems you can use a post-up command in /etc/network/interfaces.

Gentoo

On Gentoo you can put a postup() function in /etc/conf.d/net.

Zone files

There are a few keywords you can use in the zone files:

  • ;AUTO_INCREMENT after a serial number to automatically increment it during a push. If the number is 10 digits and starts with 20 it’s treated as a date. e.g.:
    example.net.  IN  SOA  ns1.example.net. hostmaster.example.net. (
                           2011013101  ;AUTO_INCREMENT
                           1d 2h 4w 2d )
        
  • $INCLUDE can be used to include other files from the repository, the file names should be prefixed with the user name
  • ;INCLUDED_BY on the first line of a file indicates what other files include this file. When this file is committed & pushed all the other files listed after ;INCLUDED_BY are reloaded as well.

    E.g. if you have the following files in the repository then a change in example-common would result in the reload of both example.net & example.org:

    • example.net:
      ...
      $INCLUDE username/example-common example.net.
              
    • example.org:
      ...
      $INCLUDE username/example-common example.org.
              
    • example-common:
      ;INCLUDED_BY example.net example.org
      ...
              

Acknowledgements

Gitzone is copyright (C) 2013-2019 by Dyne.org foundation, Amsterdam

Designed and written by tg(x)

Maintained and documented by Denis Roio and Ivan J.

With contributions by Zephaniah Loss-Cutler-Hull

Gitzone is Licensed under the terms of the Affero GNU Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See [the License](LICENSE.txt).

More Repositories

1

Tomb

the Crypto Undertaker
Shell
1,190
star
2

frei0r

A large collection of free and portable video plugins
C
397
star
3

Zenroom

Embedded no-code VM executing human-like language to manipulate data and process cryptographic operations.
C
183
star
4

dnscrypt-proxy

DNSCrypt-Proxy repository, frankly maintained for what it does (no new features planned)
C
166
star
5

dowse

The Awareness Hub for the Internet of Things
C
157
star
6

file-extension-list

Organised collection of common file extensions
Shell
116
star
7

ZShaolin

Interactive and scriptable console terminal on Android (build framework)
Java
111
star
8

JaroMail

Terminal UI email client to download, filter, search and archive messages off-line
Shell
101
star
9

domain-list

A list of domains (including CDN hosts) belonging to ICT company silos, i.e. FB, GOOG, AMZN etc.
Shell
76
star
10

sup

a "small is beautiful" tool for UNIX privilege escalation
C
53
star
11

dynebolic

dyne:bolic is a nomadic operating system, 100% Free, based on GNU/Linux
ASL
33
star
12

harvest

Tool to sort large collections of files according to common typologies
Shell
32
star
13

webnomad

A slick and solid website builder
JavaScript
30
star
14

binnit

minimal no-fuss pastebin service clone in golang
Go
30
star
15

decode-proximity-hw

Embedded version of decode's proximity app
C
26
star
16

Freecoin

New project, moved to https://github.com/d-cent/freecoin
C++
24
star
17

tinfoil

A minimalist tool to manage multiple profiles for web browsers
Shell
21
star
18

docker-devuan-builds

Slim docker base images based on Devuan
Dockerfile
21
star
19

dohd

Very fast DNS-over-HTTPS to DNS proxy with emphasis on privacy (no logging)
C
21
star
20

docker2sh

Convert a Dockerfile to a shell script
Python
14
star
21

AutOrg

Autonomy is Organization
Emacs Lisp
13
star
22

FXC

FXC Simple Secret Sharing - clojure library
Clojure
13
star
23

social-wallet-api

Social Wallet REST API web interface
Clojure
12
star
24

reflow-crypto

Reflow: Zero Knowledge Multi Party Signatures with Application to Distributed Authentication
TeX
10
star
25

sud

minimalist sudo alternative: multi-user privilege escalation tool in three letters
HTML
9
star
26

scorsh

Signed-Commit Remote Shell - authenticated trigger for remote execution via Git
Go
9
star
27

autosshfs

Per user SSHFS automount using user's SSH configuration
Shell
9
star
28

freecoin-lib

Freecoin digital currency toolkit - core library
Clojure
8
star
29

fabchain

FABchain network based on geth + clique
Lua
8
star
30

Tomb3

WIP for Tomb v3 the crypto undertaker
Shell
8
star
31

pangolin

The Secret Pangolin Code, Fastest Proximity Tracing in the West (FPTW)
C
8
star
32

W3C-DID

Dyne.org's W3C-DID implementation
Shell
8
star
33

reflow-os

Base scripts to run Reflow OS
Makefile
7
star
34

RedRoom

Zenroom crypto module for Redis
C
7
star
35

zuper

Zsh Ultimate Programmer's Extensions Refurbished
Shell
7
star
36

bonfire_ui_reflow

UI for reflow bonfire app
Elixir
7
star
37

TorTV

Build of Tor maintained to run on TV devices and set-top boxes
Shell
6
star
38

lotionroom

Tendermint / Cosmos proof of concept contract made with Zenroom
JavaScript
6
star
39

Sawroom

Zenroom Transaction Processor for Hyperledger Sawtooth
Python
6
star
40

Agiladmin

Administration of timesheets and project budgets for small and medium organisations
JavaScript
6
star
41

reflow-docs

ReflowOS Architecture and Manual for Distributed Network Setup and Maintenance
HTML
5
star
42

starters

📐 Projects template starters of Dyne.org
Svelte
5
star
43

social-explorer

A Social Explorer UI built on top of SWAPI and Sawroom
Clojure
5
star
44

TBT

Time Based Text
C++
5
star
45

luigi

Design tool for hackers
JavaScript
5
star
46

fistpy

✊ 🐍 Python client library for Fist full text search
Python
5
star
47

lua-paillier

Lua module for the Paillier cryptographic scheme
C
4
star
48

decode-web

DECODE Project static website, rendered from the original site in Drupal
HTML
4
star
49

Writedown

Minimalistic academic publisher using markdown and pandoc
Shell
4
star
50

markdown-inline-tag

Render the content of <markdown></markdown> tags inside an HTML file using Pandoc
Shell
4
star
51

slangroom

Enhance zencode smart contracts with your slang
TypeScript
4
star
52

handbook-dev

Dyne.org's Handbook for developers
3
star
53

just-auth

A simple two factor authentication library
Clojure
3
star
54

clj-flows

A building block of the REFLOW infrastructure: a VF implementation in clojure, with graphql as API layer.
Clojure
3
star
55

social-wallet

A social wallet with a simple configurable UI backed by the social wallet api
Clojure
3
star
56

reflow-dpp-demo

Produce a Digital Product Passport from Reflow OS object
HTML
3
star
57

zenswarm

Protototype of Zenroom based consensus
Shell
3
star
58

luabinaries

Binary builds of the Lua language interpreter
Makefile
3
star
59

restroom-mw

🛠 Easy REST API builder executing Zencode
TypeScript
3
star
60

lua-zenroom

Port of Zenroom crypto primitives running on Lua5.1/Luajit including Nginx, Tarantool and Openresty
C
3
star
61

fxc-soldipubblici

Console interattiva (live-coding) per analisi di dati pubblicati su soldipubblici.gov.it
3
star
62

clj-storage

Minimal storage lib to facilitate different DB implementations
Clojure
2
star
63

mkdocs-dyne-theme

A mkdocs theme for dyne.org software webpages
HTML
2
star
64

zenflows

Resource-Event-Agent Graph Database governed by Valueflows vocabulary logics
Elixir
2
star
65

zenflows-crypto

Zencode crypto functions for Zenflows
Shell
2
star
66

restroom-github-action

Shell
2
star
67

tech-radar

Overview of technologies mapped according to our level of adoption
2
star
68

petition-tp-python

Transaction processor for Decode Petition over Hyperledger Sawtooth
Python
2
star
69

social-wallet-admin-console

Interactive admin console (REPL) for the social wallet
JavaScript
2
star
70

clj-auxiliary

Common auxiliary functions extending clojure basic utilities
Clojure
2
star
71

indycaptcha

An independent captcha that does not feed any AI and takes arbitrary lists of words
HTML
2
star
72

bonfire_reflow

Bonfire module for REFLOW authenticated graphs
Elixir
2
star
73

shuriken

A tool to throw confs around like a ninja
Shell
2
star
74

devuan-rpi4-home-assistant

Base installer for home-assistant + extensions for Devuan on RaspberryPi 4
Shell
2
star
75

devuan-sdk

Simple Development Kit for the Devuan GNU/Linux distribution
Shell
2
star
76

gh-cd

🚀 cd || clone || repo create
Go
2
star
77

socialwallet.app

HTML
2
star
78

docker-dyne-software

Docker setups to quickly deploy some software applications made by Dyne.org
Dockerfile
2
star
79

json-schema-builder-svelte

A Svelte component library for building JSON Schemas
Svelte
1
star
80

rustroom

Rust micro-service for fast async Zencode execution
Rust
1
star
81

zenroom-go-wrapper

Go
1
star
82

zenflows-gui

Reflow GUI
TypeScript
1
star
83

blog-code-samples

Code samples linked from https://medium.com/think-do-tank
HTML
1
star
84

bonfire_api_json

http api json post endpoints for bonfire
Elixir
1
star
85

dynebot

Telegram bot intended for helping automating small tedious tasks of dyne.org internal interaction
Python
1
star
86

great-dane

Zenroom DNS utilities
Go
1
star
87

softwarepassport

Software Passport compliancy check on the blockchain
Python
1
star
88

pangolin-armor

Proxy with load-balancing and SSL management for node pangolin staging server
JavaScript
1
star
89

zenroom-web-example

🚀 Running Zenroom js on HTML
HTML
1
star
90

FXC-webapi

FXC web API for Simple Secret Sharing
Clojure
1
star
91

bonfire_quantify

1
star
92

clj-paypal-ipn

PayPal IPN handler in Clojure for use with Ring and Compojure.
Clojure
1
star
93

tender-vf

prototype tendermint value flows
1
star
94

valueflows-dashboard

JavaScript
1
star
95

.github

1
star
96

zenpub-websites

zenpub design components
HTML
1
star
97

lurker-ng

Fork of lurker to keep the mailinglist archive alive with new fixes
C++
1
star
98

Zenroom-Android-app

Simple Android app, built to show how to use Zenroom libs
Java
1
star
99

zenswarm-oracle

Zenswarm Oracle implementation
JavaScript
1
star
100

W3C-DID-data

1
star