Skip to content

Instantly share code, notes, and snippets.

View mat813's full-sized avatar

Mathieu Arnold mat813

View GitHub Profile
@mat813
mat813 / named.aug
Created July 5, 2011 15:29
Bind's config augias lense (WIP)
(*
Module: Named
parses /etc/namedb/named.conf
Author: Mathieu Arnold <mat@FreeBSD.org>
About: Reference
This lens tries to keep as close as possible to the bind documentation where
possible. An online source being :
http://www.freebsd.org/cgi/man.cgi?query=syslog.conf&sektion=5
@mat813
mat813 / change-ns.rb
Last active May 30, 2017 12:53
OpenDNSSEC to SmallRegistry
#!/usr/bin/env ruby
# frozen_string_literal: true
# vim:sw=2 sts=2:
require 'rubygems'
require 'dnsruby'
require 'epp-client/smallregistry'
require 'awesome_print'
require 'getoptlong'
@mat813
mat813 / ripe.rb
Last active May 30, 2017 12:51
OpenDNSSEC to RIPE
#!/usr/bin/env ruby
# frozen_string_literal: true
# ods-ksmutil key export --keystate ready -t KSK --all | ruby ripe.rb ready
# ods-ksmutil key export --keystate retire -t KSK --all | ruby ripe.rb retire
require 'pp'
require 'rubygems'
require 'dnsruby'
require 'net/smtp'
# $Abso: Makefile,v 55f370ca4feb 2013/08/27 12:21:04 hg $
all: commit unsigned sign
SIGNED!= find -s * -name '*.signed'
sign: ${SIGNED}
COMMIT?=Update
UNSIGNED=/usr/local/var/opendnssec/unsigned/
@mat813
mat813 / fb-update.vcl
Last active March 23, 2017 15:35
Varnish configuration for freebsd-update proxy
vcl 4.0;
import std;
import directors;
import saintmode;
# dig +noall +answer +short srv _http._tcp.update.freebsd.org | sort -k 2,2nr | while read priority weight port target; do printf "backend %s {\n\t.host = \"%s\";\n\t.port = \"80\";\n}\n" ${target//.*} $target; done
backend update5 {
.host = "update5.freebsd.org.";
.port = "80";
}
backend update6 {
@mat813
mat813 / convert.pl
Last active January 12, 2017 18:37
Convert a directory containing zone files into a dlz directory
#!/usr/bin/env perl
#
use 5.008;
use utf8;
use strict;
use warnings;
use File::Spec;
use File::Path qw(make_path);
@mat813
mat813 / export-import.sh
Created November 21, 2016 18:21
Export/Imports commits from/to a git branch
for i in $(git branch|cut -b 3-|sed -e '/^trunk$/d;/^svnadmin$/d')
do
mkdir -p ../patch/$i
git format-patch -o ../patch/$i origin/trunk..$i
git show $(head -1 ../patch/$i/0001-*|awk '{print $2}')~1|grep git-svn-id > ../patch/$i/rev-svn
done
for i in $(find ../patch -name rev-svn|sed -e 's/^..\/patch\///;s/\/rev-svn$//')
do
rev=$(sed -e 's/.*@\([[:digit:]]*\) .*/\1/' ../patch/$i/rev-svn)
(*
Module: FreeBSD Update
parses /etc/freebsd-update.conf
Author: Mathieu Arnold <mat@FreeBSD.org>
About: Reference
This lens tries to keep as close as possible to `man 5 freebsd-update.conf`.
An online source being :
http://www.freebsd.org/cgi/man.cgi?query=freebsd-update.conf&sektion=5
@mat813
mat813 / .gitignore
Created November 20, 2012 19:11
Bird 2 Dot
*.conf
*.dot
*.png
@mat813
mat813 / bind_conf.treetop
Created April 24, 2012 15:34
simple named.conf parsing
require 'ip'
grammar BindConf
include IP
rule entries
(zone / key / server)* {
%w(zone key server).each do |i|
module_eval <<-eot, __FILE__, __LINE__+1
def each_#{i}(&block)