All Projects → dyne → Gitzone

dyne / Gitzone

Licence: agpl-3.0
git-based zone management tool for static and dynamic domains

Programming Languages

perl
6916 projects

Projects that are alternatives of or similar to Gitzone

Sshmon
Manage and monitor SSH connections.
Stars: ✭ 152 (+52%)
Mutual labels:  sysadmin, ssh
Chameleon
Customizable honeypots for monitoring network traffic, bots activities and username\password credentials (DNS, HTTP Proxy, HTTP, HTTPS, SSH, POP3, IMAP, STMP, RDP, VNC, SMB, SOCKS5, Redis, TELNET, Postgres and MySQL)
Stars: ✭ 230 (+130%)
Mutual labels:  dns, ssh
Adams
UNIX system administration in Common Lisp
Stars: ✭ 135 (+35%)
Mutual labels:  sysadmin, ssh
noc
Official read only mirror for
Stars: ✭ 84 (-16%)
Mutual labels:  dns, ssh
gost
GO Simple Tunnel - a simple tunnel written in golang
Stars: ✭ 8,395 (+8295%)
Mutual labels:  dns, ssh
Bash Toolkit
Este proyecto esá destinado a ayudar a los sysadmin
Stars: ✭ 13 (-87%)
Mutual labels:  dns, sysadmin
Txeh
Go library and CLI utilty for /etc/hosts management.
Stars: ✭ 181 (+81%)
Mutual labels:  dns, sysadmin
gost
GO Simple Tunnel - a simple tunnel written in golang
Stars: ✭ 154 (+54%)
Mutual labels:  dns, ssh
dist-detect
Try to determine what Linux/Unix distribution is running on a remote host and get a hint if security updates are applied.
Stars: ✭ 14 (-86%)
Mutual labels:  dns, ssh
Nps
一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
Stars: ✭ 19,537 (+19437%)
Mutual labels:  dns, ssh
Sshremotekeys
Managing SSH keys remotely to control access to hosts
Stars: ✭ 70 (-30%)
Mutual labels:  sysadmin, ssh
Devdns
Automagic Docker DNS for local development
Stars: ✭ 99 (-1%)
Mutual labels:  dns
Docker Tunnel
a (simple) dockerized ssh tunnel
Stars: ✭ 96 (-4%)
Mutual labels:  ssh
Cazador unr
Hacking tools
Stars: ✭ 95 (-5%)
Mutual labels:  dns
Ssh Mitm
SSH man-in-the-middle tool
Stars: ✭ 1,328 (+1228%)
Mutual labels:  ssh
Mercury
Simple Android app that sends pre-configured commands to remote servers via SSH.
Stars: ✭ 100 (+0%)
Mutual labels:  ssh
Guacamole
Guacamole是无客户端的远程桌面网关。它支持VNC,RDP和SSH等标准协议。 我们称之为无客户端,因为不需要插件或客户端软件。 感谢HTML5,一旦Guacamole安装在服务器上,您访问桌面所需的全部功能就是一个Web浏览器。
Stars: ✭ 99 (-1%)
Mutual labels:  ssh
Sshconfig
Minimal command to Add/Remove/list ssh aliases in $HOME/.ssh/config
Stars: ✭ 93 (-7%)
Mutual labels:  ssh
Bind Restapi
A RESTful json api to BIND DNS
Stars: ✭ 91 (-9%)
Mutual labels:  dns
Dnscrypt Protocol
DNSCrypt protocol specification
Stars: ✭ 91 (-9%)
Mutual labels:  dns

#+TITLE: gitzone #+AUTHOR: tg(x) #+OPTIONS: ^:{} #+INFOJS_OPT: view:showall ltoc:nil #+STYLE: <style>html{max-width:1000px}</style>

#+LATEX_HEADER: \usepackage{lmodern} #+LATEX_HEADER: \usepackage{fullpage}

  • 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. #+LATEX: \pagebreak

  • 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:

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

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:

#+BEGIN_EXAMPLE 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 #+END_EXAMPLE

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.

#+BEGIN_EXAMPLE % 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 #+END_EXAMPLE

** SSH commands

The following SSH commands are provided by gitzone-shell:

  • =update-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 [email protected]

** 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].