2
0
mirror of https://github.com/namecoin/ncdns synced 2024-11-16 00:13:01 +00:00

DNSSEC tweaks

This commit is contained in:
Hugo Landau 2014-11-13 03:02:57 +00:00
parent 399da4400d
commit 53ab040fdc
2 changed files with 29 additions and 27 deletions

4
.travis.yml Normal file
View File

@ -0,0 +1,4 @@
language: go
go:
- 1.3
- tip

View File

@ -55,35 +55,33 @@ func NewServer(cfg *ServerConfig) (s *Server, err error) {
return return
} }
// key setup
ksk, kskPrivate, err := s.loadKey(cfg.PublicKey, cfg.PrivateKey)
log.Fatale(err, "error reading KSK key")
var zsk *dns.DNSKEY
var zskPrivate dns.PrivateKey
if cfg.ZonePublicKey != "" {
zsk, zskPrivate, err = s.loadKey(cfg.ZonePublicKey, cfg.ZonePrivateKey)
log.Fatale(err, "error reading ZSK key")
} else {
zsk = &dns.DNSKEY{}
zsk.Hdr.Rrtype = dns.TypeDNSKEY
zsk.Hdr.Class = dns.ClassINET
zsk.Hdr.Ttl = 3600
zsk.Algorithm = dns.RSASHA256
zsk.Protocol = 3
zsk.Flags = dns.ZONE
zskPrivate, err = zsk.Generate(2048)
log.Fatale(err)
}
ecfg := &madns.EngineConfig{ ecfg := &madns.EngineConfig{
Backend: b, Backend: b,
KSK: ksk, }
KSKPrivate: kskPrivate,
ZSK: zsk, // key setup
ZSKPrivate: zskPrivate, if cfg.PublicKey != "" {
ksk, kskPrivate, err := s.loadKey(cfg.PublicKey, cfg.PrivateKey)
if err != nil {
return nil, err
}
ecfg.KSK = ksk
ecfg.KSKPrivate = kskPrivate
}
if cfg.ZonePublicKey != "" {
zsk, zskPrivate, err := s.loadKey(cfg.ZonePublicKey, cfg.ZonePrivateKey)
if err != nil {
return nil, err
}
ecfg.ZSK = zsk
ecfg.ZSKPrivate = zskPrivate
}
if ecfg.KSK != nil && ecfg.ZSK == nil {
return nil, fmt.Errorf("Must specify ZSK if KSK is specified")
} }
e, err := madns.NewEngine(ecfg) e, err := madns.NewEngine(ecfg)