Browse Source

migrated off of fork

pull/1/head
Chris Mahoney 6 months ago
commit
bd811bc7b6
  1. 1
      .gitignore
  2. 26
      README.md
  3. 168
      check_zones.py
  4. 166
      db.cosi
  5. 166
      db.cslabs
  6. 51
      db.cslabs.rvs.144
  7. 44
      db.cslabs.rvs.145
  8. 14
      db.cslabs.rvs.146
  9. 31
      db.cslabs.rvs.c051
  10. 11
      db.csprojects
  11. 71
      update_serial.py

1
.gitignore

@ -0,0 +1 @@
*.bak

26
README.md

@ -0,0 +1,26 @@
# zones
This is the repository where we track our DNS zone files
## Instructions to add records
The way that you update a configuration is as follows:
1. Clone down the repository locally to your computer
2. Add the changes you want (remember to add reverse DNS entries if you are adding A or AAAA records)
3. Run `./update_serial.py` which auto increments serials for all zone files
4. Run `./check_zones.py` to check your work
5. Commit your changes with a meaningful Git message. For example, "Serial 126, added random.cosi.clarkson.edu"
6. Log into Talos (128.153.145.3), become root, and `cd /etc/bind`
7. `git pull` This will update the repository locally.
8. `rndc reload` This will reload the DNS server.
If you are going to do it a different way, please make sure that you update the Git server with the newest version of the configuration, and be sure to make it so that we only need to "fast forward" on the DNS server itself.
## Other notes
`dns01.cosi.clarkson.edu` and `dns02.cosi.clarkson.edu` are glue records from Clarkson's nameservers, for `128.153.145.3` and `128.153.145.4`, respectively. 128.153.145.4 should *not* be used for any other purpose than a legitimate DNS server.
## Considerations
Remember that this DNS is propogated back to the public DNS servers. Please keep the record names apropriate. If you even slightly question the name, please contact a lab director for their input.

168
check_zones.py

@ -0,0 +1,168 @@
#!/usr/bin/env python3
import re
ORIGINS = {
'db.cslabs': 'cslabs.clarkson.edu',
'db.cosi': 'cosi.clarkson.edu',
#'db.csprojects': 'csprojects.clarkson.edu',
}
REVERSE = {
#'db.cslabs.rvs': ?,
'db.cslabs.rvs.144': '128.153.144.',
'db.cslabs.rvs.145': '128.153.145.',
'db.cslabs.rvs.146': '128.153.146.',
'db.cslabs.rvs.c051': '2605:6480:c051:',
}
RECPAT = re.compile(r'''
^\s*
(?P<name>[a-zA-Z0-9_\.-]+)
(?:\s+
(?P<class>[a-zA-Z]+))?
\s+
(?P<type>[a-zA-Z]+)
\s+
(?P<value>.*$)
''', re.X)
class Record(object):
__slots__ = ['name', 'cls', 'tp', 'value']
def __init__(self, name, cls, tp, value):
self.name = name
self.cls = cls
self.tp = tp
self.value = value
@classmethod
def from_match(cls, match):
return cls(
*match.group('name', 'class', 'type', 'value')
)
def __repr__(self):
return f'Record(name={self.name!r}, cls={self.cls!r}, tp={self.tp!r}, value={self.value!r})'
def __hash__(self):
return hash((self.name, self.cls, self.tp, self.value))
def __eq__(self, other):
if not isinstance(other, Record):
return False
return (self.name, self.cls, self.tp, self.value) == (other.name, other.cls, other.tp, other.value)
FWD = {} # zonefile -> [record]
RVS = {} # id
def get_recs_from_file(f):
rv = []
for line in open(fn):
match = RECPAT.match(line)
if not match:
print(f'rejected line: {line!r}')
continue
rec = Record.from_match(match)
rv.append(rec)
return rv
def expand_ip6(s):
groups = s.split(':')
zs = 8 - len(list(filter(None, groups)))
if zs > 0:
fi = groups.index('')
groups = groups[:fi] + ['0000'] * zs + groups[fi+1:]
return ':'.join(i.rjust(4, '0') for i in groups)
def into_digits(addr):
return [c for c in addr if c != ':']
def canon_ip6(digits):
groups = [''.join(digits[i*4:(i+1)*4]) for i in range(8)]
fz, lz = None, None
try:
fz = groups.index('0000')
except ValueError:
pass
else:
lz = len(groups) - list(reversed(groups)).index('0000')
groups = [i.lstrip('0') for i in groups]
if fz is not None:
return ':'.join(groups[:fz]) + '::' + ':'.join(groups[lz:])
return ':'.join(groups)
def cons_addr(rec, org):
if rec.tp != 'PTR':
raise ValueError(rec)
if '.' in org:
parts = '.'.join(reversed(rec.name.split('.')))
return org + parts
elif ':' in org:
digits = list(reversed(rec.name.split('.')))
digits = [i for i in org if i != ':'] + digits
return canon_ip6(digits)
for fn, zone in ORIGINS.items():
FWD[fn] = get_recs_from_file(open(fn))
for fn, rv in REVERSE.items():
RVS[fn] = get_recs_from_file(open(fn))
for za in ORIGINS.keys():
for zb in ORIGINS.keys():
if za <= zb:
continue
print('Comparison between', za, 'and', zb)
sa = set(FWD[za])
sb = set(FWD[zb])
ma = sb - sa
mb = sa - sb
print(f'Missing from {za}:')
for i in ma:
print('\t', i)
print(f'Missing from {zb}:')
for i in mb:
print('\t', i)
mrvs = {} # canonaddr -> rec
seen_addrs = {} # addr -> oldname
seen_names = {} # name -> firstaddr
for z in ORIGINS.keys():
for rec in FWD[z]:
if rec.tp == 'A':
mrvs[rec.value] = rec
elif rec.tp == 'AAAA':
mrvs[canon_ip6(into_digits(expand_ip6(rec.value)))] = rec
print('Reverse records:')
for r, addr in REVERSE.items():
for rec in RVS[r]:
if rec.tp != 'PTR':
continue
a = cons_addr(rec, addr)
if a in seen_addrs:
print(f'\t- Rvs {a} (for {rec.value}) has already been seen as {seen_addrs[a]}')
else:
try:
del mrvs[a]
except KeyError:
print(f'\t- Rvs {a} (supposedly {rec.value}) doesn\'t correspond to any forward record')
seen_addrs[a] = rec.value
if rec.value in seen_names:
print(f'\t- Name {rec.value} (for {a}) has already been seen as {seen_names[rec.value]}')
else:
seen_names[rec.value] = a
for addr, rec in mrvs.items():
print(f'\t- No rvs for {addr} (in {rec!r})')
#for fn, recs in FWD.items():
# for rec in recs:
# print(fn, ':', rec)
# if rec.tp == 'AAAA':
# print(canon_ip6(into_digits(expand_ip6(rec.value))))
#for fn, recs in RVS.items():
# for rec in recs:
# print(fn, ':', rec)
# if rec.tp == 'PTR':
# print(cons_addr(rec, REVERSE[fn]))

166
db.cosi

@ -0,0 +1,166 @@
$TTL 3d
@ IN SOA cosi.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Namservers
@ IN NS talos
recursion IN NS talos
; 144 subnet
cthulu IN A 128.153.144.20
cosi-01 IN A 128.153.144.21
cosi-02 IN A 128.153.144.22
cosi-03 IN A 128.153.144.23
cosi-04 IN A 128.153.144.24
cosi-05 IN A 128.153.144.25
cosi-06 IN A 128.153.144.26
cosi-07 IN A 128.153.144.27
cosi-08 IN A 128.153.144.28
3dprinter IN A 128.153.144.29
rx480 IN A 128.153.144.30
unifi01 IN A 128.153.144.31
itl-00 IN A 128.153.144.40
itl-01 IN A 128.153.144.41
itl-02 IN A 128.153.144.42
itl-03 IN A 128.153.144.43
itl-04 IN A 128.153.144.44
itl-05 IN A 128.153.144.45
itl-06 IN A 128.153.144.46
itl-07 IN A 128.153.144.47
itl-08 IN A 128.153.144.48
itl-09 IN A 128.153.144.49
itl-10 IN A 128.153.144.50
itl-11 IN A 128.153.144.51
itl-12 IN A 128.153.144.52
itl-13 IN A 128.153.144.53
itl-14 IN A 128.153.144.54
itl-15 IN A 128.153.144.55
itl-16 IN A 128.153.144.56
itl-17 IN A 128.153.144.57
itl-18 IN A 128.153.144.58
itl-19 IN A 128.153.144.59
itl-20 IN A 128.153.144.60
itl-21 IN A 128.153.144.61
itl-22 IN A 128.153.144.62
itl-23 IN A 128.153.144.63
itl-24 IN A 128.153.144.64
itl-25 IN A 128.153.144.65
; 145 subnet
ziltoid IN A 128.153.145.2
talos IN A 128.153.145.3
atlas IN A 128.153.145.4
bacon IN A 128.153.145.10
mirror IN A 128.153.145.19
f1 IN A 128.153.145.20
f2 IN A 128.153.145.21
tiamat IN A 128.153.145.41
hydra IN A 128.153.145.42
grand-dad IN A 128.153.145.43
elephant IN A 128.153.145.44
monika IN A 128.153.145.51
voip IN A 128.153.145.80
printer IN A 128.153.145.100
info IN A 128.153.145.101
norm IN A 128.153.145.121
undocs IN A 128.153.145.147
docs IN A 128.153.145.148
bouncer IN A 128.153.145.170
dubsdot IN A 128.153.145.200
dubsdot2 IN A 128.153.145.201
@ IN A 128.153.145.201
crow IN A 128.153.145.207
esports IN A 128.153.145.220
cugi-mc IN A 128.153.145.228
gitea IN A 128.153.145.233
nas3 IN A 128.153.145.248
red-dwarf IN A 128.153.145.249
prometheus IN A 128.153.145.250
swm1 IN A 128.153.145.251
swm2 IN A 128.153.145.252
swm3 IN A 128.153.145.253
swm4 IN A 128.153.145.254
; 146 subnet
146dhcp IN A 128.153.146.3
hnd-dev IN A 128.153.146.25
; IPv6
ziltoid IN AAAA 2605:6480:c051:0002::1
talos IN AAAA 2605:6480:c051:0003::1
atlas IN AAAA 2605:6480:c051:0004::1
bacon IN AAAA 2605:6480:c051:0005::1
mirror IN AAAA 2605:6480:c051:0100::1
dubsdot2 IN AAAA 2605:6480:c051:0200::1
c051 IN AAAA 2605:6480:c051:c051:c051:c051:c051:c051
voip6 IN AAAA 2605:6480:c051:0101::1
norm IN AAAA 2605:6480:c051:0303::1
; CNAMEs
dns1 IN CNAME talos
dns2 IN CNAME atlas
lapras IN CNAME talos
radius IN CNAME talos
files IN CNAME dubsdot2
print IN CNAME dubsdot
fsuvius IN CNAME dubsdot
fsu IN CNAME dubsdot
ip IN CNAME dubsdot
talks IN CNAME dubsdot2
oldtalks IN CNAME dubsdot
sklat IN CNAME dubsdot
grm IN CNAME dubsdot
pluto IN CNAME dubsdot
cnrl IN CNAME dubsdot
derpysayings IN CNAME dubsdot
probablyverifier IN CNAME dubsdot
history IN CNAME dubsdot
place IN CNAME dubsdot
mirrorstat IN CNAME dubsdot
scan IN CNAME dubsdot
life IN CNAME dubsdot
poem IN CNAME dubsdot
talk IN CNAME dubsdot
waste IN CNAME dubsdot
starwars IN CNAME dubsdot
clarkson IN CNAME dubsdot
scheduler IN CNAME dubsdot
dev IN CNAME dubsdot
tsdata IN CNAME dubsdot
browniepoints IN CNAME dubsdot
wishlist IN CNAME dubsdot
login IN CNAME dubsdot
dndarchive IN CNAME dubsdot
dnd IN CNAME dubsdot
folding IN CNAME dubsdot
random IN CNAME dubsdot
automatafl IN CNAME dubsdot
meatpod IN CNAME bacon
metapod IN CNAME bacon
defcon IN CNAME bacon
xen IN CNAME bacon
beep IN CNAME ziltoid
discord IN CNAME crow
git IN CNAME gitea
; TXT records
_kerberos IN TXT "CSLABS.CLARKSON.EDU"
; NS delegations
recursion IN NS ns.recursion
; Glue As
ns.recursion IN A 128.153.145.10
; CAA
@ IN CAA 128 issue "letsencrypt.org"
talos IN CAA 128 issue "talos.cslabs.clarkson.edu"
atlas IN CAA 128 issue "letsencrypt.org"
mirror IN CAA 128 issue "letsencrypt.org"
dubsdot IN CAA 128 issue "letsencrypt.org"
library IN CAA 128 issue "letsencrypt.org"
gitea IN CAA 128 issue "letsencrypt.org"

166
db.cslabs

@ -0,0 +1,166 @@
$TTL 3d
@ IN SOA cslabs.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Namservers
@ IN NS talos
recursion IN NS talos
; 144 subnet
cthulu IN A 128.153.144.20
cosi-01 IN A 128.153.144.21
cosi-02 IN A 128.153.144.22
cosi-03 IN A 128.153.144.23
cosi-04 IN A 128.153.144.24
cosi-05 IN A 128.153.144.25
cosi-06 IN A 128.153.144.26
cosi-07 IN A 128.153.144.27
cosi-08 IN A 128.153.144.28
3dprinter IN A 128.153.144.29
rx480 IN A 128.153.144.30
unifi01 IN A 128.153.144.31
itl-00 IN A 128.153.144.40
itl-01 IN A 128.153.144.41
itl-02 IN A 128.153.144.42
itl-03 IN A 128.153.144.43
itl-04 IN A 128.153.144.44
itl-05 IN A 128.153.144.45
itl-06 IN A 128.153.144.46
itl-07 IN A 128.153.144.47
itl-08 IN A 128.153.144.48
itl-09 IN A 128.153.144.49
itl-10 IN A 128.153.144.50
itl-11 IN A 128.153.144.51
itl-12 IN A 128.153.144.52
itl-13 IN A 128.153.144.53
itl-14 IN A 128.153.144.54
itl-15 IN A 128.153.144.55
itl-16 IN A 128.153.144.56
itl-17 IN A 128.153.144.57
itl-18 IN A 128.153.144.58
itl-19 IN A 128.153.144.59
itl-20 IN A 128.153.144.60
itl-21 IN A 128.153.144.61
itl-22 IN A 128.153.144.62
itl-23 IN A 128.153.144.63
itl-24 IN A 128.153.144.64
itl-25 IN A 128.153.144.65
; 145 subnet
ziltoid IN A 128.153.145.2
talos IN A 128.153.145.3
atlas IN A 128.153.145.4
bacon IN A 128.153.145.10
mirror IN A 128.153.145.19
f1 IN A 128.153.145.20
f2 IN A 128.153.145.21
tiamat IN A 128.153.145.41
hydra IN A 128.153.145.42
grand-dad IN A 128.153.145.43
elephant IN A 128.153.145.44
monika IN A 128.153.145.51
voip IN A 128.153.145.80
printer IN A 128.153.145.100
info IN A 128.153.145.101
norm IN A 128.153.145.121
undocs IN A 128.153.145.147
docs IN A 128.153.145.148
bouncer IN A 128.153.145.170
dubsdot IN A 128.153.145.200
dubsdot2 IN A 128.153.145.201
@ IN A 128.153.145.201
crow IN A 128.153.145.207
esports IN A 128.153.145.220
cugi-mc IN A 128.153.145.228
gitea IN A 128.153.145.233
nas3 IN A 128.153.145.248
red-dwarf IN A 128.153.145.249
prometheus IN A 128.153.145.250
swm1 IN A 128.153.145.251
swm2 IN A 128.153.145.252
swm3 IN A 128.153.145.253
swm4 IN A 128.153.145.254
; 146 subnet
146dhcp IN A 128.153.146.3
hnd-dev IN A 128.153.146.25
; IPv6
ziltoid IN AAAA 2605:6480:c051:0002::1
talos IN AAAA 2605:6480:c051:0003::1
atlas IN AAAA 2605:6480:c051:0004::1
bacon IN AAAA 2605:6480:c051:0005::1
mirror IN AAAA 2605:6480:c051:0100::1
dubsdot2 IN AAAA 2605:6480:c051:0200::1
c051 IN AAAA 2605:6480:c051:c051:c051:c051:c051:c051
voip6 IN AAAA 2605:6480:c051:0101::1
norm IN AAAA 2605:6480:c051:0303::1
; CNAMEs
dns1 IN CNAME talos
dns2 IN CNAME atlas
lapras IN CNAME talos
radius IN CNAME talos
files IN CNAME dubsdot2
print IN CNAME dubsdot
fsuvius IN CNAME dubsdot
fsu IN CNAME dubsdot
ip IN CNAME dubsdot
talks IN CNAME dubsdot2
oldtalks IN CNAME dubsdot
sklat IN CNAME dubsdot
grm IN CNAME dubsdot
pluto IN CNAME dubsdot
cnrl IN CNAME dubsdot
derpysayings IN CNAME dubsdot
probablyverifier IN CNAME dubsdot
history IN CNAME dubsdot
place IN CNAME dubsdot
mirrorstat IN CNAME dubsdot
scan IN CNAME dubsdot
life IN CNAME dubsdot
poem IN CNAME dubsdot
talk IN CNAME dubsdot
waste IN CNAME dubsdot
starwars IN CNAME dubsdot
clarkson IN CNAME dubsdot
scheduler IN CNAME dubsdot
dev IN CNAME dubsdot
tsdata IN CNAME dubsdot
browniepoints IN CNAME dubsdot
wishlist IN CNAME dubsdot
login IN CNAME dubsdot
dndarchive IN CNAME dubsdot
dnd IN CNAME dubsdot
folding IN CNAME dubsdot
random IN CNAME dubsdot
automatafl IN CNAME dubsdot
meatpod IN CNAME bacon
metapod IN CNAME bacon
defcon IN CNAME bacon
xen IN CNAME bacon
beep IN CNAME ziltoid
discord IN CNAME crow
git IN CNAME gitea
; TXT records
_kerberos IN TXT "CSLABS.CLARKSON.EDU"
; NS delegations
recursion IN NS ns.recursion
; Glue As
ns.recursion IN A 128.153.145.10
; CAA
@ IN CAA 128 issue "letsencrypt.org"
talos IN CAA 128 issue "talos.cslabs.clarkson.edu"
atlas IN CAA 128 issue "letsencrypt.org"
mirror IN CAA 128 issue "letsencrypt.org"
dubsdot IN CAA 128 issue "letsencrypt.org"
library IN CAA 128 issue "letsencrypt.org"
gitea IN CAA 128 issue "letsencrypt.org"

51
db.cslabs.rvs.144

@ -0,0 +1,51 @@
$TTL 3d
@ IN SOA cslabs.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Nameservers
@ IN NS talos.cslabs.clarkson.edu.
; Reverse 128.153.144/24
; Note: the trailing dots are VERY IMPORTANT!
20 IN PTR ryzen.cslabs.clarkson.edu.
21 IN PTR cosi-01.cslabs.clarkson.edu.
22 IN PTR cosi-02.cslabs.clarkson.edu.
23 IN PTR cosi-03.cslabs.clarkson.edu.
24 IN PTR cosi-04.cslabs.clarkson.edu.
25 IN PTR cosi-05.cslabs.clarkson.edu.
26 IN PTR cosi-06.cslabs.clarkson.edu.
27 IN PTR cosi-07.cslabs.clarkson.edu.
28 IN PTR cosi-08.cslabs.clarkson.edu.
29 IN PTR 3dprinter.cslabs.clarkson.edu.
30 IN PTR rx480.cslabs.clarkson.edu.
31 IN PTR unifi01.cslabs.clarkson.edu.
40 IN PTR itl-00.cslabs.clarkson.edu.
41 IN PTR itl-01.cslabs.clarkson.edu.
42 IN PTR itl-02.cslabs.clarkson.edu.
43 IN PTR itl-03.cslabs.clarkson.edu.
44 IN PTR itl-04.cslabs.clarkson.edu.
45 IN PTR itl-05.cslabs.clarkson.edu.
46 IN PTR itl-06.cslabs.clarkson.edu.
47 IN PTR itl-07.cslabs.clarkson.edu.
48 IN PTR itl-08.cslabs.clarkson.edu.
49 IN PTR itl-09.cslabs.clarkson.edu.
50 IN PTR itl-10.cslabs.clarkson.edu.
51 IN PTR itl-11.cslabs.clarkson.edu.
52 IN PTR itl-12.cslabs.clarkson.edu.
53 IN PTR itl-13.cslabs.clarkson.edu.
54 IN PTR itl-14.cslabs.clarkson.edu.
55 IN PTR itl-15.cslabs.clarkson.edu.
56 IN PTR itl-16.cslabs.clarkson.edu.
57 IN PTR itl-17.cslabs.clarkson.edu.
58 IN PTR itl-18.cslabs.clarkson.edu.
59 IN PTR itl-19.cslabs.clarkson.edu.
60 IN PTR itl-20.cslabs.clarkson.edu.
61 IN PTR itl-21.cslabs.clarkson.edu.
62 IN PTR itl-22.cslabs.clarkson.edu.
63 IN PTR itl-23.cslabs.clarkson.edu.
64 IN PTR itl-24.cslabs.clarkson.edu.
65 IN PTR itl-25.cslabs.clarkson.edu.

44
db.cslabs.rvs.145

@ -0,0 +1,44 @@
$TTL 3d
@ IN SOA cslabs.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Nameservers
@ IN NS talos.cslabs.clarkson.edu.
; Reverse 128.153.145/24
; Note: the trailing dots are VERY IMPORTANT!
2 IN PTR ziltoid.cslabs.clarkson.edu.
3 IN PTR talos.cslabs.clarkson.edu.
4 IN PTR atlas.cslabs.clarkson.edu.
10 IN PTR bacon.cslabs.clarkson.edu.
19 IN PTR mirror.cslabs.clarkson.edu.
20 IN PTR f1.cslabs.clarkson.edu.
21 IN PTR f2.cslabs.clarkson.edu.
41 IN PTR tiamat.cslabs.clarkson.edu.
42 IN PTR hydra.cslabs.clarkson.edu.
43 IN PTR grand-dad.cslabs.clarkson.edu.
44 IN PTR elephant.cslabs.clarkson.edu.
51 IN PTR monika.cslabs.clarkson.edu.
80 IN PTR voip.cslabs.clarkson.edu.
100 IN PTR printer.cslabs.clarkson.edu.
101 IN PTR info.cslabs.clarkson.edu
121 IN PTR norm.cslabs.clarkson.edu.
147 IN PTR undocs.cslabs.clarkson.edu.
148 IN PTR docs.cslabs.clarkson.edu.
170 IN PTR bouncer.cslabs.clarkson.edu.
200 IN PTR dubsdot.cslabs.clarkson.edu.
201 IN PTR dubsdot2.cslabs.clarkson.edu.
207 IN PTR crow.cslabs.clarkson.edu.
220 IN PTR esports.cslabs.clarkson.edu.
228 IN PTR cugi-mc.cslabs.clarkson.edu.
233 IN PTR gitea.cslabs.clarkson.edu.
248 IN PTR nas3.cslabs.clarkson.edu.
249 IN PTR red-dwarf.cslabs.clarkson.edu.
250 IN PTR prometheus.cslabs.clarkson.edu.
251 IN PTR swm1.cslabs.clarkson.edu.
252 IN PTR swm2.cslabs.clarkson.edu.
253 IN PTR swm3.cslabs.clarkson.edu.
254 IN PTR swm4.cslabs.clarkson.edu.

14
db.cslabs.rvs.146

@ -0,0 +1,14 @@
$TTL 3d
@ IN SOA cslabs.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Nameservers
@ IN NS talos.cslabs.clarkson.edu.
; Reverse 128.153.146/24
; Note: the trailing dots are VERY IMPORTANT!
3 IN PTR 146dhcp.cslabs.clarkson.edu.
25 IN PTR hnd-dev.cslabs.clarkson.edu.

31
db.cslabs.rvs.c051

@ -0,0 +1,31 @@
$TTL 3d
@ IN SOA cslabs.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Nameservers
@ IN NS talos.cslabs.clarkson.edu.
; Reverse 2605:6480:c051::/48
; 1.5.0.c.0.8.4.6.5.0.6.2.ip6.arpa.
;1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.x.x.x.x.1.5.0.c.0.8.4.6.5.0.6.2.ip6.arpa.
; Essential Services
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0 PTR ziltoid.cslabs.clarkson.edu.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0.0 PTR talos.cslabs.clarkson.edu.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.0.0.0 PTR atlas.cslabs.clarkson.edu.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.5.0.0.0 PTR bacon.cslabs.clarkson.edu.
; Public Services
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0 PTR mirror.cslabs.clarkson.edu.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0 PTR dubsdot2.cslabs.clarkson.edu.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.1.0 PTR voip.cslabs.clarkson.edu.
; Hardware
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.3.0 PTR norm.cslabs.clarkson.edu.
; Bacon
1.5.0.c.1.5.0.c.1.5.0.c.1.5.0.c.1.5.0.c PTR bacon.cslabs.clarkson.edu.

11
db.csprojects

@ -0,0 +1,11 @@
$TTL 3d
@ IN SOA csprojects.clarkson.edu. root.cslabs.clarkson.edu. (
210 ; serial
1d ; refresh
2h ; retry
1w ; expire
1800 ) ; negative caching-ttl
; Namservers
@ IN NS talos
xen IN A 128.153.145.10
eln IN A 128.153.145.151

71
update_serial.py

@ -0,0 +1,71 @@
#!/usr/bin/env python3
import re, sys, os
if not os.geteuid() == 0:
sys.exit("You must be root")
prop_serial = None
if len(sys.argv) > 1:
try:
prop_serial = int(sys.argv[1])
except ValueError:
print(f'Usage: {sys.argv[0]} <serialnum>')
exit(1)
FILES = [
'db.cosi',
'db.cslabs',
'db.csprojects',
#'db.cslabs.rvs',
'db.cslabs.rvs.144',
'db.cslabs.rvs.145',
'db.cslabs.rvs.146',
'db.cslabs.rvs.c051',
]
SERPAT = re.compile(r'(\d+)(\s*;\s*serial)')
maxser = None
data = {}
for fname in FILES:
content = open(fname).read()
data[fname] = content
match = SERPAT.search(content)
if not match:
print(f'Could not find pattern in file {fname}; abort.')
exit(1)
ser = int(match.group(1))
print(f'Ser for {fname}: {ser}')
if maxser is None:
maxser = ser
else:
maxser = max((maxser, ser))
print(f'Detected maximum serial: {maxser}')
if prop_serial is None:
prop_serial = maxser + 1
elif prop_serial <= maxser:
print(f'Warning: proposed serial {prop_serial} <= {maxser}')
while True:
resp = input(f'Proposing serial {prop_serial}; update [y/n]? ')
if resp.lower() == 'y':
print('Ok, editing...')
break
elif resp.lower() == 'n':
print('Abort.')
exit(1)
else:
print('Please enter "y" or "n".')
for fname in FILES:
bakname = fname + '.bak'
print(f'Writing backup of {fname} to {bakname}...')
open(bakname, 'w').write(data[fname])
for fname in FILES:
print(f'Writing {fname}...')
open(fname, 'w').write(SERPAT.sub(f'{prop_serial}\\2', data[fname]))
print('Done.')
Loading…
Cancel
Save