Skip to content

Instantly share code, notes, and snippets.

@TimSimmons
TimSimmons / againstbind
Last active November 10, 2015 19:48
Answering an IXFR Query with DNSPython
# Just to show something similar happening in BIND9
$ dig @10.208.6.136 example1.com ixfr=1447178857
; <<>> DiG 9.9.5-9+deb8u3-Debian <<>> @10.208.6.136 example1.com ixfr=1447178857
; (1 server found)
;; global options: +cmd
example1.com. 3310 IN SOA ns2.test.com. tim.tim.com. 1447181885 3600 600 86400 3600
example1.com. 3310 IN SOA ns2.test.com. tim.tim.com. 1447178857 3600 600 86400 3600
example1.com. 3310 IN SOA ns2.test.com. tim.tim.com. 1447181885 3600 600 86400 3600
This file has been truncated, but you can view the full file.
d-prd-proxy-haproxy-01:~$ netstat -tapln
(No info could be read for "-p": geteuid()=1008 but you should be root.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 172.16.7.4:11001 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 172.16.7.4:11002 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp 0 0 172.16.7.4:11003 0.0.0.0:* LISTEN -
tcp 0 0 172.16.7.4:11004 0.0.0.0:* LISTEN -
netstat -tapln
(No info could be read for "-p": geteuid()=1008 but you should be root.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5354 0.0.0.0:* LISTEN -
tcp 0 0 172.16.7.12:5354 172.16.7.4:48543 SYN_RECV -
tcp 0 0 172.16.7.12:5354 172.16.7.4:53280 SYN_RECV -
tcp 0 0 172.16.7.12:5354 172.16.7.4:36180 SYN_RECV -
tcp 0 0 172.16.7.12:5354 172.16.7.4:33712 SYN_RECV -
Oct 2 21:07:14 ip6-localhost haproxy[4691]: 172.16.7.17:36364 [02/Oct/2015:21:07:14.572] stagingns-priv.rackspace.com_agent stagingns-priv.rackspace.com_agent/stagingns-priv.rackspace.com_agent 1/0/36 42 -- 8/1/1/1/0 0/0
haproxy[4691]: process_name '[' pid ']:'
172.16.7.17:36364 client ip/port
[02/Oct/2015:21:07:14.572] accept date
stagingns-priv.rackspace.com_agent frontend name
stagingn...gent/stagingn.....om_agent backend_name '/' server_name
1/0/36 Tw '/' Tc '/' Tt*
42 bytes_read*
-- termination_state
default['logstash']['instance_default']['config_templates_cookbook'] = 'my-wrapper-cookbook'
default['logstash']['instance_default']['config_templates'] = {}
default['logstash']['instance_default']['config_templates_variables'] = {}
@TimSimmons
TimSimmons / concur.py
Last active August 29, 2015 14:27
Concurrency is hard
import redis
import time
r = redis.StrictRedis(host='localhost', port=6379, db=0)
def red():
r.incr('foo')
for x in range(0,1000):
red()
dns_servers = node['proxy']['dns_proxy']
$i = 1
dns_servers.each do |dns|
port = 11000 + $i
haproxy_listen dns["name"] do
mode 'tcp'
description "#{dns["name"]} proxy endpoint"
source node['ipaddress']
a = "$ORIGIN importer.com\nimporter.com 42 IN SOA ns.importer.com nsadmin.importer.com 42 42 42 42 42\nimporter.com 42 IN NS ns.importer.com\nimporter.com 42 IN MX 10 mail.importer.com\nns.importer.com 42 IN A 10.0.0.1\nmail.importer.com 42 IN A 10.0.0.2"
for x in range(0,1000):
a += "%s.example.com. 42 IN A 10.0.0.2\n" % str(x)
{
"_context_domain": null,
"_context_roles": [
"admin"
],
"_context_all_tenants": false,
"event_type": "dns.domain.delete",
"_context_edit_managed_records": false,
"_context_service_catalog": null,
"timestamp": "2015-05-01 20:46:35.102826",
@TimSimmons
TimSimmons / log.sql
Created March 25, 2015 15:20
axfr log
# Time: 150325 15:18:19
SELECT domains.id, domains.version, domains.created_at, domains.updated_at, domains.deleted, domains.deleted_at, domains.tenant_id, domains.name, domains.email, domains.description, domains.type, domains.transferred_at, domains.ttl, domains.serial, domains.refresh, domains.retry, domains.expire, domains.minimum, domains.status, domains.parent_domain_id, domains.action, domains.pool_id, domains.reverse_name
FROM domains
WHERE domains.name = 'cloddnstest.com.' AND domains.pool_id = '794ccc2cd75144feb57f8894c9f5c842' AND domains.deleted = '0'
LIMIT 2;
SELECT recordsets.id, recordsets.version, recordsets.created_at, recordsets.updated_at, recordsets.tenant_id, recordsets.domain_id, recordsets.name, recordsets.type, recordsets.ttl, recordsets.description, recordsets.reverse_name
FROM recordsets
WHERE recordsets.type = 'SOA' AND recordsets.domain_id = 'b3854322bf9b4596ac7b819646a4fcb8' ORDER BY recordsets.created_at ASC, recordsets.id ASC, recordsets.created_at ASC;
SELECT count(recor