Skip to content

Instantly share code, notes, and snippets.

@b4ldr
b4ldr / dns.sh
Last active August 29, 2015 14:05
ZONE_PATH="/home/bind"
BIND_PATH="/var/lib/bind"
TMP=$(mktemp)
FC="dns.zones.txt"
for ZONE in $(awk '$2=="Primary" {print $1}' "${ZONE_PATH}/${FC}")
do
echo -e "zone ${ZONE} {\n\ttype slave;\n\tmasters { 192.168.1.100; };\n\tfile \"${BIND_PATH}/${ZONE}.zone\";\n};"
done > ${TMP}
Process Process-2:
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
dig PTR 1.0-255.207.43.72.in-addr.arpa. @72.237.212.20
;; Question section mismatch: got 73.0.207.43.in-addr.arpa/PTR/IN
;; Question section mismatch: got 73.0.207.43.in-addr.arpa/PTR/IN
;; Question section mismatch: got 73.0.207.43.in-addr.arpa/PTR/IN
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: User[peadmin] is already declared in file /etc/puppetlabs/puppet/environment/nsd_concat/modules/users/manifests/adduser.pp:46; cannot redeclare at /opt/puppet/share/puppet/modules/pe_accounts/manifests/user.pp:90 on node master1.lax.dns.icann.org
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
I have an NSD module which is used to configure master and slave servers.
Currently the slave servers use a custom type to export there tsig keys
and the master server consumes these in its config. this works because
i can include the tsig config with an include statement (see code).
however i also need to add notify statements for each server.
the zone config looks a bit like this
server:
stuff
....
b.root-servers.net:7 messages, 381787 size of messages wire , 588354 size of messages text, 5928 answers, 8154 records, wire size of records 437327, text size of records 800877
k.root-servers.net:21 messages, 343417 size of messages wire , 590167 size of messages text, 5654 answers, 8154 records, wire size of records 437327, text size of records 791013
c.root-servers.net:7 messages, 381787 size of messages wire , 588354 size of messages text, 5928 answers, 8154 records, wire size of records 437327, text size of records 800877
f.root-servers.net:7 messages, 381899 size of messages wire , 588354 size of messages text, 5932 answers, 8154 records, wire size of records 437327, text size of records 801021
g.root-servers.net:7 messages, 381787 size of messages wire , 588347 size of messages text, 5928 answers, 8154 records, wire size of records 437327, text size of records 800877
import dns.query
import dns.zone
import dns.tsigkeyring
import dns.tsig
import socket
import sys
import StringIO
def get_stats(xfr):
zone = StringIO.StringIO()
time ansible -T20 -vvv 'lax03*' -m test.py
<lax03.example.com> ESTABLISH CONNECTION FOR USER: b4ldr
<lax03.example.com> EXEC ['ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/b4ldr/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=20', u'lax03.example.com', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1404477098.53-159657835706860 && chmod a+rx $HOME/.ansible/tmp/ansible-1404477098.53-159657835706860 && echo $HOME/.ansible/tmp/ansible-1404477098.53-159657835706860'"]
<lax03.example.com> REMOTE_MODULE test.py
<lax03.example.com> PUT /tmp/tmp4wosoI TO /home/b4ldr/.ansible/tmp/ansible-1404477098.53-159657835706860/test.py
<lax03.example.com> PUT /tmp/tmpNjAri1 TO /home/b4ldr/.ansible/tmp/ansible-1404477098.53-159657835706860/arguments
<lax03.example.com> EXEC ['ssh', '-tt', '-q
dasdfsdf
local coroutine = require "coroutine"
local io = require "io"
local nmap = require "nmap"
local shortport = require "shortport"
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
local tls = require "tls"
description = [[