-
Notifications
You must be signed in to change notification settings - Fork 6
/
namedconfglobal.py
7213 lines (6474 loc) · 253 KB
/
namedconfglobal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
#
"""
import re
import json
from pprint import PrettyPrinter
from typing import Dict, Any
# import line_profiler
"""
Bind9 named.conf global settings
Template is:
abc = {
'required': True, bare minimum keyword
required within its subblock context
(as pointed to by its presence
'default': "yes", # None, if statement is a
presence-trigger type; all int() type
are in str()type
'default': {1: {'addr': 'any', 'operator_not': False}, },
'occurs-multiple-times': True, # This keyword can
# happen more than once
# in a config file
'validity': { 'range': {0, 4095}, # None, if no validity needed
'regex': r"(yes|no|[0-9]{1-3})",
'function': custom_range_checking, # combination of validity supported
},
'found-in': {'options', 'view', 'zone', 'server', 'key'},
'user-defined-indices': True, # acl_name_base (useful to skip keyword validation)
'multi-line-order-id': 1 # determines print order within {}
'same-line-order-id': 1 # determines print order within same line
'introduced': '9.5', # introduced ON that version,
# string-format-only, dotted notation
'deprecated': '', # keyword remains useable but has diminishing logics
'obsoleted': '', # obsoleted ON that version,
# presense means immediately obsoleted
'topic': 'recursive-follow', # free-format
'zone-type': 'master'|'slave'| # TODO a work-in-progress
'authoritative-or-noncaching-only' |
'caching' |
'authoritative' |
'load-balancing',
'comment': """ """ # Comments are less than 55 columns
}
"""
# Stuff that goes into subdirectory's namedconfglobal.py
# are defined once at "import namedconf" time.
# We declare these variables as class instance
# variable: loaded once, shared by many class instances.
# g_nc_keywords is a dict() that contains all
# first-order keyword (typically after CR/LF and
# and after the '};' or ';' end-section marker).
# g_nc_keywords is designed for speed of keyword
# lookups, ease of using g_nc_keywords['options']
# access, and does not necessarily reflect ordering
# found in original named.conf configuration file.
#
# To reconstruct its original ordering of the
# output configuration file, we use absolute
# cursor position embedded in self.current['keyword']
# as a reordering guide for this.
global g_nc_keywords
# g_nc_keywords = dict()
g_nc_keywords['acl'] = \
{
'occurs-multiple-times': True,
'default': None,
'validity': {'function': "address_match_nosemicolon"},
'found-in': {''},
'multi-line-order-id': 1, # ACL 'should' always be first, but not always, but I say so
'user-defined-indices': True, # acl_name_base
'introduced': "8.1",
'topblock': True,
'topic': 'access control list, RPZ rewriting, content filtering',
'comment': 'Access Control List',
}
g_nc_keywords['controls'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {''},
'output-order-id': 3, # controls should be prominently firstly (after keys and ACLs)
'introduced': '8.2',
'topic': 'RNDC, remote control',
'comment':
"""An API to the named daemon, in form of a UNIX socket or TCP socket.'
Used by rndc CLI utility""",
}
g_nc_keywords['dnssec-keys'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'view'},
'output-order-id': 11, # controls should be prominently firstly (after keys and ACLs)
'default': '',
'validity': {'function': 'dnskey', },
'introduced': '9.15.2',
'obsoleted': '9.15.6', # arguably the shortest-lived 'clause'
'topic': 'DNSSEC, key',
'comment': '',
}
# dlz <string> { database <string>; search <boolean>; }; [ DLZ ]
# dlz <string>; [ View Zone ]
g_nc_keywords['dlz'] = \
{
'default': None,
'validity': {'function': 'netprefix'},
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'view', 'zone'}, # also at top-statement-level
'topic': 'dlz, redirect',
'zone-type': {'master', 'slave', 'redirect', 'primary', 'secondary'},
'introduced': "9.5.0",
'obsoleted': '9.17.19', # also at top-statement-level
'comment': """ Introduced 'search' statement in v9.10.0 """,
}
g_nc_keywords['dnssec-policy'] = \
{
# This is one of those split-syntax/same-name between top-level and options
'default': '',
'validity': {'function': 'dnssec_policy_name',
'regex': '(none|default)'},
'occurs-multiple-times': True,
'topblock': True,
'required': False, # depends on topblock 'dnssec-policy'
'found-in': {'', 'options'},
'introduced': '9.17.0',
'topic': 'DNSSEC, policy',
'comment': '',
}
# dyndb <string> <quoted_string> { <unspecified-text> };
g_nc_keywords['dyndb'] = \
{
'default': '',
'occurs-multiple-times': True,
'topblock': True,
'required': False,
'found-in': {'', 'view'}, # added to 'view' in v9.11.0
'introduced': '9.6.0',
'topic': 'dynamic database',
'comment': '',
}
g_nc_keywords['http'] = \
{
'default': None,
'topblock': True,
'required': False,
'occurs-multiple-times': True,
'validity': {'string'},
'found-in': {''},
'introduced': '9.18',
'topic': 'DNS-over-HTTP, DoH',
'comment': '',
}
g_nc_keywords['include'] = \
{
'default': None,
'validity': {'function': 'path_name'},
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'options', 'view', 'zone', 'server', 'masters', 'key'},
'introduced': '8.1',
'topic': 'multi-file configuration',
'comment': 'A placeholder for more configuration items',
}
g_nc_keywords['key'] = \
{
'default': None,
'validity': {'string': 'key_name'},
'occurs-multiple-times': True,
'topblock': True,
'found-in': {
'', 'view', 'primaries', 'masters',
'also-notify', # 'key' added to also-notify in v9.9
'catalog-zones', 'parental-agents'
},
# found in view since v9.0
'user-defined-indices': True, # keyname
'multi-line-order-id': 2, # Keys should always be on top, after ACL
'topic': 'key',
'introduced': "8.1",
'obsoleted': '', # it's gone from 'view' in 9.15.0
}
g_nc_keywords['keys'] = \
{
'validity': {'function': 'list_of_strings'},
'occurs-multiple-times': False,
'topblock': False,
'found-in': {'inet', 'unix', 'dnssec-policy', 'server'},
'multi-line-order-id': 2, # Keys should always be on top, after ACL
'topic': 'list of keys',
'introduced': '9.1',
'obsoleted': '',
}
g_nc_keywords['logging'] = \
{
'occurs-multiple-times': False,
'topblock': True,
'required': False,
'found-in': {''},
'subordering-matters': True,
'output-order-id': 20, # 'logging' is second last
'introduced': "8.1",
'topic': 'debug, log, logging, log file'
}
g_nc_keywords['lwres'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {''},
'dict-index-by-name': False,
'subordering-matters': False,
'introduced': "9.1",
'obsoleted': '9.12.0',
'topic': 'ancient'
}
g_nc_keywords['managed-keys'] = \
{
'occurs-multiple-times': True, # CFG_CLAUSEFLAG_MULTI
'topblock': False,
'found-in': {'', 'view'}, # also at top-statement-level
'introduced': '9.5.0',
'deprecated': "9.15.1", # replaced by 'dnssec-keys' w/ 'initial-key'
'topic': 'DNSSEC, key',
'comment': '',
}
# This is top-level 'masters' only which is
# not to be confused with 'zone' 'masters' option.
g_nc_keywords['masters'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'zone'}, # Only found in zone-slave/zone-mirror/zone-redirect/zone-stub
'user-defined-indices': True,
'output-order-id': 8, # masters should be after 'view'/'zone'
'zone-type': {'secondary', 'mirror', 'redirect', 'stub', 'slave'},
'topic': 'nameserver, master, server, transfer',
'introduced': "4.8",
}
g_nc_keywords['options'] = \
{
'occurs-multiple-times': False,
'topblock': True,
'required': True, # the only keyword w/ 'required' (nope, logging too)
'found-in': {''},
'output-order-id': 4, # options should be after keys, ACLs, and controls)
'topic': 'general options',
'introduced': "4.9.3" # 1994 Vixie Enterprise
}
g_nc_keywords['parental-agents'] = \
{
'occurs-multiple-times': False,
'topblock': True,
'required': False,
'found-in': {''},
'introduced': "9.19",
'topic': '',
'comment': '',
}
g_nc_keywords['plugin'] = \
{
'default': None,
'validity': {'function': 'plugin'},
'found-in': {'', 'view'},
'topblock': True,
'occurs-multiple-times': True,
'introduced': '9.14.0',
'topic': 'plugin',
'comment': '',
}
g_nc_keywords['primaries'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'zone'}, # Only found in zone-slave/zone-stub
'user-defined-indices': True,
'output-order-id': 8, # masters should be after 'view'/'zone'
'topic': 'nameserver, server, list of masters, list of servers, transfer',
'zone-type': {'mirror', 'secondary', 'stub', 'redirect'},
'introduced': "9.16",
}
g_nc_keywords['server'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'view'}, # also at top-statement-level
'dict-index-by-name': True, # indexed by ip46_addr_or_prefix
'output-order-id': 9, # 'server' should be AFTER 'masters'
'topic': 'view, server',
'introduced': "8.1",
}
g_nc_keywords['statistics-channels'] = \
{
'occurs-multiple-times': False,
'topblock': True,
'found-in': {''},
'output-order-id': 9999,
'introduced': '9.5.0',
'topic': 'statistics, channel',
'comment': '',
}
g_nc_keywords['tls'] = \
{
'topblock': True,
'validity': {'string'},
'dict-index-by-name': True,
'found-in': {'', 'primaries', 'masters', 'listen-on', 'listen-on-v6',
'parental-agents', 'also-notify', 'catalog-zones'},
'occurs-multiple-times': True,
'introduced': '9.18.0',
'topic': 'TLS, DNS-over-HTTP, DoH',
'comment': '',
}
g_nc_keywords['trust-anchors'] = \
{
'topblock': True,
'found-in': {'', 'options', 'view'},
'dict-index-by-name': False, # but 'trusted-keys string' is indexed
'occurs-multiple-times': True,
'output-order-id': 10,
'introduced': "9.16",
}
g_nc_keywords['trusted-keys'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'view', 'server'}, # Found in 'server' in 9.0
'dict-index-by-name': False, # but 'trusted-keys string' is indexed
'occurs-multiple-times': True,
'output-order-id': 10,
'introduced': "8.2", # 1999-09-15
'deprecated': "9.15.1", # replaced by 'dnssec-keys' w/ 'static-key'
'obsoleted': "9.20", # TODO verify
}
g_nc_keywords['view'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {''},
'subordering-matters': True, # ordering of view is very important
'user-defined-indices': True, # view_name
'output-order-id': 6, # 'view'/'zone' should be before 'trusted-keys'
'introduced': "9.0.0", # A big feature introduction here
'default': None,
'validity': {'function': 'view_name'},
'topic': 'view'
}
g_nc_keywords['zone'] = \
{
'occurs-multiple-times': True,
'topblock': True,
'found-in': {'', 'view'},
'subordering-matters': True, # ordering of zone is very important
'user-defined-indices': True, # zone_name
'output-order-id': 6, # 'zone'/'view' should be before 'trusted-keys'
'introduced': "8.1",
}
# End of Top-Level Statement (formerly clause)
# Begin of keywords, builtins and identifiers
g_nc_keywords['acache-cleaning-interval'] = \
{
'default': "no",
'validity': {'regex': r'(yes)|(no)'},
'found-in': {'options', 'view'},
'introduced': '9.4.0',
'obsoleted': '9.12',
'topic': 'ancient, additional section cache, caching',
'comment':
"""If yes, additional section caching is enabled.
The default value is no.""",
}
g_nc_keywords['acache-enable'] = \
{
'default': "no",
'validity': {'regex': r"(yes|no)"},
'found-in': {'options', 'view'},
'introduced': '9.4.0',
'obsoleted': '9.12',
'topic': 'ancient, caching, additional section cache',
'comment':
"""If yes, additional section caching is enabled.
The default value is no.""",
}
g_nc_keywords['additional-from-auth'] = \
{
'default': "yes",
'validity': {'regex': r"(yes|no)"},
'found-in': {'options', 'view'},
'introduced': '9.1',
'obsoleted': '9.12',
'topic': 'ancient, authoritative, non-caching, recursive-follow, caching',
'comment':
"""These options control the behavior of an authoritative
server when answering queries which have additional
when following CNAME and DNAME chains.
When both of these options are set to yes (the default)
and a query is being answered from authoritative data
(a zone configured into the server), the additional
data section of the reply will be filled in using data
from other authoritative zones and from the cache. In
some situations this is undesirable, such as when there
is concern over the correctness of the cache, or in
servers where slave zones may be added and modified by
untrusted third parties. Also, avoiding the search
for this additional data will speed up server
operations at the possible expense of additional
queries to resolve what would otherwise be provided
in the additional section.
For example, if a query asks for an MX record for host
foo.example.com, and the record found is
"MX 10 mail.example.net", normally the address records
(A and AAAA) for mail.example.net will be provided as
well, if known, even though they are not in the
example.com zone. Setting these options to no disables
this behavior and makes the server only search for
additional data in the zone it answers from.
These options are intended for use in
authoritative-only servers, or in authoritative-only
views. Attempts to set them to no without also
specifying recursion no will cause the server to
ignore the options and log a warning message.
Specifying additional-from-cache no actually disables
the use of the cache not only for additional data
lookups but also when looking up the answer. This is
usually the desired behavior in an authoritative-only
server where the correctness of the cached data is an
issue.
When a name server is non-recursively queried for a
name that is not below the apex of any served zone,
it normally answers with an "upwards referral" to the
root servers or the servers of some other known parent
of the query name. Since the data in an upwards
referral comes from the cache, the server will not be
able to provide upwards referrals when
additional-from-cache no has been specified. Instead,
it will respond to such queries with REFUSED. This
should not cause any problems since upwards referrals
are not required for the resolution process.
The default in both cases is yes.
These statements may be used in a global options or in
a view clause.
The behaviour is defined by the table below:
auth cache BIND Behaviour
yes yes BIND will follow out of zone records e.g. it will
follow the MX record specifying mail.example.net
for zone example.com for which it is authoritative
(master or slave). Default behaviour.
no no Cache disabled. BIND will NOT follow out-of-zone
records even if it is in the cache e.g. it will NOT
follow the MX record specifying mail.example.net for
zone example.com for which it is authoritative
(master or slave). It will return REFUSED for the
out-of-zone record.
yes no Cache disabled. BIND will follow out-of-zone records
but since this requires the cache (which is disabled)
the net result is the same - BIND will return REFUSED
for the out-of-zone record.
no yes BIND will NOT follow out-of-zone records but if it is
the cache it will be returned. If not in the cache
BIND will return REFUSED for the out-of-zone record.
Prior to BIND 9.5 auth-from-cache also controlled whether
a recursive query (even when recursion no; was specified)
would return a referral to the root servers (since these
would, most likely, be available in the cache). Since
BIND 9.5+ such queries are now failed with REFUSED status.""",
}
g_nc_keywords['additional-from-cache'] = \
{
'default': "yes",
'validity': {'regex': r"(yes|no)"},
'found-in': {'options', 'view'},
'introduced': '9.1',
'obsoleted': '9.12',
'topic': 'ancient, authoritative, non-caching, recursive-follow',
'comment':
"""additional-from-auth and additional-from-cache control
the behaviour when zones have additional (out-of-zone)
data or when following CNAME or DNAME records. These
options are for used for configuring authoritative-only
(non-caching) servers and are only effective if
recursion no is specified in a global options clause
or in a view clause.
The default in both cases is yes.
These statements may be used in a global options or
in a view clause.
The behaviour is defined by the table below:
auth cache BIND Behaviour
yes yes BIND will follow out of zone records e.g. it will
follow the MX record specifying mail.example.net
for zone example.com for which it is authoritative
(master or slave). Default behaviour.
no no Cache disabled. BIND will NOT follow out-of-zone
records even if it is in the cache e.g. it will NOT
follow the MX record specifying mail.example.net for
zone example.com for which it is authoritative
(master or slave). It will return REFUSED for the
out-of-zone record.
yes no Cache disabled. BIND will follow out-of-zone records
but since this requires the cache (which is disabled)
the net result is the same BIND will return REFUSED
for the out-of-zone record.
no yes BIND will NOT follow out-of-zone records but if it is
the cache it will be returned. If not in the cache
BIND will return REFUSED for the out-of-zone record.
Prior to BIND 9.5 auth-from-cache also controlled whether
a recursive query (even when recursion no; was specified)
would return a referral to the root servers (since these
would, most likely, be available in the cache). Since
BIND 9.5+ such queries are now failed with REFUSED status."""
}
g_nc_keywords['algorithm'] = \
{
'default': '', # insist
'validity': {'string': 'hmac_algorithm'},
'occurs-multiple-times': False,
'topblock': False,
'found-in': {'key'}, # also at top-statement-level
'topic': 'algorithm',
'user-defined-indices': False,
'multi-line-order-id': 1, # it's before 'secret' within 'key'
'introduced': "9.18.0", #
'comment':
"""Valid algorithms are:
hmac-md5
hmac-md5.sig-alg.reg.int
hmac-md5.sig-alg.reg.int.
hmac-sha1
hmac-sha224
hmac-sha256
hmac-sha384
hmac-sha512
""",
}
g_nc_keywords['all-per-seconds'] = \
{
'default': None,
'validity': {'range': {0, 1000}},
'found-in': {'options', 'view', 'rate-limit'},
'default': "no",
'introduced': '9.8.0',
'topic': 'rate-limit, defense',
'comment': '',
}
g_nc_keywords['allow-new-zones'] = \
{
'default': 'no',
'validity': {'regex': r"(yes|no)"},
'found-in': {'options', 'view'},
'introduced': '9.8.0',
'topic': 'rndc, zone, ddns',
'comment':
"""If yes, then zones can be added at runtime via 'rndc addzone',
'rndc modzone' or deleted via 'rndc delzone'. The default is no.""",
}
g_nc_keywords['allow-notify'] = \
{
'default': {0: {'masters': 'none', 'operator_not': False}, }, # was 'any' in v9.11
'validity': {'function': "address_match_nosemicolon"},
'found-in': {'options', 'view', 'zone'},
'introduced': '9.1',
'topic': 'access control, recursive-follow',
'zone-type': {'slave', 'mirror', 'secondary'},
'comment':
"""Specifies which hosts are allowed to notify this
server, a slave, of zone changes in addition to the
zone masters. allow-notify may also be specified in
the zone statement, in which case it overrides the
options allow-notify statement. It is only meaningful
for a slave zone.
If not specified, the default is to process notify
messages only from a zones master.
""",
}
g_nc_keywords['allow-query'] = \
{
'default': {0: {'addr': 'any', 'operator_not': False}, },
'validity': {'function': "address_match_list"},
'found-in': {'options', 'view', 'zone'},
'introduced': '8.1',
# In 8.2, only found in ['zone']['type']['master']
# In 8.2, only found in ['zone']['type']['slave']
# In 8.2, only found in ['zone']['type']['stub']
'topic': 'active, access control, redirect',
'zone-type': {'primary', 'secondary', 'mirror',
'stub', 'static-stub', 'redirect', 'master', 'slave'},
'comment':
"""Specifies which hosts are allowed to ask ordinary
DNS questions. allow-query may also be specified in the
zone statement, in which case it overrides the options
allow-query statement.
If not specified, the default is to allow queries from
all hosts.
NOTE: allow-query-cache is now used to specify access
to the cache.""",
}
g_nc_keywords['allow-query-cache'] = \
{
'default': {0: {'addr': 'localnets', 'operator_not': False},
1: {'addr': 'localhost', 'operator_not': False}, },
'validity': {'function': "address_match_nosemicolon"},
'found-in': {'options', 'view'},
'introduced': '9.4.0',
'topic': 'caching, cache access control',
'comment':
"""Specifies which hosts are allowed to get answers from the cache.
If allow-query-cache is not set then allow-recursion is used if set,
otherwise allow-query is used if set unless recursion no; is set
in which case none; is used,
otherwise the default (localnets; localhost;) is used.""",
}
g_nc_keywords['allow-query-cache-on'] = \
{
'default': {0: {'addr': 'any', 'operator_not': False}},
'validity': {'function': "address_match_nosemicolon"},
'found-in': {'options', 'view'},
'introduced': '9.5.0',
'topic': 'caching, cache access control, active',
'comment': '',
}
g_nc_keywords['allow-query-on'] = \
{
'default': {0: {'addr': 'any', 'operator_not': False}},
'validity': {'function': 'address_match_list'},
'found-in': {'options', 'view', 'zone'},
'introduced': '9.5.0',
'topic': 'access control, redirect, caching',
'zone-type': {'primary', 'secondary', 'mirror', 'stub',
'static-stub', 'redirect', 'master', 'slave'},
'comment':
"""Specifies which local addresses can accept ordinary
DNS questions. This makes it possible, for instance, to
allow queries on internal-facing interfaces but disallow
them on external-facing ones, without necessarily knowing
the internal networks addresses.
Note that allow-query-on is only checked for queries that
are permitted by allow-query.
A query must be allowed by both ACLs, or it will be refused.
allow-query-on may also be specified in the zone
statement, in which case it overrides the options
allow-query-on statement.
If not specified, the default is to allow queries on
all addresses.
NOTE: allow-query-cache is used to specify access
to the cache.""",
}
g_nc_keywords['allow-recursion'] = \
{
'default': {0: {'addr': 'localnets', 'operator_not': False},
1: {'addr': 'localhost', 'operator_not': False}, },
# 'default' was 'any;' in v9.11
'validity': {'function': "address_match_nosemicolon"},
'found-in': {'options', 'view'},
'introduced': '9.0.0',
'topic': 'caching, recursion, access control',
'comment':
"""Specifies which local addresses can give answers from
the cache. If not specified, the default is to allow
cache queries on any address, localnets and localhost.""",
}
g_nc_keywords['allow-recursion-on'] = \
{
'default': {0: {'addr': 'any'}},
'validity': {'function': "address_match_nosemicolon"},
'found-in': {'options', 'view'},
'introduced': '9.5.0',
'topic': 'recursion, local addresses',
'comment':
"""Specifies which local addresses can accept
recursive queries. If not specified, the default is to
allow recursive queries on all addresses."""
}
g_nc_keywords['allow-transfer'] = \
{
'default': {0: {'addr': 'any'}},
'validity': {
'port': 'optional', # added in v9.18
'transport': 'optional', # added in v9.18
'function': 'address_match_list'},
'found-in': {'options', 'view', 'zone'},
'introduced': '8.1',
# In 8.2, only found in ['zone']['type']['master']
# In 8.2, only found in ['zone']['type']['slave']
# In 8.2, only found in ['zone']['type']['stub']
'topic': 'server-zone-transfer-permission, access control',
'zone-type': {'authoritative', 'master', 'slave',
'mirror', 'stub', 'primary', 'secondary'},
'comment':
"""Specifies which hosts are allowed to receive zone
transfers from the server. allow-transfer may also be
specified in the zone statement, in which case it
overrides the options allow-transfer statement.
If not specified, the default is to allow transfers to
all hosts.""",
}
g_nc_keywords['allow-update'] = \
{
'default': {0: {'addr': 'none'}},
'validity': {'function': 'address_match_list'},
'found-in': {'options', 'view', 'zone'},
'introduced': '8.2',
# In 8.2, only found in ['zone']['type']['master']
# In 8.2, not found in ['zone']['type']['slave']
# In 8.2, not found in ['zone']['type']['stub']
# In 8.2, not found in ['zone']['type']['forward']
# In 8.2, not found in ['zone']['type']['hint']
'topic': 'update, dynamic-dns, dynamic zone, access control',
'zone-type': {'authoritative', 'master', 'mirror', 'primary'},
'comment':
"""Specifies which hosts are allowed to submit Dynamic
DNS updates for master zones. The default is to deny
updates from all hosts. Note that allowing updates
based on the requestor's IP address is insecure;"""
}
g_nc_keywords['allow-update-forwarding'] = \
{
'default': {0: {'addr': 'none'}},
'validity': {'function': 'address_match_list'},
'found-in': {'options', 'view', 'zone'},
'introduced': '9.0.0',
'topic': 'update, dynamic-dns, access control',
'zone-type': {'secondary', 'mirror', 'slave'},
'comment': """Specifies which hosts are allowed to submit Dynamic
DNS updates for master zones.
The default is to deny updates from all hosts.
Useful when secondary nameserver receives a DHCP
updates and needs to inform the server having this
master zone file.
Note that allowing updates based on the requestor's IP
address is insecure;"""
}
g_nc_keywords['allow-v6-synthesis'] = \
{
'default': "",
'validity': {'regex': "(AAAA|A6)"},
'found-in': {'options', 'view', 'server'},
'introduced': '9.2',
'obsoleted': '9.8',
'topic': 'ancient, inert, ignored, obsoleted, IPv6',
'comment':
"""This option was introduced for the smooth transition
from AAAA to A6 and from "nibble labels" to binary labels.
However, since both A6 and binary labels were then
deprecated, this option was also deprecated. It is now
ignored with some warning messages.""",
}
g_nc_keywords['also-notify'] = \
{
'default': {},
'validity': {'function': "ip_addr_list"},
'found-in': {'options', 'view', 'zone'},
# In 8.2, only found in ['zone']['type']['master']
# In 8.2, only found in ['zone']['type']['slave']
# In 8.2, only found in ['zone']['type']['stub']
# In 9.15, no longer found under 'server'
'introduced': '8.2',
'topic': 'notify, transfer, TSIG, DSCP',
'zone-type': {
'primary', 'secondary',
'mirror', 'master', 'slave'}, # removed 'stub' circa 9.10?
'comment':
"""Defines a global list of IP addresses of name
servers that are also sent NOTIFY messages whenever a
fresh copy of the zone is loaded, in addition to the
servers listed in the zone's NS records. This helps to
ensure that copies of the zones will quickly converge on
stealth servers. Optionally, a port may be specified with
each also-notify address to send the notify messages to a
port other than the default of 53. An optional TSIG key
can also be specified with each address to cause the
notify messages to be signed; this can be useful when
sending notifies to multiple views. In place of explicit
addresses, one or more named masters lists can be used.
If an also-notify list is given in a zone statement, it
will override the options also-notify statement. When a
zone notify statement is set to no, the IP addresses in
the global alsonotify list will not be sent NOTIFY
messages for that zone. The default is the empty list
(no global notification list).
'key' directive within 'allow-notify' introduced in v9.9.0.
Master name permitted in v9.9.0. """,
}
g_nc_keywords['alt-transfer-source'] = \
{
'default': '',
'validity': {'function': 'ip_address_port'},
'found-in': {'options', 'view'}, # removed 'zones' in v9.10
'introduced': '9.3.0',
'obsoleted': '9.10',
'topic': 'slave, transfer, DSCP',
'zone-type': {'primary', 'secondary', 'mirror', 'master', 'slave'},
'comment':
"""Applies to secondary zones only. Defines an alternative
local IP address to be used for inbound zone transfers
by the server if that defined by transfer-source
(transfer-source-v6) fails and use-alt-transfer-source
is enabled.
This address must appear in the remote end's
allow-transfer statement for the zone being transferred.
Syntax: ( ipv4_address | * ) [ port ( integer | * )];
This statement may be used in a zone, view or global
options clause.""",
}
g_nc_keywords['alt-transfer-source-v6'] = \
{
'default': '',
'validity': {'function': 'ip_address_port'},
'found-in': {'options', 'view'}, # removed 'zones' in v9.10
'introduced': '9.3.0',
'obsoleted': '9.10',
'topic': 'secondary, transfer, slave',
'zone-type': {
'primary', 'secondary', 'mirror',
'master', 'slave'}, # 'stub' removed in v9.10
'comment':
"""Applies to slave zones only. Defines an alternative
local IP address to be used for inbound zone transfers
by the server if that defined by transfer-source
(transfer-source-v6) fails and use-alt-transfer-source
is enabled.
This address must appear in the remote end's
allow-transfer statement for the zone being transferred.
This statement may be used in a zone, view or global
options clause.""",
}
g_nc_keywords['answer-cookie'] = \
{
'default': 'yes',
'validity': {'regex': r"(yes|no)"},
'found-in': {'options'},
'introduced': '9.14.0',
'topic': 'edns',
'comment':
"""answer-cookie is indented as a temporary
measure, for use when named shares an IP address with
other servers that do not yet support DNS COOKIE. A
mismatch between servers on the same address is not expected
to cause operational problems, but the option to disable
COOKIE response so that all servers have the same behavior
is provided out of an abundance of caution. DNS COOKIE is
an important security mechanism, and should not be disabled
unless absolutely necessary.
When set to its default value of 'yes', COOKIE.DNS options
will be sent when applicable in replies to client queries.
If set to 'no', COOKIE.EDNS options will not be sent in
replies. This can only be set at global options level,
not per-view.""",
}
g_nc_keywords['attach-cache'] = \
{
'default': "",
'validity': {'function': "view_name"},
'found-in': {'options', 'view'},
'introduced': '9.7.0',
'topic': 'view, cache, caching',
'comment':
"""Allows multiple views to share a single cache database.
Each view has its own cache database by default, but
if multiple views have the same operational policy for
name resolution and caching, those views can share a
single cache to save memory and possibly improve
resolution efficiency by using this option. The
attach-cache option may also be specified in view
statements, in which case it overrides the global
attach-cache option.
The cache_name specifies the cache to be shared. When
the named server configures views which are supposed
to share a cache, it creates a cache with the specified
name for the first view of these sharing views. The
rest of the views will simply refer to the already
created cache.
One common configuration to share a cache would be to
allow all views to share a single cache. This can be
done by specifying the attach-cache as a global option
with an arbitrary name.
Another possible operation is to allow a subset of all
views to share a cache while the others to retain
their own caches. For example, if there are three
views A, B, and C, and only A and B should share a
cache, specify the attach-cache option as a view A
(or B)'s option, referring to the other view name:
view "A" {
// this view has its own cache
...
};
view "B" {
// this view refers to A's cache
attach-cache "A";
};
view "C" {
// this view has its own cache
...
};
Views that share a cache must have the same policy on
configurable parameters that may affect caching. The
current implementation requires the following
configurable options be consistent among these views:
check-names, cleaning-interval, dnssec-accept-expired,
dnssec-validation, max-cache-ttl, max-ncache-ttl,
max-cache-size, and zero-no-soa-ttl.
Note that there may be other parameters that may cause
confusion if they are inconsistent for different views
that share a single cache. For example, if these views
define different sets of forwarders that can return
different answers for the same question, sharing the
answer does not make sense or could even be harmful.
It is administrator's responsibility to ensure
configuration differences in different views do not
cause disruption with a shared cache.""",