Skip to content

Commit a868bf7

Browse files
authored
Merge branch 'post-hackathon120' into main
2 parents bc02366 + 04a7184 commit a868bf7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3476
-1140
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; This is a key-signing key, keyid 25247, for child.test.net.
2+
; Created: 20240721011249 (Sat Jul 20 18:12:49 2024)
3+
; Publish: 20240721011249 (Sat Jul 20 18:12:49 2024)
4+
; Activate: 20240721011249 (Sat Jul 20 18:12:49 2024)
5+
child.test.net. IN DNSKEY 257 3 15 nW/9Pihb9/IhsFWNy3yc4katjyuAQ/2agIG+2WF1z20=
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Private-key-format: v1.3
2+
Algorithm: 15 (ED25519)
3+
PrivateKey: jx59Lo47HPwdQz4GOWHC2u79DJiU93zF0Ux1aVuXEs4=
4+
Created: 20240721011249
5+
Publish: 20240721011249
6+
Activate: 20240721011249

data/zones/child.test.net

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
child.test.net. 7200 IN SOA when.pigs.can.fly. hostmaster.johani.org. (
2+
2023122606 7200 1800 604800 7200 )
3+
7200 IN NS nsa.johani.org.
4+
7200 IN NS nsb.johani.org.
5+
7200 IN NS nsc.johani.org.
6+
7200 IN NS bar.child.test.net.
7+
120 IN MX 1 mxc.johani.org.
8+
foo.child.test.net. 300 IN A 1.2.3.4
9+
foo.child.test.net. 300 IN AAAA 53::53
10+
bar.child.test.net. 300 IN A 1.2.3.99
11+
12+
anka.child.test.net. 7200 IN A 1.2.3.4
13+
citron.child.test.net. 7200 IN A 1.2.3.40
14+
emil.*.child.test.net. 7200 IN A 1.2.3.50
15+
gunga.child.test.net. 7200 IN A 1.2.3.60
16+
gunga.child.test.net. 7200 IN SRV 10 20 30 srv.child.test.net.
17+
isblock.child.test.net. 7200 IN A 1.2.3.70
18+
kanel.child.test.net. 7200 IN A 1.2.3.80
19+
kanel.child.test.net. 7200 IN TXT "allan tar kakan i 4711 baud"
20+
kanel.child.test.net. 7200 IN TXT "vi aro alla oense"
File renamed without changes.

data/zones/uchild.parent.axfr.net

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
uchild.parent.axfr.net. 7200 IN SOA when.pigs.can.fly. hostmaster.johani.org. (
2+
2023122679
3+
7200
4+
1800
5+
604800
6+
7200 )
7+
uchild.parent.axfr.net. 7200 IN NS nsc.uchild.parent.axfr.net.
8+
uchild.parent.axfr.net. 7200 IN NS foo.uchild.parent.axfr.net.
9+
uchild.parent.axfr.net. 7200 IN NS bar.uchild.parent.axfr.net.
10+
uchild.parent.axfr.net. 7200 IN NS hhh.uchild.parent.axfr.net.
11+
uchild.parent.axfr.net. 7200 IN NS iii.uchild.parent.axfr.net.
12+
13+
aaa.uchild.parent.axfr.net. IN A 1.2.3.4
14+
bbb.uchild.parent.axfr.net. IN A 1.2.3.5
15+
ccc.uchild.parent.axfr.net. IN A 1.2.3.6
16+
ddd.uchild.parent.axfr.net. IN A 1.2.3.7
17+
eee.uchild.parent.axfr.net. IN A 1.2.3.8
18+
fff.uchild.parent.axfr.net. IN A 1.2.3.9
19+
ggg.uchild.parent.axfr.net. IN A 1.2.3.44
20+
hhh.uchild.parent.axfr.net. IN A 1.2.3.99
21+
iii.uchild.parent.axfr.net. IN A 1.2.3.12
22+
jjj.uchild.parent.axfr.net. IN A 1.2.3.13
23+
kkk.uchild.parent.axfr.net. IN A 1.2.3.14
24+
lll.uchild.parent.axfr.net. IN A 1.2.3.15
25+
26+
aaa.uchild.parent.axfr.net. IN AAAA 2001:b80::4
27+
bbb.uchild.parent.axfr.net. IN AAAA 2001:b80::5
28+
ccc.uchild.parent.axfr.net. IN AAAA 2001:b80::6
29+
ddd.uchild.parent.axfr.net. IN AAAA 2001:b80::7
30+
eee.uchild.parent.axfr.net. IN AAAA 2001:b80::8
31+
fff.uchild.parent.axfr.net. IN AAAA 2001:b80::9
32+
ggg.uchild.parent.axfr.net. IN AAAA 2001:b80::cccc
33+
hhh.uchild.parent.axfr.net. IN AAAA 2001:b80::aa
34+
iii.uchild.parent.axfr.net. IN AAAA 2001:b80::12
35+
jjj.uchild.parent.axfr.net. IN AAAA 2001:b80::13
36+
kkk.uchild.parent.axfr.net. IN AAAA 2001:b80::14
37+
lll.uchild.parent.axfr.net. IN AAAA 2001:b80::15
38+
39+
emil.*.uchild.parent.axfr.net. 7200 IN A 1.2.3.50
40+
anka.uchild.parent.axfr.net. 7200 IN A 1.2.3.4
41+
bar.uchild.parent.axfr.net. 300 IN A 41.76.135.53
42+
citron.uchild.parent.axfr.net. 7200 IN CNAME gunga.uchild.parent.axfr.net.
43+
foo.uchild.parent.axfr.net. 300 IN A 41.76.135.99
44+
foo.uchild.parent.axfr.net. 300 IN AAAA 3ffe:b80:ff:ff:ff::cafe
45+
frotz.uchild.parent.axfr.net. 300 IN TXT "frutz"
46+
gunga.uchild.parent.axfr.net. 7200 IN A 1.2.3.60
47+
gunga.uchild.parent.axfr.net. 7200 IN SRV 10 20 30 srv.uchild.parent.axfr.net.
48+
isblock.uchild.parent.axfr.net. 7200 IN A 1.2.3.70
49+
kanel.uchild.parent.axfr.net. 7200 IN A 1.2.3.80
50+
nsc.uchild.parent.axfr.net. 300 IN A 41.76.135.53

dog/cmd/dog.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var rootCmd = &cobra.Command{
9292

9393
switch rrtype {
9494
case dns.TypeAXFR, dns.TypeIXFR:
95-
tdns.ZoneTransferPrint(qname, server, serial, rrtype)
95+
tdns.ZoneTransferPrint(qname, server, serial, rrtype, options)
9696

9797
default:
9898

@@ -158,6 +158,10 @@ func ProcessOptions(options map[string]string, ucarg string) map[string]string {
158158
options["do_bit"] = "true"
159159
return options
160160
}
161+
if ucarg == "+MULTI" {
162+
options["multi"] = "true"
163+
return options
164+
}
161165

162166
if strings.HasPrefix(ucarg, "+OPCODE=") {
163167
parts := strings.Split(ucarg, "=")

tdns-cli/cmd/commands.go

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var zoneReloadCmd = &cobra.Command{
4545
os.Exit(1)
4646
}
4747

48-
resp, err := SendCommandNG(api, tdns.CommandPost{
48+
resp, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
4949
Command: "zone",
5050
SubCommand: "reload",
5151
Zone: dns.Fqdn(tdns.Globals.Zonename),
@@ -74,11 +74,11 @@ var zoneNsecCmd = &cobra.Command{
7474

7575
var zoneSignCmd = &cobra.Command{
7676
Use: "sign",
77-
Short: "Send an zone sign command to tdnsd",
77+
Short: "Send a zone sign command to tdnsd",
7878
Run: func(cmd *cobra.Command, args []string) {
7979
PrepArgs("childzone")
8080

81-
cr, err := SendCommandNG(api, tdns.CommandPost{
81+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
8282
Command: "zone",
8383
SubCommand: "sign-zone",
8484
Zone: tdns.Globals.Zonename,
@@ -99,13 +99,40 @@ var zoneSignCmd = &cobra.Command{
9999
},
100100
}
101101

102+
var zoneWriteCmd = &cobra.Command{
103+
Use: "write",
104+
Short: "Send a zone write command to tdnsd",
105+
Run: func(cmd *cobra.Command, args []string) {
106+
PrepArgs("childzone")
107+
108+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
109+
Command: "zone",
110+
SubCommand: "write-zone",
111+
Zone: tdns.Globals.Zonename,
112+
Force: force,
113+
})
114+
if err != nil {
115+
fmt.Printf("Error: %s\n", err.Error())
116+
os.Exit(1)
117+
}
118+
if cr.Error {
119+
fmt.Printf("Error from tdnsd: %s\n", cr.ErrorMsg)
120+
os.Exit(1)
121+
}
122+
123+
if cr.Msg != "" {
124+
fmt.Printf("%s\n", cr.Msg)
125+
}
126+
},
127+
}
128+
102129
var zoneNsecGenerateCmd = &cobra.Command{
103130
Use: "generate",
104131
Short: "Send an NSEC generate command to tdnsd",
105132
Run: func(cmd *cobra.Command, args []string) {
106133
PrepArgs("childzone")
107134

108-
cr, err := SendCommandNG(api, tdns.CommandPost{
135+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
109136
Command: "zone",
110137
SubCommand: "generate-nsec",
111138
Zone: tdns.Globals.Zonename,
@@ -132,7 +159,7 @@ var zoneNsecShowCmd = &cobra.Command{
132159
Run: func(cmd *cobra.Command, args []string) {
133160
PrepArgs("childzone")
134161

135-
cr, err := SendCommandNG(api, tdns.CommandPost{
162+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
136163
Command: "zone",
137164
SubCommand: "show-nsec-chain",
138165
Zone: tdns.Globals.Zonename,
@@ -163,7 +190,7 @@ var zoneFreezeCmd = &cobra.Command{
163190
Run: func(cmd *cobra.Command, args []string) {
164191
PrepArgs("childzone")
165192

166-
cr, err := SendCommandNG(api, tdns.CommandPost{
193+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
167194
Command: "zone",
168195
SubCommand: "freeze",
169196
Zone: tdns.Globals.Zonename,
@@ -190,7 +217,7 @@ var zoneThawCmd = &cobra.Command{
190217
Run: func(cmd *cobra.Command, args []string) {
191218
PrepArgs("childzone")
192219

193-
cr, err := SendCommandNG(api, tdns.CommandPost{
220+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
194221
Command: "zone",
195222
SubCommand: "thaw",
196223
Zone: tdns.Globals.Zonename,
@@ -223,7 +250,7 @@ var zoneListCmd = &cobra.Command{
223250
Short: "Send an zone list command to tdnsd",
224251
Run: func(cmd *cobra.Command, args []string) {
225252

226-
cr, err := SendCommandNG(api, tdns.CommandPost{
253+
cr, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
227254
Command: "list-zones",
228255
})
229256
if err != nil {
@@ -298,7 +325,7 @@ var zoneSerialBbumpNGCmd = &cobra.Command{
298325
Run: func(cmd *cobra.Command, args []string) {
299326
PrepArgs("childzone")
300327

301-
resp, err := SendCommandNG(api, tdns.CommandPost{
328+
resp, err := SendCommandNG(tdns.Globals.Api, tdns.CommandPost{
302329
Command: "bump",
303330
Zone: tdns.Globals.Zonename,
304331
})
@@ -340,7 +367,7 @@ var debugRRsetCmd = &cobra.Command{
340367
os.Exit(1)
341368
}
342369

343-
dr := SendDebug(api, tdns.DebugPost{
370+
dr := SendDebug(tdns.Globals.Api, tdns.DebugPost{
344371
Command: "rrset",
345372
Zone: dns.Fqdn(tdns.Globals.Zonename),
346373
Qname: dns.Fqdn(debugQname),
@@ -368,7 +395,7 @@ var debugLAVCmd = &cobra.Command{
368395
os.Exit(1)
369396
}
370397

371-
dr := SendDebug(api, tdns.DebugPost{
398+
dr := SendDebug(tdns.Globals.Api, tdns.DebugPost{
372399
Command: "lav",
373400
Qname: dns.Fqdn(debugQname),
374401
Qtype: qtype,
@@ -383,7 +410,7 @@ var debugShowTACmd = &cobra.Command{
383410
Short: "Request tdnsd to return known trust anchors",
384411
Run: func(cmd *cobra.Command, args []string) {
385412

386-
dr := SendDebug(api, tdns.DebugPost{
413+
dr := SendDebug(tdns.Globals.Api, tdns.DebugPost{
387414
Command: "show-ta",
388415
Verbose: true,
389416
})
@@ -417,17 +444,17 @@ func init() {
417444
rootCmd.AddCommand(stopCmd, debugCmd, zoneCmd)
418445

419446
zoneCmd.AddCommand(zoneListCmd, zoneNsecCmd, zoneSignCmd, zoneReloadCmd, zoneSerialBumpCmd, zoneSerialBbumpNGCmd)
420-
zoneCmd.AddCommand(zoneFreezeCmd, zoneThawCmd)
447+
zoneCmd.AddCommand(zoneWriteCmd, zoneFreezeCmd, zoneThawCmd)
421448

422449
debugCmd.AddCommand(debugRRsetCmd, debugLAVCmd, debugShowTACmd)
423450
zoneNsecCmd.AddCommand(zoneNsecGenerateCmd, zoneNsecShowCmd)
424451

425452
debugCmd.PersistentFlags().StringVarP(&debugQname, "qname", "", "", "qname of rrset to examine")
426453
debugCmd.PersistentFlags().StringVarP(&debugQtype, "qtype", "", "", "qtype of rrset to examine")
427-
zoneReloadCmd.Flags().BoolVarP(&force, "force", "F", false, "force reloading, ignoring SOA serial")
454+
zoneCmd.PersistentFlags().BoolVarP(&force, "force", "F", false, "force operation")
428455

429456
zoneListCmd.Flags().BoolVarP(&showhdr, "headers", "H", false, "Show column headers")
430-
zoneListCmd.Flags().BoolVarP(&showfile, "file", "F", false, "Show zone input file")
457+
zoneListCmd.Flags().BoolVarP(&showfile, "file", "f", false, "Show zone input file")
431458
zoneListCmd.Flags().BoolVarP(&shownotify, "notify", "N", false, "Show zone downstream notify addresses")
432459
zoneListCmd.Flags().BoolVarP(&showprimary, "primary", "P", false, "Show zone primary nameserver")
433460
// ddnsCmd.PersistentFlags().StringVarP(&Globals.Sig0Keyfile, "keyfile", "k", "", "name of file with private SIG(0) key")
@@ -445,7 +472,7 @@ func SendCommand(cmd, zone string) (string, error) {
445472
bytebuf := new(bytes.Buffer)
446473
json.NewEncoder(bytebuf).Encode(data)
447474

448-
status, buf, err := api.Post("/command", bytebuf.Bytes())
475+
status, buf, err := tdns.Globals.Api.Post("/command", bytebuf.Bytes())
449476
if err != nil {
450477

451478
return "", fmt.Errorf("error from api post: %v", err)
@@ -468,7 +495,7 @@ func SendCommand(cmd, zone string) (string, error) {
468495
return cr.Msg, nil
469496
}
470497

471-
func SendCommandNG(api *tdns.Api, data tdns.CommandPost) (tdns.CommandResponse, error) {
498+
func SendCommandNG(api *tdns.ApiClient, data tdns.CommandPost) (tdns.CommandResponse, error) {
472499
var cr tdns.CommandResponse
473500
bytebuf := new(bytes.Buffer)
474501
json.NewEncoder(bytebuf).Encode(data)
@@ -494,7 +521,7 @@ func SendCommandNG(api *tdns.Api, data tdns.CommandPost) (tdns.CommandResponse,
494521
return cr, nil
495522
}
496523

497-
func SendDebug(api *tdns.Api, data tdns.DebugPost) tdns.DebugResponse {
524+
func SendDebug(api *tdns.ApiClient, data tdns.DebugPost) tdns.DebugResponse {
498525

499526
bytebuf := new(bytes.Buffer)
500527
json.NewEncoder(bytebuf).Encode(data)

tdns-cli/cmd/ddns_cmds.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var delStatusCmd = &cobra.Command{
3333
Short: "Make an API call to request TDNSD to analyse whether delegation is in sync or not",
3434
Run: func(cmd *cobra.Command, args []string) {
3535
PrepArgs("zonename")
36-
dr, err := SendDelegationCmd(api, tdns.DelegationPost{
36+
dr, err := SendDelegationCmd(tdns.Globals.Api, tdns.DelegationPost{
3737
Command: "status",
3838
Zone: tdns.Globals.Zonename,
3939
})
@@ -86,7 +86,7 @@ var delSyncCmd = &cobra.Command{
8686
Short: "Make an API call to request TDNSD to send a DDNS update to sync parent delegation info with child data",
8787
Run: func(cmd *cobra.Command, args []string) {
8888
PrepArgs("zonename")
89-
dr, err := SendDelegationCmd(api, tdns.DelegationPost{
89+
dr, err := SendDelegationCmd(tdns.Globals.Api, tdns.DelegationPost{
9090
Command: "sync",
9191
Scheme: scheme,
9292
Zone: tdns.Globals.Zonename,
@@ -292,7 +292,7 @@ func PrepArgs(required ...string) {
292292
}
293293
}
294294

295-
func SendDelegationCmd(api *tdns.Api, data tdns.DelegationPost) (tdns.DelegationResponse, error) {
295+
func SendDelegationCmd(api *tdns.ApiClient, data tdns.DelegationPost) (tdns.DelegationResponse, error) {
296296
var dr tdns.DelegationResponse
297297

298298
bytebuf := new(bytes.Buffer)

0 commit comments

Comments
 (0)