desec-stack
desec-stack copied to clipboard
Record Contents: Single Source of Truth
This lets nslord and api run off the same database to avoid duplication in data storage and to reduce pain from concurrent API requests.
nslord accesses data stored in the api database tables through views (some of them are updateable). Hence, nslord on our data is always up-to-date. This also saves a lot of change tracking and reduces the number of pdns API requests necessary.
Open Issues
- [x] ~~Check if record content format of the API is fully compatible with pdns~~ (covered by e2e2 tests)
- [x] Make sure nslord answers DNS requests for zones it knows
- [x] Simplify pdns change tracker code
- [x] Figure out upgrade path
- [ ] Remove access to private keys for the API container
- [ ] docker networking: currently, nslord, dbapi, api are all in the same network
- [ ] do not delete cryptokeys when domains are deleted?
- [x]
SOA-EDIT-APImeta data setting required? - [x] make sure the record's
ordernameisn't needed - [x] SOA MNAMES must not have trailing dot in pdns storage?
- [x] set
authfield in records table correctly - [x] TODOs mentioned in the code
- [x] are serial updates still happening? (I believe not.)
- [ ] make sure the domains
notified_serialisn't needed - [ ] make sure pdnsutil commands are working
- [ ] check pdns AXFRs for SERVFAIL (in case of invalid record content)
Improvements by this PR
- Can perform atomic updates to multiple domains with a single transaction.
- One fewer mariadb
- fewer pdns API calls for RR updates (now O(1))
- atomic transactions for individual RRs
- allows hosting of unsigned/presigned zones by adjusting the domains table
- allows customization of serial updates (beyond capabilities of pdns)
- Tests run with NS record set in place (that's more of a bugfix for the tests)
Problems introduced by this PR
- Weakens access control to private keys.
Deployment of this PR
Data from 7 tables need to be migrated. 2 tables need to be copied to dbapi, 5 tables are redundant and need checking if data is as expected and can be deleted.
- shutdown api access, shutdown nslord
- backup dblord, dbapi database
- Verify that the following tables at
dblordare empty:-
supermasters -
comments
-
- progress: 2/7 tables done
- Verify that the
domainmetadatatable contains two records for each domain that are precisely a1 0 0 -NSEC3OARAMandDEFAULTSOA-EDIT-API. - progress: 3/7 tables done
- Verify that all domains listed in dbapi also appear in dblord
- Verify that all domains listed in dblord also appear in dbapi
- Verify that all domains listed in dblord have
-
type=MASTER -
master= NULL -
account= NULL
-
- progress: 4/7 tables done
- add SOA records for all domains to dbapi (without change tracker)
- progress: 5/7 tables done and can be discarded
- opportunity to bail out and just restart nslord and open api access
- pull new images
- run api migrations
- copy cryptokeys and tsigkeys from dblord to dbapi
- progress: 7/7 tables done
- shutdown nsmaster
- restart api, nslord
- query nslord for desec.io, desec.org AXFR
- start nsmaster
- enable api access
- adjust backup (dblord volume is stale now)