Compare commits

...

757 Commits

Author SHA1 Message Date
Matthijs Mekking
513d7cef74 Merge branch '1876-kasp-test-wait-for-reconfig' into 'main'
Resolve "kasp: algnum migration test does not wait long enough."

Closes #1876

See merge request isc-projects/bind9!3588

(cherry picked from commit 5cc856095b)

cf76d839 kasp tests: Replace while loops with retry_quiet
a47192ed kasp tests: fix wait for reconfig done
2020-06-29 06:02:21 +00:00
Evan Hunt
0a6c7ab2a9 Merge branch '1938-fix-udp-race' into 'v9_16'
Resolve "Repeated bind 9.16.3 assert error in libuv (attempting restart after an earlier/different crash)"

See merge request isc-projects/bind9!3722
2020-06-26 09:05:37 +00:00
Witold Kręcicki
2be35bd2bc CHANGES 2020-06-26 01:44:10 -07:00
Witold Kręcicki
4582ef3bb2 Fix a shutdown race in netmgr udp.
We need to mark the socket as inactive early (and synchronously)
in the stoplistening process - otherwise we might destroy the
callback argument before actually stopping listening, and call
the callback on a bad memory.
2020-06-26 01:44:03 -07:00
Evan Hunt
4ea84740e6 Merge branch '1947-fix-tcpdns-race' into 'v9_16'
Resolve "Segmentation fault in recursive stress test"

See merge request isc-projects/bind9!3721
2020-06-26 08:40:27 +00:00
Witold Kręcicki
bb629b9b16 CHANGES 2020-06-26 01:18:31 -07:00
Witold Kręcicki
97e44fa3df Make netmgr tcpdns send calls asynchronous.
isc__nm_tcpdns_send() was not asynchronous and accessed socket
internal fields in an unsafe manner, which could lead to a race
condition and subsequent crash. Fix it by moving the whole tcpdns
processing to a proper netmgr thread.
2020-06-26 01:18:27 -07:00
Evan Hunt
d761cd576b Merge branch '1952-yaml-ipv6-v9_16' into 'v9_16'
append "0" to IPv6 addresses ending in "::" when printing YAML

See merge request isc-projects/bind9!3752
2020-06-26 02:31:09 +00:00
Evan Hunt
f171017570 append "0" to IPv6 addresses ending in "::" when printing YAML
such addresses broke some YAML parsers.

(cherry picked from commit a8baf79e33)
2020-06-25 18:57:06 -07:00
Mark Andrews
4e33f6b338 Merge branch '1689-bind-stops-dnskey-lookup-in-get_dst_key-when-a-key-with-unsupported-algorithm-is-found-first-v9_16' into 'v9_16'
Resolve "BIND stops DNSKEY lookup in get_dst_key() when a key with unsupported algorithm is found first"

See merge request isc-projects/bind9!3748
2020-06-25 14:11:08 +00:00
Matthijs Mekking
6d91799388 Add todo in dnssec system test for [GL #1689]
Add a note why we don't have a test case for the issue.

It is tricky to write a good test case for this if our tools are
not allowed to create signatures for unsupported algorithms.

(cherry picked from commit c6345fffe9)
2020-06-25 22:44:19 +10:00
Mark Andrews
3e3afeb31e Add Release Note for [GL #1689]
(cherry picked from commit e195d4608a)
2020-06-25 22:44:17 +10:00
Mark Andrews
fd05589e66 Add CHANGES for [GL #1689]
(cherry picked from commit b733bd6555)
2020-06-25 22:43:25 +10:00
Mark Andrews
3612f662da The validator could fail when select_signing_key/get_dst_key failed
to select the signing key because the algorithm was not supported
and the loop was prematurely aborted.

(cherry picked from commit d475f3aeed)
2020-06-25 22:42:43 +10:00
Mark Andrews
022d923161 Merge branch '1969-silence-cppcheck-warnings' into 'v9_16'
Resolve "Silence CPPCHECK warnings"

See merge request isc-projects/bind9!3746
2020-06-25 12:38:54 +00:00
Mark Andrews
3f48a1e06e Add INSIST's to silence cppcheck warnings
(cherry picked from commit 0cf25d7f38)
2020-06-25 21:13:17 +10:00
Mark Andrews
b43641a55d Address potential thread issues:
Assign and then check node for NULL to address another thread
changing radix->head in the meantime.

Move 'node != NULL' check into while loop test to silence cppcheck
false positive.

Fix pointer != NULL style.

(cherry picked from commit 51f08d2095)
2020-06-25 21:11:27 +10:00
Mark Andrews
085afcaba8 Merge branch '1965-bin-named-unix-os-c-warning-s-directive-output-may-be-truncated-on-openindiana-v9_16' into 'v9_16'
Resize unamebuf[] to avoid warnings about snprintf() not having

See merge request isc-projects/bind9!3744
2020-06-24 23:37:15 +00:00
Mark Andrews
4885f0813e Resize unamebuf[] to avoid warnings about snprintf() not having
enough buffer space.  Also change named_os_uname() prototype so
that it is now returning (const char *) rather than (char *).  If
uname() is not supported on a UNIX build prepopulate unamebuf[]
with "unknown architecture".

(cherry picked from commit 4bc3de070f)
2020-06-25 09:26:22 +10:00
Ondřej Surý
646f73797b Merge branch '1949-checknames-v9_16' into 'v9_16'
Resolve "check-names doesn't use 'primary' and 'secondary'"

See merge request isc-projects/bind9!3732
2020-06-22 12:42:35 +00:00
Ondřej Surý
bf208a3894 Add CHANGES and release note for #1949
(cherry picked from commit eaafae2766)
2020-06-22 14:30:14 +02:00
Evan Hunt
dca3658720 "check-names primary" and "check-names secondary" were ignored
these keywords were added to the parser as synonyms for "master"
and "slave" but were never hooked in to the configuration of named,
so they were ignored. this has been fixed and the option is now
checked for correctness.

(cherry picked from commit ba31b189b4)
2020-06-22 14:30:14 +02:00
Ondřej Surý
98f5a27f6d Merge branch '1627-address-race-in-zone-maintenance-v9_16' into 'v9_16'
Address race between zone_maintenance and dns_zone_setview_helper

See merge request isc-projects/bind9!3729
2020-06-22 12:00:20 +00:00
Mark Andrews
34a5ad82d6 Address race between zone_maintenance and dns_zone_setview_helper
There was a possible NULL dereference due to data race between accessing
zone->view and zone->view->adb.

(cherry picked from commit 67c8f7329d)
2020-06-22 12:27:11 +02:00
Mark Andrews
b6e308b9ee Merge branch '1955-lmdb_cflags-missing-from-dns_includes-in-make-includes-in' into 'v9_16'
Resolve "${LMDB_CFLAGS} missing from DNS_INCLUDES in make/includes.in"

See merge request isc-projects/bind9!3719
2020-06-19 08:07:46 +00:00
Mark Andrews
036cd40b8c Add CHANGES note for [GL #1955] 2020-06-19 12:23:00 +10:00
Mark Andrews
39c3565408 Add ${LMDB_CFLAGS} to DNS_INCLUDES in make/includes.in
so that <lmdb.h> will be found when <dns/lmdb.h> is included.
2020-06-19 12:13:27 +10:00
Mark Andrews
41e38c216d Add missing #pragma once to <dns/lmdb.h> 2020-06-19 12:12:45 +10:00
Michał Kępień
8aed0ff51a Merge branch 'v9_16_4-release' into 'v9_16'
[CVE-2020-8618] [CVE-2020-8619] Merge 9.16.4 release branch

See merge request isc-projects/bind9!3712
2020-06-18 08:47:51 +00:00
Michał Kępień
4712aa7330 Set up release notes for BIND 9.16.5 2020-06-18 10:33:50 +02:00
Michał Kępień
43b610a79d Bump BIND_BASELINE_VERSION for ABI checks 2020-06-18 10:33:50 +02:00
Tinderbox User
9eb5040216 Merge branch 'prep-release' into security-v9_16 2020-06-18 10:25:51 +02:00
Tinderbox User
adab85b815 prep 9.16.4 2020-06-18 10:25:50 +02:00
Michał Kępień
64ee041fa7 Merge branch 'security-v9_16-docs' into 'security-v9_16'
Prepare documentation for BIND 9.16.4

See merge request isc-private/bind9!173
2020-06-18 10:25:37 +02:00
Michał Kępień
3859bbe57a Tweak and reword release notes 2020-06-18 10:25:37 +02:00
Michał Kępień
338ba6e1a1 Add release note for #1859 2020-06-18 10:25:37 +02:00
Michał Kępień
0f28a6f0c4 Add release note for #1842 2020-06-18 10:25:37 +02:00
Michał Kępień
6e28c57d5c Add release note for #1834 2020-06-18 10:25:37 +02:00
Michał Kępień
0d2315a5f2 Add release note for #1812 2020-06-18 10:25:37 +02:00
Michał Kępień
ca941a6542 Add release note for #1714 2020-06-18 10:25:37 +02:00
Michał Kępień
63a4cbfddf Add release note for #83 2020-06-18 10:25:37 +02:00
Michał Kępień
2e3a70fe8d Reorder release notes 2020-06-18 10:25:36 +02:00
Michał Kępień
40b3591eea Prepare release notes for BIND 9.16.4 2020-06-18 10:25:05 +02:00
Michał Kępień
e4c2281e11 Merge branch 'security-wildcard-test-marka-v9_16' into security-v9_16 2020-06-18 10:18:42 +02:00
Michał Kępień
ef42ca2864 Tweak and reword recent CHANGES entries 2020-06-18 10:18:42 +02:00
Michał Kępień
0454d26078 Merge branch 'security-new_reference-insist-v9_16' into security-v9_16 2020-06-18 10:18:42 +02:00
Mark Andrews
f8d7bd22f7 Add CHANGES note
(cherry picked from commit 5acccc6e8dbcfd7efa31686946d677d7895a7fff)
2020-06-18 10:18:42 +02:00
Michał Kępień
c9e2a23d9e Merge branch '1850-cleanup-client_allocsendbuf-v9_16' into security-v9_16 2020-06-18 10:18:42 +02:00
Mark Andrews
b40b453c93 Add CHANGES entry for #1718
(cherry picked from commit d7c26a97c82c256e00b167c65a70fb304a7320d4)
2020-06-18 10:18:42 +02:00
Mark Andrews
e522e80dc4 Add checking RFC 4592 responses examples to wildcard system test
(cherry picked from commit 30586aa054c9cd8a4e64c91ed78683a4b54c79bc)
2020-06-18 10:18:42 +02:00
Mark Andrews
e742313374 Add release notes for #1850
(cherry picked from commit 8d2dffa53a987c31af053824bc210a7fe3d66849)
2020-06-18 10:18:42 +02:00
Mark Andrews
54e5fb53e3 Add release note for #1718
(cherry picked from commit 2f9d6d4f7eb624986db914a2825bbcc4e6d378b1)
2020-06-18 10:18:42 +02:00
Mark Andrews
88cd1e264c Add CHANGES entry for #1850
(cherry picked from commit 9b56a3c85578e56e10b174391e579d8e32ff6e34)
2020-06-18 10:18:42 +02:00
Mark Andrews
6964a21fa6 Remove INSIST from from new_reference
RBTDB node can now appear on the deadnodes lists following the changes
to decrement_reference in 176b23b6cd to
defer checking of node->down when the tree write lock is not held.  The
node should be unlinked instead.

(cherry picked from commit 569cc155b8680d8ed12db1fabbe20947db24a0f9)
2020-06-18 10:18:42 +02:00
Mark Andrews
ee6f60349b Adjust NS_CLIENT_TCP_BUFFER_SIZE and cleanup client_allocsendbuf
NS_CLIENT_TCP_BUFFER_SIZE was 2 byte too large following the
move to netmgr add associated changes to lib/ns/client.c and
as a result an INSIST could be trigger if the DNS message being
constructed had a checkpoint stage that fell in those two extra
bytes.  Adjusted NS_CLIENT_TCP_BUFFER_SIZE and cleaned up
client_allocsendbuf now that the previously reserved 2 bytes
are no longer used.

(cherry picked from commit 5a92af19b7dce684b0e6670ae6ec1c4c58613263)
2020-06-18 10:18:41 +02:00
Ondřej Surý
8b61b30a57 Merge branch '1950-properly-handle-missing-kyua' into 'v9_16'
Skip the unit tests when kyua is not available

See merge request isc-projects/bind9!3704
2020-06-17 13:28:14 +00:00
Ondřej Surý
4ab9e79e6f Add CHANGES and release note for #1950 2020-06-17 15:04:43 +02:00
Ondřej Surý
762a3c866e Skip the unit tests when kyua is not available
The unittest.sh script tried to execute the unit tests when cmocka
development libraries was available, but kyua, the execution engine,
was not.  Now, both need to be installed in the system.
2020-06-17 15:04:43 +02:00
Ondřej Surý
eca3c5f615 Merge branch 'ondrej/switch-the-default-branch-name-to-main-v9_16' into 'v9_16'
Adjust the GitLab CI scripts for new default branch name

See merge request isc-projects/bind9!3707
2020-06-17 12:19:22 +00:00
Ondřej Surý
e12ab8c48b Adjust the GitLab CI scripts for new default branch name
(cherry picked from commit b36cd06a0b)
2020-06-17 14:17:21 +02:00
Ondřej Surý
f0a3d4d688 Merge branch '1943-remove-references-to-blacklist-and-whitelist-in-bind-arm-v9_16' into 'v9_16'
Remove references to "blacklist" and "whitelist"

See merge request isc-projects/bind9!3701
2020-06-16 20:00:32 +00:00
Suzanne Goldlust
4cc90976f6 Update logging-categories.rst and reference.rst
Remove references to "blacklist" and "whitelist"

(cherry picked from commit 4a04fb68cd)
2020-06-16 21:58:49 +02:00
Ondřej Surý
06f125c9d4 Merge branch '1931-fix-out-of-order-rfcs-in-general-rst-file-of-bind-arm-v9_16' into 'v9_16'
Fix two RFCs that were out of numerical order

See merge request isc-projects/bind9!3700
2020-06-16 19:34:17 +00:00
Suzanne Goldlust
194ea4b256 Fix two RFCs that were out of numerical order
(cherry picked from commit acb4742182)
2020-06-16 21:33:11 +02:00
Ondřej Surý
8b7c9df2b0 Merge branch '1945-system-clang-tsan-has-bad-symbolizer-v9_16' into 'v9_16'
Set the TSAN symbolizer path directly, the indirection via env doesn't work

See merge request isc-projects/bind9!3698
2020-06-16 08:54:45 +00:00
Ondřej Surý
362007bf1f Set the TSAN symbolizer path directly, the indirection via env doesn't work
(cherry picked from commit 39107365a7)
2020-06-16 10:51:58 +02:00
Ondřej Surý
cebc77a560 Merge branch '1474-threadsanitizer-data-race-lib-dns-message-c-v9_16' into 'v9_16'
Add missing acquire memory barrier in isc_nmhandle_unref

See merge request isc-projects/bind9!3695
2020-06-16 08:51:17 +00:00
Ondřej Surý
8b4fe6c6c5 Add missing acquire memory barrier in isc_nmhandle_unref
The ThreadSanitizer uses system synchronization primitives to check for
data race.  The netmgr handle->references was missing acquire memory
barrier before resetting and reusing the memory occupied by isc_nmhandle_t.

(cherry picked from commit 1013c0930e)
2020-06-16 08:58:33 +02:00
Mark Andrews
b6e4432081 Merge branch 'marka-dsset-refs-v9_16' into 'v9_16'
Marka dsset refs v9 16

See merge request isc-projects/bind9!3688
2020-06-11 07:52:21 +00:00
Mark Andrews
02541e95e3 Add release note for [GL #1926]
(cherry picked from commit f97889a51a)
2020-06-11 16:09:44 +10:00
Mark Andrews
e7969ca571 Add CHANGES note [GL #1926]
(cherry picked from commit 9d89244ba2)
2020-06-11 16:09:44 +10:00
Mark Andrews
06cebcb6b7 val->keynode is no longer needed
(cherry picked from commit ff4fc3f8dc)
2020-06-11 16:09:43 +10:00
Mark Andrews
70c27df941 The dsset returned by dns_keynode_dsset needs to be thread safe.
- clone keynode->dsset rather than return a pointer so that thread
  use is independent of each other.
- hold a reference to the dsset (keynode) so it can't be deleted
  while in use.
- create a new keynode when removing DS records so that dangling
  pointers to the deleted records will not occur.
- use a rwlock when accessing the rdatalist to prevent instabilities
  when DS records are added.

(cherry picked from commit e5b2eca1d3)
2020-06-11 16:09:43 +10:00
Evan Hunt
5b4d4cb3f3 Merge branch '1930-tcp-race-quota-v9_16' into 'v9_16'
Fix a race in TCP accepting.

See merge request isc-projects/bind9!3684
2020-06-10 18:49:55 +00:00
Witold Kręcicki
aa2282853a Fix a race in TCP accepting.
There's a possibility of a race in TCP accepting code:
T1 accepts a connection C1
T2 accepts a connection C2
T1 tries to accept a connection C3, but we hit a quota,
   isc_quota_cb_init() sets quota_accept_cb for the socket,
   we return from accept_connection
T2 drops C2, but we race in quota_release with accepting C3 so
   we don't see quota->waiting is > 0, we don't launch the callback
T1 accepts a connection C4, we are able to get the quota we clear
   the quota_accept_cb from sock->quotacb
T1 drops C1, tries to call the callback which is zeroed, sigsegv.
2020-06-10 11:39:43 -07:00
Witold Kręcicki
7ff1ff88f9 Don't clean quota cb cb_func/data, we don't own it 2020-06-10 17:52:53 +02:00
Michał Kępień
56005ed658 Merge branch '1921-gitlab-ci-release-process-fixes-v9_16' into 'v9_16'
[v9_16] GitLab CI release process fixes

See merge request isc-projects/bind9!3681
2020-06-09 13:02:15 +00:00
Michał Kępień
f1ddba0703 Fix GitLab CI job building release tarballs
Adjust the script for the GitLab CI job building release tarballs to
account for the changes in the documentation building process introduced
by the migration to Sphinx.
2020-06-09 14:57:00 +02:00
Witold Krecicki
1abfc5ad97 Merge branch 'wpk/fix-isc-assertions-c-error-v9_16' into 'v9_16'
Fix 'error: ‘%s’ directive argument is null [-Werror=format-overflow=]' in assertions.c

See merge request isc-projects/bind9!3677
2020-06-08 17:18:01 +00:00
Witold Kręcicki
31897276d9 Fix 'error: ‘%s’ directive argument is null [-Werror=format-overflow=]' in assertions.c
(cherry picked from commit f4260dc0c5)
2020-06-08 15:57:31 +00:00
Witold Krecicki
5467970c9e Merge branch '1859-deadlock-in-socket-c-v9_16' into 'v9_16'
Resolve "Possible deadlock in unix/socket.c"

See merge request isc-projects/bind9!3678
2020-06-08 15:56:43 +00:00
Witold Kręcicki
bbf1422614 Fix possible deadlock in unix/socket.c
In process_fd we lock sock->lock and then internal_accept locks mgr->lock,
in isc_sockmgr_render* functions we lock mgr->lock and then lock sock->lock,
that can cause a deadlock when accessing stats. Unlock sock->lock early in
all the internal_{send,recv,connect,accept} functions instead of late
in process_fd.
2020-06-08 15:30:10 +02:00
Ondřej Surý
24573abeef Merge branch '1808-race-in-resolver-fetch-v9_16' into 'v9_16'
Resolve "assertion failure in bind 9.16.2"

See merge request isc-projects/bind9!3671
2020-06-06 07:30:07 +00:00
Ondřej Surý
710c2dc654 Add release note for #1808
(cherry picked from commit 5a9f594629)
2020-06-05 18:58:13 -07:00
Witold Kręcicki
3175009575 Add CHANGES entry for #1808
(cherry picked from commit f0f859411f)
2020-06-05 18:58:13 -07:00
Witold Kręcicki
c3dcab5f13 Fix a data access race in resolver
We were passing client address to dns_resolver_createfetch as a pointer
and it was saved as a pointer. The client (with its address) could be
gone before the fetch is finished, and in a very odd scenario
log_formerr would call isc_sockaddr_format() which first checks if the
address family is valid (and at this point it still is), then the
sockaddr is cleared, and then isc_netaddr_fromsockaddr is called which
fails an assertion as the address family is now invalid.

(cherry picked from commit 175c4d9055)
2020-06-05 18:58:13 -07:00
Ondřej Surý
30625774f7 Merge branch '1842-correct-the-bind-arm-to-say-that-the-default-session-key-for-use-with-update-policy-local-is-v9_16' into 'v9_16'
Edit reference.rst to indicate that the TSIG

See merge request isc-projects/bind9!3673
2020-06-05 14:38:50 +00:00
Suzanne Goldlust
365263f559 Edit reference.rst to indicate that the TSIG
session key is automatically created on startup

(cherry picked from commit 79920cea70)
2020-06-05 16:37:43 +02:00
Mark Andrews
7ef5145cc9 Merge branch '1835-add-yaml-for-ede-v9_16' into 'v9_16'
Resolve "Add the ability to parse and display Extended DNS Error code (EDE)."

See merge request isc-projects/bind9!3666
2020-06-05 03:18:36 +00:00
Mark Andrews
0c23582ffd Improve the behaviour of yamlget.py when run with python2
(cherry picked from commit 9e72266705)
2020-06-05 10:51:01 +10:00
Mark Andrews
28a940fe69 Add +yaml support for EDE
(cherry picked from commit 0ec77c2b92)
2020-06-05 10:50:58 +10:00
Michal Nowak
7c8cfe38be Merge branch '1902-bind-build-problems-on-netbsd-9-v9_16' into 'v9_16'
[v9_16] Fix "array subscript is of type 'char'"

See merge request isc-projects/bind9!3660
2020-06-04 14:28:11 +00:00
Michal Nowak
e39685b579 Fix "array subscript is of type 'char'" 2020-06-04 16:27:43 +02:00
Ondřej Surý
80882a8e14 Merge branch '1798-reject-master-zones-with-ds-records-at-the-apex-v9_16' into 'v9_16'
Resolve "Reject master zones with DS records at the apex."

See merge request isc-projects/bind9!3662
2020-06-04 14:25:39 +00:00
Mark Andrews
653a6543c0 Add release note for #1798
(cherry picked from commit 8b05e6f710)
2020-06-04 16:06:48 +02:00
Mark Andrews
2ef63ad627 Add CHANGES entry for #1798
(cherry picked from commit 06e714df0d)
2020-06-04 16:06:48 +02:00
Mark Andrews
6ac4e62fbc Ignore attempts to add DS records at zone apex
DS records belong in the parent zone at a zone cut and
are not retrievable with modern recursive servers.

(cherry picked from commit ae55fbbe9c)
2020-06-04 16:06:45 +02:00
Mark Andrews
b17f6eba6a Reject primary zones with an DS record at the zone apex.
DS records only belong at delegation points and if present
at the zone apex are invariably the result of administrative
errors.  Additionally they can't be queried for with modern
resolvers as the parent servers will be queried.

(cherry picked from commit 35a58d30c9)
2020-06-04 16:06:07 +02:00
Ondřej Surý
b2f7bd98b6 Merge branch '1782-ipv6-docs-v9_16' into 'v9_16'
Resolve "9.16.x: listen-on-v6 { any; }; no longer works as documented on FreeBSD"

See merge request isc-projects/bind9!3661
2020-06-04 14:04:59 +00:00
Witold Kręcicki
a0faf3dfc5 Add release notes for #1782
(cherry picked from commit d3ea1caf5a)
2020-06-04 16:02:59 +02:00
Witold Kręcicki
587556f0af Documentation update wrt IPv6 listening.
With netmgr we're creating separate socket for each IPv6 interface,
just as with IPv4 - update documentation accordingly.

(cherry picked from commit 6a2100034b)
2020-06-04 16:02:19 +02:00
Michał Kępień
ec9d1b6363 Merge branch '1841-test-multiple-softhsm-versions-in-gitlab-ci-v9_16' into 'v9_16'
[v9_16] Test multiple SoftHSM versions in GitLab CI

See merge request isc-projects/bind9!3657
2020-06-04 12:39:48 +00:00
Michał Kępień
b3899c29c4 Embed SoftHSM version in CI job names
To indicate the SoftHSM version used in each CI job while avoiding the
need to add another token to job names, replace "pkcs11" with
"softhsm2.4" and "fedora31:amd64" with "softhsm2.6".

(cherry picked from commit c7169c4ab0)
2020-06-04 12:38:54 +00:00
Michał Kępień
99c69ec144 Make Fedora CI jobs PKCS#11-enabled
Various SoftHSM versions differ in algorithm support.  Since Fedora
tends to have the latest SoftHSM version available in its stock package
repositories, enable PKCS#11 support in Fedora jobs to test multiple
SoftHSM versions in GitLab CI.

(cherry picked from commit 3ecb202ba3)
2020-06-04 12:38:54 +00:00
Michał Kępień
d089a0a0f7 Fix & unify Debian job comments in .gitlab-ci.yml
(cherry picked from commit 8aa864d042)
2020-06-04 12:38:54 +00:00
Ondřej Surý
449c8dd88b Merge branch '1877-reduce-default-for-max-stale-ttl-release-notes-update-v9_16' into 'v9_16'
Update release note for #1877

See merge request isc-projects/bind9!3659
2020-06-04 12:25:37 +00:00
Ondřej Surý
e66ddab0f9 Update release note for #1877
(cherry picked from commit bee9ed84f4)
2020-06-04 14:16:47 +02:00
Ondřej Surý
319aec7439 Merge branch 'nsupdate-late-responses-v9_16' into 'v9_16'
Delay kserver cleanup until all tasks finish (v9.16)

See merge request isc-projects/bind9!3651
2020-06-04 11:16:15 +00:00
Ondřej Surý
5c5c92e2fa Add CHANGES entry for !3316
(cherry picked from commit 72e78f0a4b)
2020-06-04 11:32:54 +02:00
Petr Mensik
596a0f27c4 Delay kserver cleanup until all tasks finishes
It might be possible some pending task would run when kserver is already
cleaned up. Postpone gsstsig structures cleanup after task and timer
managers are destroyed. No pending threads are possible after it.

Make action in maybeshutdown only if doshutdown was not already called.
Might be called from getinput event.

(cherry picked from commit 2685e69be8)
2020-06-04 11:32:33 +02:00
Ondřej Surý
7e4eb8ad36 Merge branch '83-cleanup-how-we-build-release-notes-v9_16' into 'v9_16'
Stop building release notes as a separate sphinx-doc document

See merge request isc-projects/bind9!3650
2020-06-04 09:26:10 +00:00
Ondřej Surý
ef50067fd2 Stop building release notes as a separate sphinx-doc document
The release notes were previously built as a separate document
(including the PDF version).  It was agreed that this doesn't make much
sense, so the release notes are now included only as an appendix to the
BIND 9 ARM.

(cherry picked from commit 8eb2323ec3)
2020-06-04 11:24:53 +02:00
Ondřej Surý
3149d687c3 Merge branch '1914-remove-libdns-documentation-v9_16' into 'v9_16'
Remove libdns section in ARM

See merge request isc-projects/bind9!3648
2020-06-04 09:00:58 +00:00
Ondřej Surý
ad0ab84835 Remove libdns section in ARM
When we made BIND 9 libraries private to BIND 9, we forgot to remove the
libdns section on "export" libraries from the ARM.

(cherry picked from commit 3637c466c9)
2020-06-04 11:00:16 +02:00
Ondřej Surý
137ffd8ec6 Merge branch '1910-text-edits-in-general-rst-v9_16' into 'v9_16'
Content, clarity, grammar updates to general.rst

See merge request isc-projects/bind9!3647
2020-06-04 08:57:33 +00:00
Suzanne Goldlust
e940446777 Content, clarity, grammar updates to general.rst
This includes reorganization of the lists of RFCs supported by BIND 9.

I included all the RFCs and notes from the list identified by Vicky in
any DNS-related RFCs written by current ISC engineers, on the assumption
that BIND would comply with them.

(cherry picked from commit 8ca7f22671)
2020-06-04 10:57:01 +02:00
Ondřej Surý
87ee1a225e Merge branch '1899-fix-tcp-accept-windows-v9_16' into 'v9_16'
isc_uv_import must pass UV__IPC_SOCKET_XFER_TCP_CONNECTION, not SERVER.

See merge request isc-projects/bind9!3645
2020-06-03 22:19:22 +00:00
Witold Kręcicki
091117b7ae isc_uv_import must pass UV__IPC_SOCKET_XFER_TCP_CONNECTION, not SERVER.
As a leftover from old TCP accept code isc_uv_import passed TCP_SERVER
flag when importing a socket on Windows.
Since now we're importing/exporting accepted connections it needs to
pass TCP_CONNECTION flag.

(cherry picked from commit 801f7af6e9)
2020-06-03 23:27:24 +02:00
Ondřej Surý
4b9e317561 Merge branch 'wpk/tcp-accept-refactoring-v9_16' into 'v9_16'
TCP accept refactoring (v9_16)

See merge request isc-projects/bind9!3602
2020-06-03 21:26:39 +00:00
Witold Kręcicki
279470e6cb CHANGES note
(cherry picked from commit 813ff015a4)
2020-06-03 23:00:53 +02:00
Witold Kręcicki
c4f91575ca Clean quota callback after calling it
(cherry picked from commit 2f252a1068)
2020-06-03 23:00:52 +02:00
Witold Kręcicki
818afe613f Redesigned TCP accepting: one listen/accept loop, passing the connected socket.
Instead of using bind() and passing the listening socket to the children
threads using uv_export/uv_import use one thread that does the accepting,
and then passes the connected socket using uv_export/uv_import to a random
worker. The previous solution had thundering herd problems (all workers
waking up on one connection and trying to accept()), this one avoids this
and is simpler.
The tcp clients quota is simplified with isc_quota_attach_cb - a callback
is issued when the quota is available.

(cherry picked from commit 60629e5b0b)
2020-06-03 23:00:52 +02:00
Michał Kępień
881c7c4921 Merge branch 'michal/misc-danger-tweaks-v9_16' into 'v9_16'
[v9_16] Miscellaneous Danger tweaks

See merge request isc-projects/bind9!3640
2020-06-03 14:01:02 +00:00
Michał Kępień
a63c88953a Only run Danger if DANGER_GITLAB_API_TOKEN is set
Prevent the Danger GitLab CI job from failing when the GitLab API key to
use is not set.

(cherry picked from commit 2c90438583)
2020-06-03 15:51:15 +02:00
Michał Kępień
09e8f41fd3 Prevent invalid warnings about missing identifiers
The Danger script inspects differences between the current version of a
given merge request's target branch and the merge request branch.  If
the latter falls behind the former, the Danger script will wrongly warn
about missing GitLab/RT identifiers because it incorrectly treats the
"+++" diff marker as an indication of the merge request adding new lines
to a file.  Tweak the relevant conditional expression to prevent such
invalid warnings from being raised.

(cherry picked from commit e062812c38)
2020-06-03 15:51:15 +02:00
Michał Kępień
102e9afc17 Make fetching target branch reliable
As GitLab Runner Docker executor caches Git repositories between jobs,
prevent the Danger script from attempting to update local refs to ensure
"git fetch" returns with an exit code of 0.  Use the FETCH_HEAD ref for
determining the differences between the merge request branch and its
target branch.

(cherry picked from commit d558c4cb78)
2020-06-03 15:51:13 +02:00
Michał Kępień
e4d99f2162 Tweak condition for missing log message warning
Commits adding CHANGES entries and/or release notes do not need a commit
log message.  Do not warn about a missing commit log message for such
commits to make the warning more meaningful.

(cherry picked from commit c13944ca46)
2020-06-03 15:51:13 +02:00
Ondřej Surý
0afd0858ae Merge branch 'wpk/fix-socket-test-teardown-v9_16' into 'v9_16'
tests: fix isc/socket_test.c teardown

See merge request isc-projects/bind9!3636
2020-06-03 13:36:15 +00:00
Witold Kręcicki
ca26bcca38 tests: fix isc/socket_test.c teardown
In case of a test failure we weren't tearing down sockets and tasks
properly, causing the test to hang instead of failing nicely.

(cherry picked from commit 4a8d9250cf)
2020-06-03 14:12:18 +02:00
Ondřej Surý
4a5f917392 Merge branch '1911-remove-runtime_check-res-0-for-so_incoming_cpu-v9_16' into 'v9_16'
Resolve "RUNTIME_CHECK(res == 0) in SO_REUSE and SO_INCOMING_CPU, commit 09ba47b0676"

See merge request isc-projects/bind9!3635
2020-06-03 10:48:22 +00:00
Ondřej Surý
8c207e34a7 Add CHANGES for #1911
(cherry picked from commit 80a2ef8987)
2020-06-03 12:47:21 +02:00
Ondřej Surý
1217916c1e Don't check the result of setting SO_INCOMING_CPU
The SO_INCOMING_CPU is available since Linux 3.19 for getting the value,
but only since Linux 4.4 for setting the value (see below for a full
description).  BIND 9 should not fail when setting the option on the
socket fails, as this is only an optimization and not hard requirement
to run BIND 9.

    SO_INCOMING_CPU (gettable since Linux 3.19, settable since Linux 4.4)
        Sets or gets the CPU affinity of a socket.  Expects an integer flag.

            int cpu = 1;
            setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, sizeof(cpu));

        Because all of the packets for a single stream (i.e., all
	packets for the same 4-tuple) arrive on the single RX queue that
	is associated with a particular CPU, the typical use case is to
	employ one listening process per RX queue, with the incoming
	flow being handled by a listener on the same CPU that is
	handling the RX queue.  This provides optimal NUMA behavior and
	keeps CPU caches hot.

(cherry picked from commit 4ec357da0a)
2020-06-03 12:47:21 +02:00
Ondřej Surý
b79922151d Merge branch '1877-reduce-default-for-max-stale-ttl-to-something-more-reasonable-12-hours-or-similar-v9_16' into 'v9_16'
Resolve "Reduce default for max-stale-ttl to something more reasonable - 12 hours or similar" (v9.16)

See merge request isc-projects/bind9!3628
2020-06-03 10:45:43 +00:00
Ondřej Surý
ae8944a017 Add CHANGES for #1877
(cherry picked from commit e81728289c)
2020-06-03 10:45:09 +00:00
Ondřej Surý
5e0c510d79 Add release notes for #1877
(cherry picked from commit fc4f3b92ab)
2020-06-03 10:45:09 +00:00
Ondřej Surý
d85b936898 Reduce the default value for max-stale-ttl from 1 week to 12 hours
Originally, the default value for max-stale-ttl was 1 week, which could
and in some scenarios lead to cache exhaustion on a busy resolvers.
Picking the default value will always be juggling between value that's
useful (e.g. keeping the already cached records after they have already
expired and the upstream name servers are down) and not bloating the
cache too much (e.g. keeping everything for a very long time).  The new
default reflects what we think is a reasonable to time to react on both
sides (upstream authoritative and downstream recursive).

(cherry picked from commit 13fd3ecfab)
2020-06-03 10:45:09 +00:00
Ondřej Surý
0010728a77 Merge branch '1909-text-edits-in-history-rst-v9_16' into 'v9_16'
Content, clarity, and grammar edits to history.rst

See merge request isc-projects/bind9!3633
2020-06-03 10:29:33 +00:00
Suzanne Goldlust
e56f0e6d98 Content, clarity, and grammar edits to history.rst
(cherry picked from commit f6164e080f)
2020-06-03 12:28:35 +02:00
Ondřej Surý
8027549a4c Merge branch '1908-text-edits-in-troubleshooting-rst-v9_16' into 'v9_16'
Content, clarity, and grammar edits to troubleshooting.rst

See merge request isc-projects/bind9!3632
2020-06-03 10:27:42 +00:00
Suzanne Goldlust
ca5dae4d44 Content, clarity, and grammar edits to troubleshooting.rst
(cherry picked from commit c6a064a6e9)
2020-06-03 12:26:23 +02:00
Ondřej Surý
8872133cef Merge branch '1906-more-bind-arm-text-edits-v9_16' into 'v9_16'
Content, grammar, and clarity updates to security.rst

See merge request isc-projects/bind9!3631
2020-06-03 10:26:03 +00:00
Suzanne Goldlust
0b4e53bffc Content, grammar, and clarity updates to security.rst
(cherry picked from commit 7c2136766b)
2020-06-03 12:20:52 +02:00
Matthijs Mekking
9d25d0aad6 Merge branch '1845-1846-keyrollover-bugs-v9_16' into 'v9_16'
Resolve "kasp: bug in keymgr_key_has_successor()"

See merge request isc-projects/bind9!3622
2020-06-02 15:32:05 +00:00
Matthijs Mekking
a17dcccf7d Retire predecessor when creating successor
When creating the successor, the current active key (predecessor)
should change its goal state to HIDDEN.

Also add two useful debug logs in the keymgr_key_rollover function.

(cherry picked from commit e71d60299f)
2020-06-02 14:54:41 +02:00
Matthijs Mekking
ef1a4a416a If prepub > retire, prepub now
Catch a case where if the prepublication time of the successor key
is later than the retire time of the predecessor. If that is the
case we should prepublish as soon as possible, a.k.a. now.

(cherry picked from commit c08d0f7dd6)
2020-06-02 14:54:32 +02:00
Matthijs Mekking
b0737b8c61 Put new key rollover logic in separate function
The `dns_keymgr_run()` function became quite long, put the logic
that looks if a new key needs to be created (start a key rollover)
in a separate function.

(cherry picked from commit bcf8192438)
2020-06-02 14:54:20 +02:00
Matthijs Mekking
168d362b54 Fix bug in keymgr_key_has_successor
The logic in `keymgr_key_has_successor(key, keyring)` is flawed, it
returns true if there is any key in the keyring that has a successor,
while what we really want here is to make sure that the given key
has a successor in the given keyring.

Rather than relying on `keymgr_key_exists_with_state`, walk the
list of keys in the keyring and check if the key is a successor of
the given predecessor key.

(cherry picked from commit 0d578097ef)
2020-06-02 14:54:08 +02:00
Matthijs Mekking
f20420c3de Merge branch '1843-print-correct-keytiming-metadata-v9_16' into 'v9_16'
Resolve "kasp: Set correct keytimings"

See merge request isc-projects/bind9!3620
2020-06-02 11:46:03 +00:00
Matthijs Mekking
e85c1aa74e Replace date -d with python script
The usage of 'date -d' in the kasp system test is not portable,
replace with a python script.  Also remove some leftover
"set_keytime 'yes'" calls.

(cherry picked from commit 5b3decaf48)
2020-06-02 11:36:25 +02:00
Matthijs Mekking
ba5d122fd6 Add change entry
(cherry picked from commit bcf3c9fecf)
2020-06-02 11:36:17 +02:00
Matthijs Mekking
da2daea0e6 Test keytimes on algorithm rollover
This improves keytime testing on algorithm rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.

(cherry picked from commit 61c1040ae5)
2020-06-02 11:36:08 +02:00
Matthijs Mekking
327d8bb273 Test keytimes on policy changes
This improves keytime testing on reconfiguration of the
dnssec-policy.

(cherry picked from commit da5e1e3a0f)
2020-06-02 11:36:01 +02:00
Matthijs Mekking
f026332f88 Test keytimes on CSK rollover
This improves keytime testing on CSK rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.

Since an "active key" for ZSK and KSK means something
different, this makes it tricky to decide when a CSK is
active. An "active key" intuitively means the key is signing
so we say a CSK is active when it is creating zone signatures.

This change means a lot of timings for the CSK rollover tests
need to be adjusted.

The keymgr code needs a slight change on calculating the
prepublication time: For a KSK we need to include the parent
registration delay, but for CSK we look at the zone signing
property and stick with the ZSK prepublication calculation.

(cherry picked from commit e233433772)
2020-06-02 11:35:52 +02:00
Matthijs Mekking
8e0776d0d5 Test keytimes on KSK rollover
This improves keytime testing on KSK rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.

(cherry picked from commit 649d0833ce)
2020-06-02 11:35:43 +02:00
Matthijs Mekking
437ec25c0c kasp: registration delay adjustments
Registration delay is not part of the Iret retire interval, thus
removed from the calculation when setting the Delete time metadata.

Include the registration delay in prepublication time, because
we need to prepublish the key sooner than just the Ipub
publication interval.

(cherry picked from commit 50bbbb76a8)
2020-06-02 11:35:32 +02:00
Matthijs Mekking
48a265b2c7 Test keytimes on ZSK rollover
This improves keytime testing on ZSK rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.

(cherry picked from commit e01fcbbaf8)
2020-06-02 11:35:19 +02:00
Matthijs Mekking
0e1290c383 Test keytimes on enable-dnssec case
This improves keytime testing for enabling DNSSEC.  It now
tests for specific times, and also tests for SyncPublish.

(cherry picked from commit cf51c87fad)
2020-06-02 11:35:09 +02:00
Matthijs Mekking
cad5ae1682 Set SyncPublish on keys
Set the SyncPublish metadata on keys that don't have them yet.

(cherry picked from commit 30cb5c97c2)
2020-06-02 11:34:57 +02:00
Matthijs Mekking
e036a0a919 Start testing keytiming metadata
This commit adds testing keytiming metadata.  In order to facilitate
this, the kasp system test undergoes a few changes:

1. When finding a key file, rather than only saving the key ID,
   also save the base filename and creation date with `key_save`.
   These can be used later to set expected key times.
2. Add a test function `set_addkeytime` that takes a key, which
   keytiming to update, a datetime in keytiming format, and a number
   (seconds) to add, and sets the new time in the given keytime
   parameter of the given key.  This is used to set the expected key
   times.
3. Split `check_keys` in `check_keys` and `check_keytimes`.  First we
   need to find the keyfile before we can check the keytimes.
   We need to retrieve the creation date (and sometimes other
   keytimes) to determine the other expected key times.
4. Add helper functions to set the expected key times per policy.
   This avoids lots of duplication.

Check for keytimes for the first test cases (all that do not cover
rollovers).

(cherry picked from commit f8e34b57b4)
2020-06-02 11:34:49 +02:00
Matthijs Mekking
91d861b90d Stop keeping track of key parameter count
Stop tracking in the comments the number of key parameters in the
kasp system test, it adds nothing beneficial.

(cherry picked from commit 8483f71258)
2020-06-02 11:34:39 +02:00
Matthijs Mekking
cec9ddd18c Fix some more test output filenames
After removing dnssec-settime calls that set key rollover
relationship, we can adjust the counts in test output filenames.

Also fix a couple of more wrong counts in output filenames.

(cherry picked from commit 8204e31f0e)
2020-06-02 11:34:31 +02:00
Matthijs Mekking
f4d3a774f7 Set key rollover relationship without settime
Using dnssec-setttime after dnssec-keygen in the kasp system test
can lead to off by one second failures, so reduce the usage of
dnssec-settime in the setup scripts.  This commit deals with
setting the key rollover relationship (predecessor/successor).

(cherry picked from commit 5a590c47a5)
2020-06-02 11:34:22 +02:00
Matthijs Mekking
34fd8a0531 Move setting keytimes from settime to keygen
In the kasp system test, we are going to set the keytimes on
dnssec-keygen so we can test them against the key creation time.
This prevents off by one second in the test, something that can
happen if you set those times with dnssec-settime after
dnssec-keygen.

Also fix some test output filenames.

(cherry picked from commit 637d5f9a68)
2020-06-02 11:34:13 +02:00
Matthijs Mekking
6879cdca77 Set keytimes appropriately when using kasp
While kasp relies on key states to determine when a key needs to
be published or be used for signing, the keytimes are used by
operators to get some expectation of key publication and usage.

Update the code such that these keytimes are set appropriately.
That means:
- Print "PublishCDS" and "DeleteCDS" times in the state files.
- The keymgr sets the "Removed" and "PublishCDS" times and derives
  those from the dnssec-policy.
- Tweak setting of the "Retired" time, when retiring keys, only
  update the time to now when the retire time is not yet set, or is
  in the future.

This also fixes a bug in "keymgr_transition_time" where we may wait
too long before zone signatrues become omnipresent or hidden. Not
only can we skip waiting the sign delay Dsgn if there is no
predecessor, we can also skip it if there is no successor.

Finally, this commit moves setting the lifetime, reducing two calls
to one.

(cherry picked from commit 18dc27afd3)
2020-06-02 11:34:04 +02:00
Matthijs Mekking
ab8ee0d040 keygen -k: allow to set times, not genonly
For testing purposes mainly, we want to allow set keytimings on
generated keys, such that we don't have to "keygen/settime" which
can result in one second off times.

(cherry picked from commit 1c21631730)
2020-06-02 11:33:55 +02:00
Ondřej Surý
5585b1cf01 Merge branch '1164-add-danger-python-to-gitlab-ci-v9_16' into 'v9_16'
Add Danger Python to GitLab CI (v9_16)

See merge request isc-projects/bind9!3611
2020-06-01 11:55:40 +00:00
Michał Kępień
b594b1c95f Add Danger Python to GitLab CI
Certain rules of the BIND development process are not codified anywhere
and/or are used inconsistently.  In an attempt to improve this
situation, add a GitLab CI job which uses Danger Python to add comments
to merge requests when certain expectations are not met.  Two categories
of feedback are used, only one of which - fail() - causes the GitLab CI
job to fail.  Exclude dangerfile.py from Python QA checks as the way the
contents of that file are evaluated triggers a lot of Flake8 and PyLint
warnings.

(cherry picked from commit 36bb45a8b6)
2020-06-01 13:45:35 +02:00
Ondřej Surý
7648a4cfb8 Merge branch 'each-sphinx-doc-v9_16' into 'v9_16'
backport sphinx documentation to v9_16

See merge request isc-projects/bind9!3536
2020-06-01 08:18:12 +00:00
Suzanne Goldlust
d56c44579e Grammar, clarity, and content fixes in reference.rst
Also converted logging-categories.rst from a table to text and adjusted
the util/check-categories.sh script.

(cherry picked from commit 1e067c4d0b)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
1dd8581cd8 Text, grammar, typo, and clarity edits in multiple ARM chapters
Files requirements.rst, configuration.rs, plugins.rst, and partially
reference.rst has been edited.

(cherry picked from commit c7264db658)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
6b6bb534de Content and grammar edits to catz.rst
(cherry picked from commit 19ff2e2a79)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
cb855df86d Content updates to CONTRIBUTING.md
(cherry picked from commit 58c61b6e7b)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
6907ce0716 Various text edits to advanced.rst 2020-06-01 09:58:29 +02:00
Suzanne Goldlust
ac76a21566 Fix incorrect command formatting 2020-06-01 09:58:29 +02:00
Suzanne Goldlust
a2dde47f49 Content and grammar edits to dnssec.rst
(cherry picked from commit 5d3ef17ac8)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
20fdee450e Content and grammar changes to managed-keys.rst
(cherry picked from commit c269c061ee)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
cabaa9de9d Content and grammar updates to dlz.rst
(cherry picked from commit 5d6c93aed7)
2020-06-01 09:58:29 +02:00
Suzanne Goldlust
a1282ff3c1 Content and grammar updates to dyndb.rst
(cherry picked from commit 18129808f7)
2020-06-01 09:58:29 +02:00
Evan Hunt
a40d6ec091 generate grammar text correctly in RST format 2020-06-01 09:58:29 +02:00
Evan Hunt
714b559902 fix doxygen build 2020-06-01 09:58:29 +02:00
Evan Hunt
93bdf74804 clean up doc checks
- Update util/check-categories.sh for logging-categories.rst, call from CI
- remove xmllint of .html files
2020-06-01 09:58:29 +02:00
Evan Hunt
5a855f6754 convert release notes to RST 2020-06-01 09:58:25 +02:00
Evan Hunt
b580eb2fb3 add support for building sphinx documentation 2020-06-01 09:54:46 +02:00
Evan Hunt
330c9b32ba convert python tools' man pages to RST 2020-06-01 09:54:45 +02:00
Ondřej Surý
58e20fa746 Convert the documentation to Sphinx documentation format
The ARM and the manpages have been converted into Sphinx documentation
format.

Sphinx uses reStructuredText as its markup language, and many of its
strengths come from the power and straightforwardness of
reStructuredText and its parsing and translating suite, the Docutils.

(cherry picked from commit 9fb6d11abb)
2020-06-01 09:54:45 +02:00
Ondřej Surý
69706125c6 Merge branch 'wpk/fix-leaking-mutexes-and-conditionals-v9_16' into 'v9_16'
Fix leaking mutexes and conditionals (v9_16)

See merge request isc-projects/bind9!3607
2020-05-30 07:03:09 +00:00
Witold Kręcicki
2a01586068 CHANGES and release notes
(cherry picked from commit 4ae2a74873)
2020-05-30 07:53:33 +02:00
Witold Kręcicki
3461aab083 Clear sock->magic to 0 when destroying a netmgr socket
(cherry picked from commit 7ef756f639)
2020-05-30 07:50:30 +02:00
Witold Kręcicki
4ceddeee78 Add missing isc_mutex_destroy and isc_conditional_destroy calls.
While harmless on Linux, missing isc_{mutex,conditional}_destroy
causes a memory leak on *BSD. Missing calls were added.

(cherry picked from commit a8807d9a7b)
2020-05-30 07:50:30 +02:00
Evan Hunt
b46faa1b04 Merge branch '1857-assertion-failure-insist-nlabels-name-labels-v9_16' into 'v9_16'
Resolve "assertion failure in 9.16.2: name.c:1738: INSIST(nlabels == name->labels)"

See merge request isc-projects/bind9!3608
2020-05-29 23:28:39 +00:00
Evan Hunt
593b9ae80f CHANGES, release note
(cherry picked from commit 6ebab27567)
2020-05-29 15:04:26 -07:00
Mark Andrews
69c43a03d0 Ensure tree lock is always held when dns_rbt_fullnamefromnode is called
(cherry picked from commit eded3efb79)
2020-05-29 15:02:09 -07:00
Evan Hunt
8b154d0f9f pass the nodename to add32() instead of calling dns_rbt_fullnamefromnode()
in addition to being more efficient, this prevents a possible crash by
looking up the node name before the tree sructure can be changed when
cleaning up dead nodes in addrdataset().

(cherry picked from commit db9d10e3c1)
2020-05-29 15:02:09 -07:00
Mark Andrews
8cd193f18d Merge branch '1858-silence-tsan-in-bin-nsupdate-nsupdate-c-v9_16' into 'v9_16'
Lock access to 'answer' to silence TSAN

See merge request isc-projects/bind9!3597
2020-05-28 03:48:20 +00:00
Mark Andrews
f00cb2415a Lock access to 'answer' to silence TSAN
(cherry picked from commit b3bd8a270b)
2020-05-28 11:11:45 +10:00
Evan Hunt
4ffe9e2e0d Merge branch 'each-bool-conditionals-v9_16' into 'v9_16'
remove unnecessary 'true' and 'false' comparisons in boolean expressions

See merge request isc-projects/bind9!3585
2020-05-26 00:48:17 +00:00
Evan Hunt
c19a593d3e change "expr == false" to "!expr" in conditionals
(cherry picked from commit 57e54c46e4)
2020-05-25 17:04:04 -07:00
Evan Hunt
00c816778d change 'expr == true' to 'expr' in conditionals
(cherry picked from commit 68a1c9d679)
2020-05-25 17:03:59 -07:00
Mark Andrews
be88fb1aa7 Merge branch '1860-delv-crashes-processing-deprecated-trusted-keys-clause-in-anchor-file-v9_16' into 'v9_16'
Resolve "delv crashes processing deprecated "trusted-keys" clause in anchor file"

See merge request isc-projects/bind9!3584
2020-05-25 23:50:15 +00:00
Mark Andrews
79790edb84 Add CHANGES
(cherry picked from commit 7854b652c3)
2020-05-26 09:19:06 +10:00
Mark Andrews
d64c9b7eb4 Handle deprecated 'trusted-keys' style anchors
(cherry picked from commit d807febd25)
2020-05-26 09:18:34 +10:00
Mark Andrews
5c6919fdde Check that delv supports deprecated trusted-keys
(cherry picked from commit 26b3ca7acf)
2020-05-26 09:18:34 +10:00
Mark Andrews
d5829b44fa Merge branch '1861-named_checknames_get-missing-dbc-v9_16' into 'v9_16'
Resolve "named_checknames_get missing DBC"

See merge request isc-projects/bind9!3581
2020-05-25 04:37:38 +00:00
Mark Andrews
63238a6c7a Add DBC checks to named_checknames_get
(cherry picked from commit 20c07da49b)
2020-05-25 11:52:17 +10:00
Mark Andrews
d02f1ed5b8 Set obj to NULL so INSIST makes sense
(cherry picked from commit ac9e266749)
2020-05-25 11:52:17 +10:00
Michał Kępień
4762184c65 Merge branch 'michal/do-not-install-python-packages-in-gitlab-ci-jobs-v9_16' into 'v9_16'
[v9_16] Do not install Python packages in GitLab CI jobs

See merge request isc-projects/bind9!3573
2020-05-21 10:02:03 +00:00
Michał Kępień
88f6eb7648 Add py.test-3 to the list of tested pytest names
Some operating systems (e.g. CentOS, OpenBSD) install the main pytest
script as "py.test-3".  Add that name to the list of names passed to
AC_PATH_PROGS() in order for pytest to be properly detected on a broader
range of operating systems.

(cherry picked from commit d5562a3e7e)
2020-05-21 11:38:39 +02:00
Michał Kępień
8d33f372a0 Do not use f-strings in Python system tests
Use str.format() instead of f-strings in Python system tests to enable
them to work on Python 3 versions older than 3.6 as the latter is not
available on some operating systems used in GitLab CI that are still
actively supported (CentOS 6, Debian 9, Ubuntu 16.04).

(cherry picked from commit 5562c38ffb)
2020-05-21 11:38:26 +02:00
Michał Kępień
1dfa34da3f Do not install Python packages in GitLab CI jobs
As Python QA tools, BIND system test prerequisites, and documentation
building utilities are now all included in operating system images used
in GitLab CI, do not use pip for installing them in each CI job any
more.

(cherry picked from commit e3c217296d)
2020-05-21 11:37:48 +02:00
Mark Andrews
7d5cddf6bc Merge branch '1854-extend-loop-limit-by-1-v9_16' into 'v9_16'
Extend loop count by 1 to account for non-exact timing in usleep().

See merge request isc-projects/bind9!3570
2020-05-21 04:50:39 +00:00
Mark Andrews
4df013f0ea Extend loop count by 1 to account for non-exact timing in usleep().
(cherry picked from commit 3012e1ad9b)
2020-05-21 14:09:42 +10:00
Michał Kępień
51d0494a3c Merge branch 'v9_16_3-release' into 'v9_16'
[CVE-2020-8616] [CVE-2020-8617] Merge 9.16.3 release branch

See merge request isc-projects/bind9!3563
2020-05-19 13:08:51 +00:00
Michał Kępień
d8575efbdd Set up release notes for BIND 9.16.4 2020-05-19 14:11:08 +02:00
Michał Kępień
9dd4bff43a Bump BIND_BASELINE_VERSION for ABI checks 2020-05-19 14:11:08 +02:00
Michał Kępień
9a1c87ea6c Fix UTF-8 character in doc/arm/notes.txt 2020-05-19 13:57:37 +02:00
Michał Kępień
e4fc5335a3 Revert README updates 2020-05-19 13:57:37 +02:00
Michał Kępień
e67d247ee7 Adjust library API versions 2020-05-19 13:57:37 +02:00
Tinderbox User
e0b52d0153 Merge branch 'prep-release' into v9_16 2020-05-19 13:57:37 +02:00
Tinderbox User
046f56f5ab prep 9.16.3 2020-05-19 13:57:36 +02:00
Mark Andrews
66af483729 Merge branch '1388-confidential-issue-security-v9_16' into 'security-v9_16'
1388 confidential issue security v9 16

See merge request isc-private/bind9!151
2020-05-19 13:57:07 +02:00
Mark Andrews
0312831ace Merge branch '1703-tsig-verify-failure-security-v9_16' into 'security-v9_16'
1703 tsig verify failure security v9 16

See merge request isc-private/bind9!148
2020-05-19 13:57:07 +02:00
Mark Andrews
d042ef51a1 Add release notes entry 2020-05-19 13:57:07 +02:00
Mark Andrews
4ba2a6ca22 Add release note entry 2020-05-19 13:57:07 +02:00
Mark Andrews
6124c3404f Add CHANGES entry 2020-05-19 13:57:07 +02:00
Mark Andrews
dfaad75502 Add CHANGES entry 2020-05-19 13:57:07 +02:00
Mark Andrews
25f9aefff5 Update the ARM to reflect that TLD and root servers are no longer exempt
from max-recursion-queries limits.
2020-05-19 13:57:07 +02:00
Mark Andrews
baa7ec24e2 Only look at tsig.error in responses 2020-05-19 13:57:07 +02:00
Mark Andrews
39bb741927 Count queries to the root and TLD servers as well 2020-05-19 13:57:07 +02:00
Mark Andrews
9d787ab6f0 Check that a 'BADTIME' response with 'QR=0' is handled as a request 2020-05-19 13:57:07 +02:00
Stephen Morris
9648c335d5 Add test for reduction in number of fetches
Add a system test that counts how many address fetches are made
for different numbers of NS records and checks that the number
are successfully limited.
2020-05-19 13:57:07 +02:00
Mark Andrews
b9c4f1b648 Reduce the number of fetches we make when looking up addresses
If there are more that 5 NS record for a zone only perform a
maximum of 4 address lookups for all the name servers.  This
limits the amount of remote lookup performed for server
addresses at each level for a given query.
2020-05-19 13:57:07 +02:00
Mark Andrews
1b00c4ab65 Merge branch '1856-race-in-clear-signing-records-in-dnssec-system-test-v9_16' into 'v9_16'
Resolve "Race in 'clear signing records' in dnssec system test."

See merge request isc-projects/bind9!3559
2020-05-19 06:10:48 +00:00
Mark Andrews
6fd64c970b Add CHANGES
(cherry picked from commit 3405ee9eb2)
2020-05-19 13:46:07 +10:00
Mark Andrews
c813b5a737 Address race in dnssec system test. 'clear signing records' can fail
as the update triggers by the rndc command to clear the signing records
may not have completed by the time the subsequent rndc command to test
that the records have been removed is commenced.  Loop several times to
prevent false negative.

(cherry picked from commit 353018c0e5)
2020-05-19 13:46:07 +10:00
Mark Andrews
0172ecc1e1 Merge branch '1855-check-max-journal-size-limits-failed-as-not-enough-time-allowed-v9_16' into 'v9_16'
Resolve ""check max-journal-size limits" failed as not enough time allowed"

See merge request isc-projects/bind9!3556
2020-05-18 23:36:37 +00:00
Mark Andrews
3353bbbe4a Add CHANGES
(cherry picked from commit aaacf3ef45)
2020-05-19 08:15:11 +10:00
Mark Andrews
906211a02a Wait longer (up to 20 secs) for journal to be truncated
(cherry picked from commit 0c2f0e02f2)
2020-05-19 08:15:11 +10:00
Michał Kępień
961e7359f8 Merge branch 'michal/misc-cppcheck-tweaks-v9_16' into 'v9_16'
[v9_16] Miscellaneous cppcheck tweaks

See merge request isc-projects/bind9!3552
2020-05-18 08:35:34 +00:00
Michał Kępień
4c2c93c821 Work around cppcheck 2.0 uninitvar false positives
cppcheck 2.0 reports false positives about uninitialized variables in a
lot of places throughout BIND source code, e.g.:

    bin/dnssec/dnssec-cds.c:282:6: error: Uninitialized variable: length [uninitvar]
     if (isc_buffer_availablelength(&buf) <= len) {
         ^

Apparently cppcheck 2.0 has issues with processing (&var)->field syntax,
which is what the macros from lib/isc/include/isc/buffer.h are evaluated
to.  This issue was reported upstream [1] and will hopefully be
addressed in a future cppcheck release.

In the meantime, to avoid modifying BIND source code in multiple places
just because of a static checker false positive, work around the issue
by adding intermediate variables to buffer macro definitions using a sed
invocation in the cppcheck job script.

[1] https://sourceforge.net/p/cppcheck/discussion/general/thread/122153e3c1/

(cherry picked from commit 481fa34e50)
2020-05-18 10:33:20 +02:00
Michał Kępień
9a932a3038 Make GCC version extraction work with GCC 10
Add whitespace to the regular expression used for extracting the GCC
version from "gcc --version" output so that it works properly with
multi-digit major version numbers.

(cherry picked from commit 3b48eec79f)
2020-05-18 10:33:20 +02:00
Michał Kępień
87a1a7ea75 Ensure cppcheck creates a HTML report upon failure
Commit 691c8f6828 broke the cppcheck job
in GitLab CI: when cppcheck fails, the script is immediately
interrupted, preventing cppcheck-htmlreport from being run.  To ensure
the HTML report is generated when cppcheck fails, revert to invoking
cppcheck-htmlreport in the "after_script" part of the job.

(cherry picked from commit cb2037ee9d)
2020-05-18 10:33:14 +02:00
Mark Andrews
89ba820df8 Merge branch '1852-race-in-autosign-system-test-v9_16' into 'v9_16'
Resolve "race in autosign system test."

See merge request isc-projects/bind9!3549
2020-05-18 06:58:02 +00:00
Mark Andrews
d9f357d082 Add CHANGES
(cherry picked from commit 07e335138b)
2020-05-18 15:58:44 +10:00
Mark Andrews
74f79188db Retry checks that records are present and signed
There a race between when the delta is logged and when the
server returns signed record.  Retry the queries if the
lookups fail to meet expectations.

(cherry picked from commit 46c4e5d96f)
2020-05-18 15:58:43 +10:00
Michal Nowak
09489a6bac Merge branch 'mnowak/abi-check-artifacts-v9_16' into 'v9_16'
[v9_16] Collect TXT and HTML reports produced by ABI checker

See merge request isc-projects/bind9!3542
2020-05-15 09:37:02 +00:00
Michal Nowak
b5fdddd593 Collect TXT and HTML reports produced by ABI checker
Although in util/api-checker.sh we create textual reports, we don't
preserve them in job artifacts, but we should.

We don't want to keep all HTML pages present in the project root, but
just those produced by ABI checker.

(cherry picked from commit b5ccf95b0a)
2020-05-15 11:31:02 +02:00
Mark Andrews
14a8713ef4 Merge branch '1714-provide-ixfr-no-should-still-send-up-to-date-responses-v9_16' into 'v9_16'
Resolve "'provide-ixfr no;' should still send up-to-date responses."

See merge request isc-projects/bind9!3539
2020-05-15 05:37:38 +00:00
Mark Andrews
5b5bebee05 Add CHANGES entry
(cherry picked from commit 11b1cbecb0)
2020-05-15 14:30:04 +10:00
Mark Andrews
89c1bc58e4 move provide-ixfr testing after the serial has been checked
(cherry picked from commit c7cdc47cc5)
2020-05-15 14:29:12 +10:00
Mark Andrews
1f08f14903 Merge branch '1835-add-the-ability-to-parse-and-display-extended-dns-error-code-ede-v9_16' into 'v9_16'
Resolve "Add the ability to parse and display Extended DNS Error code (EDE)."

See merge request isc-projects/bind9!3526
2020-05-13 00:55:57 +00:00
Mark Andrews
2e02c6f9a7 Add release note entry
(cherry picked from commit 88615006c5)
2020-05-13 10:31:53 +10:00
Mark Andrews
e196c7f9fa Add CHANGES entry
(cherry picked from commit 79729c0e19)
2020-05-13 10:31:51 +10:00
Mark Andrews
88e11a9971 Check display of EDE option
(cherry picked from commit e6b0153f8a)
2020-05-13 10:26:39 +10:00
Mark Andrews
c13fb2c67f Also print out valid printable utf8
(cherry picked from commit 1c8f9d06e2)
2020-05-13 10:26:39 +10:00
Mark Andrews
eed4fab37b Report Extended DNS Error codes
(cherry picked from commit b144ae1bb0)
2020-05-13 10:26:39 +10:00
Evan Hunt
5c596c41d7 Merge branch 'each-nsec3-ixfr-v9_16' into 'v9_16'
don't bother checking for empty nodes when searching the NSEC3 tree

See merge request isc-projects/bind9!3528
2020-05-12 21:04:13 +00:00
Evan Hunt
78bc45573c CHANGES
(cherry picked from commit 0f901b5f2d)
2020-05-12 13:37:34 -07:00
Evan Hunt
1ccfadefe0 don't bother checking for empty nodes when searching the NSEC3 tree
this avoids a time-wasting search that could occur during an
IXFR that replaced an NSEC3 chain.

(cherry picked from commit 7192edf9c2)
2020-05-12 13:36:55 -07:00
Ondřej Surý
fe6d405a72 Merge branch '1232-stats-channel-zone-timers-v9_16' into 'v9_16'
Resolve "[ISC-support #15166] expose zone timers (reload, refresh, expire)  via stats channel"

See merge request isc-projects/bind9!3520
2020-05-12 12:39:37 +00:00
Ondřej Surý
0339e5cb06 Add CHANGES
(cherry picked from commit ce6cb62862)
2020-05-12 14:12:40 +02:00
Ondřej Surý
7f0f2d9fd4 Add release notes
(cherry picked from commit e0aa62bc4c)
2020-05-12 14:12:40 +02:00
Ondřej Surý
75e76b072a Rewrite the statschannel traffic tests to pytest
(cherry picked from commit 1202fd912a)
2020-05-12 14:12:03 +02:00
Ondřej Surý
09a1c051ec Add tests for zone timers using the pytest testing framework
(cherry picked from commit 6aa6d7be58)
2020-05-12 14:12:03 +02:00
Paul Frieden
838329bcb7 Add the zone timers to the XSL
(cherry picked from commit 72ffa194e2)
2020-05-12 14:12:03 +02:00
Paul Frieden
794c645987 Export zone timers via stats channels
(cherry picked from commit 543bab699d)
2020-05-12 14:12:03 +02:00
Ondřej Surý
d3c19d290b Merge branch 'marka-silence-flake8-warning-v9_16' into 'v9_16'
Silence: E741 ambiguous variable name 'l'

See merge request isc-projects/bind9!3524
2020-05-12 12:09:55 +00:00
Mark Andrews
2a45b67ee1 Silence: E741 ambiguous variable name 'l'
(cherry picked from commit 189d21fb96)
2020-05-12 14:06:52 +02:00
Ondřej Surý
2232e6379f Merge branch 'ondrej/fix-statschannel-setup.sh-failure-v9_16' into 'v9_16'
Fix statschannel setup.sh failure (v9_16)

See merge request isc-projects/bind9!3523
2020-05-12 12:02:33 +00:00
Ondřej Surý
a2e21137a6 Fix the rsabigexponent setup.sh script to not fail
(cherry picked from commit 2dbf68ab30)
2020-05-12 13:21:10 +02:00
Ondřej Surý
c7e2af1a45 Add missing manykeys.db.in file that was causing statschannel setup.sh to fail
(cherry picked from commit e43893fb0c)
2020-05-12 13:20:49 +02:00
Ondřej Surý
24085c6bbd Fail immediatelly when clean.sh or setup.sh fails
The `statschannel/ns2/` was missing `manykeys.db.in`, but the test
succeeded even when `setup.sh` (or `clean.sh`) failed to execute.  This
commit makes run.sh to run in stricter mode and fail the test
immediately when `clean.sh` or `setup.sh` fails.

(cherry picked from commit 8b357a35d2)
2020-05-12 13:20:45 +02:00
Ondřej Surý
9fec9c51fd Merge branch '25-fix-underlinking-and-overlinking-of-libraries' into 'v9_16'
Resolve "Revise what gets linked where and improve overlinking/underlinking"

See merge request isc-projects/bind9!3442
2020-05-11 09:39:24 +00:00
Ondřej Surý
af1b56240f Resolve the overlinking of the system libraries
Originally, every library and binaries got linked to everything, which
creates unnecessary overlinking.  This wasn't as straightforward as it
should be as we still support configuration without libtool for 9.16.

Couple of smaller issues related to include headers and an issue where
sanitizer overload dlopen and dlclose symbols, so we were getting false
negatives in the autoconf test.
2020-05-11 09:49:54 +02:00
Ondřej Surý
b75778042f libns and libirs were underlinked (missing libisc, libdns, libisccfg)
Underlinking states for the situation when a binary uses a symbol not provided
by libraries it is directly linked to.  The libns was not linked to libisc and
libdns, and libirs was not linked to libisc, libdns and libisccfg) while using
symbols from these libraries directly.
2020-05-11 09:49:53 +02:00
Mark Andrews
6f3edab604 Merge branch 'marka-call-check-categories' into 'v9_16'
have CI call util/check-categories.sh

See merge request isc-projects/bind9!3513
2020-05-11 01:00:01 +00:00
Mark Andrews
2270e28fde have CI call util/check-categories.sh 2020-05-11 10:57:44 +10:00
Mark Andrews
848fe7c4a5 Merge branch '1817-named-checkzone-s-full-relative-missing-from-usage-v9_16' into 'v9_16'
add [-s (full|relative)] to usage

See merge request isc-projects/bind9!3510
2020-05-08 07:22:33 +00:00
Mark Andrews
cb9699bb0c add [-s (full|relative)] to usage
(cherry picked from commit 3f93f3ee11)
2020-05-08 16:55:16 +10:00
Evan Hunt
05237ebdbc Merge branch '1812-uninitialized-dscp-v9_16' into 'v9_16'
Unexpected output from named-checkconf

See merge request isc-projects/bind9!3506
2020-05-06 22:38:55 +00:00
Evan Hunt
a654989716 initialize sockaddrdscp to prevent spurious output from 'named-checkconf -p'
(cherry picked from commit f8d753d452)
2020-05-06 12:42:11 -07:00
Michał Kępień
ef4f2de63b Merge branch 'michal/prepare-release-notes-for-bind-9.16.3' into 'v9_16'
Prepare release notes for BIND 9.16.3

See merge request isc-projects/bind9!3495
2020-05-05 20:32:52 +00:00
Michał Kępień
3ba119e167 Add release note for GL #1807 2020-05-05 22:27:13 +02:00
Michał Kępień
666cdd8514 Add release note for GL #1695 2020-05-05 22:27:13 +02:00
Michał Kępień
d376746db7 Release notes: wording and formatting tweaks 2020-05-05 22:27:13 +02:00
Michał Kępień
f996fb97b5 Reorder release notes within each section 2020-05-05 22:27:13 +02:00
Michał Kępień
9be4198dee Move release notes to the sections they belong to 2020-05-05 22:27:13 +02:00
Michał Kępień
80b11a1e2a Move AXFR release note to the correct file 2020-05-05 22:27:13 +02:00
Michał Kępień
692e300b82 Tweak and reword recent CHANGES entries 2020-05-05 22:27:13 +02:00
Michał Kępień
6eccd41f7c Merge branch 'michal/fix-server-shutdown-in-run.sh' into 'v9_16'
Fix server shutdown in bin/tests/system/run.sh

See merge request isc-projects/bind9!3500
2020-05-05 12:18:43 +00:00
Michał Kępień
2b037713bd Fix server shutdown in bin/tests/system/run.sh
a4f0281962 is a flawed backport of
cf5105939c - it retained the original
invocation of bin/tests/system/stop.pl in bin/tests/system/run.sh.  This
results in the former script being called twice for each system test,
which does not cause problems on Unix systems, but triggers false
positives about named instances dying prematurely on Windows.  Fix by
removing the offending invocation of bin/tests/system/stop.pl from
bin/tests/system/run.sh.
2020-05-05 13:49:43 +02:00
Michał Kępień
aaf37b0a2e Merge branch 'wpk/changes-notes-3487' into 'v9_16'
CHANGES/relnotes for !3487

See merge request isc-projects/bind9!3494
2020-05-04 10:56:53 +00:00
Witold Kręcicki
984dfcf98b CHANGES/relnotes for \!3487 2020-05-04 12:50:50 +02:00
Michał Kępień
48231bb52e Merge branch '1797-add-release-note-discussing-recvmmsg-support-v9_16' into 'v9_16'
[v9_16] Add release note discussing recvmmsg() support

See merge request isc-projects/bind9!3493
2020-05-04 10:04:25 +00:00
Michał Kępień
ea7921967f Add release note discussing recvmmsg() support
(cherry picked from commit 84dc6d86cb)
2020-05-04 12:03:16 +02:00
Michał Kępień
f609bdbc0c Merge branch 'michal/1674-add-release-note' into 'v9_16'
Add release note for GL #1674

See merge request isc-projects/bind9!3490
2020-05-04 09:06:31 +00:00
Michał Kępień
4715a76345 Add release note for GL #1674 2020-05-04 11:00:23 +02:00
Evan Hunt
89a9a4eca5 Merge branch '1807-checkconf-error-v9_16' into 'v9_16'
named-checkconf -z could exit with an incorrect status

See merge request isc-projects/bind9!3488
2020-05-02 01:01:56 +00:00
Evan Hunt
0a0e02f31e named-checkconf -z could exit with an incorrect staatus
the CHECK() macro resets result, so an error code from an earlier
view could be erased if the last view loaded had no errors.

(cherry picked from commit 7e73660206)
2020-05-01 17:17:00 -07:00
Witold Krecicki
741a0b8387 Merge branch '1713-use-default-buffer-sizes-v9_16' into 'v9_16'
Don't set UDP recv/send buffer sizes - use system defaults (unless explicitly defined)

See merge request isc-projects/bind9!3487
2020-05-01 16:56:33 +00:00
Witold Kręcicki
444a16bff9 Don't set UDP recv/send buffer sizes - use system defaults (unless explicitly defined)
(cherry picked from commit fa02f6438b)
2020-05-01 17:47:19 +02:00
Ondřej Surý
97d650e6e2 Merge branch 'ondrej/fix-SO_REUSEPORT-usage-on-FreeBSD-v9_16' into 'v9_16'
Fix SO_REUSEPORT usage on FreeBSD (v9.16)

See merge request isc-projects/bind9!3486
2020-05-01 14:51:11 +00:00
Ondřej Surý
e23321eba9 Add CHANGES note for GL !3365
(cherry picked from commit 23a653dd92)
2020-05-01 16:50:06 +02:00
Ondřej Surý
c56cd29bbb Use SO_REUSEPORT only on Linux, use SO_REUSEPORT_LB on FreeBSD
The SO_REUSEPORT socket option on Linux means something else on BSD
based systems.  On FreeBSD there's 1:1 option SO_REUSEPORT_LB, so we can
use that.

(cherry picked from commit 09ba47b067)
2020-05-01 16:50:06 +02:00
Ondřej Surý
a0134ad57e Merge branch '1795-make-dnstap-work-reliably-with-netmgr-v9_16' into 'v9_16'
Resolve "Some dnstap data may not be logged in BIND 9.15.6+"

See merge request isc-projects/bind9!3485
2020-05-01 14:32:12 +00:00
Michał Kępień
ea5f122ffc Add CHANGES entry
(cherry picked from commit 47c769e475)
2020-05-01 16:29:36 +02:00
Michał Kępień
3a40a3f9a8 Add a release note
(cherry picked from commit 4a5c1c7bfe)
2020-05-01 16:29:18 +02:00
Michał Kępień
299954d006 Make dnstap work reliably with netmgr
The introduction of netmgr doubled the number of threads from which
dnstap data may be logged: previously, it could only happen from within
taskmgr worker threads; with netmgr, it can happen both from taskmgr
worker threads and from network threads.  Since the argument passed to
fstrm_iothr_options_set_num_input_queues() was not updated to reflect
this change, some calls to fstrm_iothr_get_input_queue() can now return
NULL, effectively preventing some dnstap data from being logged.
Whether this bug is triggered or not depends on thread scheduling order
and packet distribution between network threads, but will almost
certainly be triggered on any recursive resolver sooner or later.  Fix
by requesting the correct number of dnstap input queues to be allocated.

(cherry picked from commit 77dc091855)
2020-05-01 16:29:18 +02:00
Ondřej Surý
f6fcd0d208 Merge branch '1763-ossl-eddsa-engine-v9_16' into 'v9_16'
Add engine support to OpenSSL EdDSA implementation (v9.16)

See merge request isc-projects/bind9!3483
2020-05-01 14:27:12 +00:00
Ondřej Surý
a3ed49c515 Add release notes for #1763
(cherry picked from commit 3c5cdc3f24)
2020-05-01 16:25:56 +02:00
Ondřej Surý
928a4ff3f3 Add CHANGES note for #1763
(cherry picked from commit 3422c496ae)
2020-05-01 16:25:56 +02:00
Aaron Thompson
dddcc4a7eb Add engine support to OpenSSL EdDSA implementation.
(cherry picked from commit 6a9f20d031)
2020-05-01 16:25:56 +02:00
Aaron Thompson
112ffbaaa2 Use OpenSSL raw key functions for EdDSA keys.
(cherry picked from commit f9685b29f9)
2020-05-01 16:25:56 +02:00
Ondřej Surý
3112e08ba0 Merge branch '1534-add-ecdsa-openssl-pkcs11-engine-support-v9_16' into 'v9_16'
Add engine support to OpenSSL ECDSA implementation (v9.16)

See merge request isc-projects/bind9!3484
2020-05-01 14:25:17 +00:00
Ondřej Surý
b657411076 Add release note for GL #1534
(cherry picked from commit 80d51223c3)
2020-05-01 14:31:19 +02:00
Ondřej Surý
a600ff4917 Add CHANGES note for GL #1534
(cherry picked from commit dde438dac7)
2020-05-01 14:31:12 +02:00
Ondřej Surý
ce0f31a93b Simplify error handling
(cherry picked from commit 064d8b7a6d)
2020-05-01 14:30:04 +02:00
Ondřej Surý
0fa7c9099c Add initial support for ECDSA keys via OpenSSL PKCS#11 engine
(cherry picked from commit aff61535c2)
2020-05-01 14:30:04 +02:00
Ondřej Surý
46ddf100cc Merge branch 'ondrej/fix-system-tests-on-openbsd-v9.16' into 'v9_16'
Fix system tests on openbsd v9.16

See merge request isc-projects/bind9!3478
2020-05-01 11:40:21 +00:00
Ondřej Surý
3300e73570 Rename start() and stop() to start_server() and stop_server()
On OpenBSD, there's non-POSIX alias from stop to kill that breaks
the conf.sh.common script.
2020-05-01 13:37:44 +02:00
Ondřej Surý
7f37699725 Change the 'date -R' to sort-of iso-8601 emulated time 2020-05-01 13:37:44 +02:00
Ondřej Surý
da90f69a29 Merge branch '1797-libuv-1-37-requires-uv_init_ex-to-be-used-for-mmsg-v9_16' into 'v9_16'
Resolve "libuv >= 1.37 requires uv_udp_init_ex() to be used for mmsg"

See merge request isc-projects/bind9!3474
2020-05-01 10:45:46 +00:00
Witold Kręcicki
21d0bf6cd8 CHANGES note 2020-05-01 11:29:18 +02:00
Witold Kręcicki
786a289dfb Don't free udp recv buffer if UV_UDP_MMSG_CHUNK is set
(cherry picked from commit 83049ceabf)
2020-05-01 11:27:46 +02:00
Ondřej Surý
cf7975400e Use UV_UDP_RECVMMSG to enable mmsg support in libuv if available
(cherry picked from commit d5356a40ff)
2020-05-01 11:27:46 +02:00
Ondřej Surý
c015ae2341 Merge branch '1648-native-pkcs11-eddsa-v9_16' into 'v9_16'
Resolve "Fix PKCS#11-based EdDSA support"

See merge request isc-projects/bind9!3472
2020-05-01 08:32:45 +00:00
Ondřej Surý
e4a7cf0624 Make the cleanpkcs11.sh more universal across branches 2020-05-01 09:02:54 +02:00
Ondřej Surý
7b5cc16bad Fix another the start_fail -> start_servers_failed typo 2020-05-01 08:06:07 +02:00
Ondřej Surý
795cfad2d3 Fixup the start_fail -> start_servers_failed typo
(cherry picked from commit 0313d2950a)
2020-05-01 08:03:08 +02:00
Ondřej Surý
73868ba80b Add release notes
(cherry picked from commit e69d34a454)
2020-05-01 08:03:08 +02:00
Ondřej Surý
492703d1a8 Add CHANGES
(cherry picked from commit 84fffbdb4c)
2020-05-01 08:03:03 +02:00
Ondřej Surý
09535ac6d6 Fix the check for non-operational algs 15 and 16 in PKCS#11
(cherry picked from commit 57c39ddbe3)
2020-05-01 08:02:09 +02:00
Ondřej Surý
f35b8cee47 Fail running run.sh when clean.sh or setup.sh fails
(cherry picked from commit 101672f664)
2020-05-01 08:02:05 +02:00
Ondřej Surý
4cc5b572bd Refactor the pkcs11 to test for individual algorithms
(cherry picked from commit a6bdb9639a)
2020-05-01 08:00:52 +02:00
Aaron Thompson
c0e1dc33d5 Update EdDSA implementation to PKCS#11 v3.0.
Per Current Mechanisms 2.3.5, the curve name is DER-encoded in the
EC_PARAMS attribute, and the public key value is DER-encoded in the
EC_POINT attribute.

(cherry picked from commit 2e6b7a56cc)
2020-05-01 08:00:52 +02:00
Aaron Thompson
2401952bbb Fix EdDSA key sizes (key_size is in bits).
(cherry picked from commit 9b87fe1051)
2020-05-01 08:00:52 +02:00
Aaron Thompson
4ba7a0ec2d Add EdDSA algorithms back to dnssec-keyfromlabel help text.
Regressed in 45afdb2672.

(cherry picked from commit 4969577189)
2020-05-01 08:00:52 +02:00
Ondřej Surý
a39348336e Merge branch '1763-pkcs11-code-cleanups-v9_16' into 'v9_16'
Resolve "Implement and improve the PKCS#11 code"

See merge request isc-projects/bind9!3471
2020-05-01 05:57:17 +00:00
Ondřej Surý
fb8f428f07 Add CHANGES
(cherry picked from commit 48473d464f)
2020-05-01 06:54:27 +02:00
Ondřej Surý
358affe585 Use switch instead of if when evaluating curves
Previously, the code would do:

    REQUIRE(alg == CURVE1 || alg == CURVE2);

    [...]

    if (alg == CURVE1) { /* code for CURVE1 */ }
    else { /* code for CURVE2 */ }

This approach is less extensible and also more prone to errors in case
the initial REQUIRE() is forgotten.  The code has been refactored to
use:

    REQUIRE(alg == CURVE1 || alg == CURVE2);

    [...]

    switch (alg) {
    case CURVE1: /* code for CURVE1 */; break;
    case CURVE2: /* code for CURVE2 */; break;
    default: INSIST(0);
    }

(cherry picked from commit cf30e7d0d1)
2020-05-01 06:54:27 +02:00
Ondřej Surý
4e1c7e1c01 Refactor the code using the pk11 ECC constants.
The pk11/constants.h header contained static CK_BYTE arrays and
we had to use #defines to pull only those we need.  This commit
changes the constants to only define byte arrays with the content
and either use them directly or define the CK_BYTE arrays locally
where used.

(cherry picked from commit da38bd0e1d)
2020-05-01 06:54:27 +02:00
Ondřej Surý
dc51f720b9 Only print warning when PKCS#11 dnssec-keygen fails from Edwards curves
(cherry picked from commit 9d979d7cd6)
2020-05-01 06:54:26 +02:00
Aaron Thompson
fb21f7d0e6 Fix a segfault when a PKCS#11 token is not found.
(cherry picked from commit 541d7bafe6)
2020-05-01 06:54:26 +02:00
Aaron Thompson
0777eb04bf Fix bad syntax in pkcs11eddsa_link.c.
Introduced in 994e656977.

(cherry picked from commit 46cae09023)
2020-05-01 06:54:26 +02:00
Aaron Thompson
8607580599 Update to PKCS#11 v3.0 EdDSA macros.
(cherry picked from commit 3e685fe01a)
2020-05-01 06:54:26 +02:00
Aaron Thompson
b5f2e93339 Fix compiler warnings about unused pk11 constants.
(cherry picked from commit 2ef379d911)
2020-05-01 06:54:26 +02:00
Aaron Thompson
61853130c9 Remove remaining PKCS#11 DH references.
Missed in 0a73c9f137 and 8efd394c80.

(cherry picked from commit d28c7dadbb)
2020-05-01 06:54:26 +02:00
Aaron Thompson
f89a566b26 Remove unnecessary forward declarations.
(cherry picked from commit 6a6485a531)
2020-05-01 06:54:26 +02:00
Aaron Thompson
690eb14078 Finish refactoring pkcs11eddsa_link.c after isc_buffer_allocate change.
Left over after c73e5866c4.

(cherry picked from commit 7744aece03)
2020-05-01 06:54:26 +02:00
Aaron Thompson
c8b85a191e Remove unreachable label in pkcs11eddsa_link.c.
Missed in ae83801e2b.

(cherry picked from commit b4a7bfd55e)
2020-05-01 06:54:26 +02:00
Aaron Thompson
f534519af5 Finish refactoring after the removal of --with-ecdsa and --with-eddsa.
Missed in c3b8130fe8.

(cherry picked from commit 7fc4f926fb)
2020-05-01 06:54:26 +02:00
Aaron Thompson
78e4cc96d7 Remove old comment.
Missed in 6aae193ded.

(cherry picked from commit 48e0c0bc4a)
2020-05-01 06:54:26 +02:00
Aaron Thompson
e1d846124c Finish replacing OP_EC with OP_ECDSA/OP_EDDSA.
Missed in c3b8130fe8.

(cherry picked from commit bb158e8a4c)
2020-05-01 06:54:26 +02:00
Aaron Thompson
866e5d05f2 Fix incorrect PKCS11 macro in dnssec-revoke.
Missed in c3b8130fe8.

(cherry picked from commit b217052081)
2020-05-01 06:54:26 +02:00
Mark Andrews
fa56081e47 Merge branch '1695-addzone-system-tests-failing-in-mac-os-x-v9_16' into 'v9_16'
Resolve "addzone system tests failing in Mac OS X"

See merge request isc-projects/bind9!3469
2020-04-30 23:56:09 +00:00
Mark Andrews
5813998c69 Add CHANGES entry
(cherry picked from commit d63479a48d)
2020-05-01 09:14:36 +10:00
Mark Andrews
dafabb6d13 Mimic nzf_append from bin/named/server.c
nzf_append is conditionally compiled and this is intended to
catch error introduced by changes to the called functions on all
systems before the changes are run through the CI.

(cherry picked from commit a66c6fc883)
2020-05-01 09:14:02 +10:00
Mark Andrews
ce7e96f26f Add jobs for 'configure --with{out}-lmdb' to the GitLab CI
We missed a case where LMDB was not installed/used in the build
and that broke system tests on such systems.

(cherry picked from commit 060b56dc70)
2020-05-01 09:14:02 +10:00
Mark Andrews
f78f58312c Add more special zones to addzone restart test.
Test zones with various escape sequences and filesystem seperator
characters.
* escaped double quote (\")
* escaped escape (\\)
* escaped decimal byte value (\032)
* slash seperator (/)

(cherry picked from commit 5ab9b5b1e6)
2020-05-01 09:13:59 +10:00
Mark Andrews
59c135ca4d Escape double quote when printing quoted string.
When we were printing quoted string, the double quotes where unescaped
leading to prematurely ending the quoted string.

(cherry picked from commit b02081d423)
2020-05-01 09:12:05 +10:00
Mark Andrews
d8078d4e95 Merge branch '1806-system-and-unit-clang-asan-have-incorrect-needs-v9_16' into 'v9_16'
Incorrect job in needs, gcc:asan -> clang:asan

See merge request isc-projects/bind9!3462
2020-04-30 08:50:31 +00:00
Mark Andrews
a8d0f49420 Incorrect job in needs, gcc:asan -> clang:asan
(cherry picked from commit 0adf9562fb)
2020-04-30 18:48:46 +10:00
Mark Andrews
5d978fded4 Merge branch '1804-util-parse_tsan-py-is-not-pylint-clean-v9_16' into 'v9_16'
pylint cleanups

See merge request isc-projects/bind9!3459
2020-04-30 08:43:58 +00:00
Mark Andrews
8578ea9c8a pylint cleanups
(cherry picked from commit d7618f6954)
2020-04-30 17:33:38 +10:00
Ondřej Surý
042f0e0d9b Merge branch '1783-ax_check_compile_flag-fno-delete-null-pointer-checks-does-not-fail-for-clang-v9_16' into 'v9_16'
Force test for -fno-delete-null-pointer-checks to fail

See merge request isc-projects/bind9!3453
2020-04-29 16:33:31 +00:00
Mark Andrews
363ac686fd Force test for -fno-delete-null-pointer-checks to fail
(cherry picked from commit 82ab846f13)
2020-04-29 18:25:26 +02:00
Ondřej Surý
56997fe9da Merge branch 'ondrej/fix-asan-symbolizer-v9_16' into 'v9_16'
Fix the ASAN symbolizer

See merge request isc-projects/bind9!3451
2020-04-29 15:29:29 +00:00
Ondřej Surý
141598f3d3 Fix the ASAN symbolizer
(cherry picked from commit 96805e8c91)
2020-04-29 17:02:33 +02:00
Mark Andrews
d449ccc796 Merge branch '1764-build-9-16-2-release-make-depend-fatal-error-lib-dns-dnstap-pb-c-h-no-such-file-or-directory' into 'v9_16'
'make depend' failed

See merge request isc-projects/bind9!3398
2020-04-29 14:10:29 +00:00
Mark Andrews
72143febe7 check that 'make depend' does not fail 2020-04-30 00:09:48 +10:00
Mark Andrews
06fa0d7b4e address 'make depend' issues 2020-04-30 00:09:48 +10:00
Ondřej Surý
c0ae965c91 Merge branch '725-prepare-system-tests-for-pytest-v9_16' into 'v9_16'
Add a pytest runner to run.sh

See merge request isc-projects/bind9!3447
2020-04-29 12:40:40 +00:00
Ondřej Surý
f783e41af7 Silence the invalid-name errors from pylint 2020-04-29 12:19:40 +02:00
Ondřej Surý
a4f0281962 Add a pytest runner to run.sh
The system tests currently uses patchwork of shell scripts which doesn't
offer proper error handling.

This commit introduced option to write new tests in pytest framework
that also allows easier manipulation of DNS traffic (using dnspython),
native XML and JSON manipulation and proper error reporting.

(cherry picked from commit cf5105939c)
2020-04-29 12:00:15 +02:00
Ondřej Surý
56e1e6bc4c Merge branch '1090-fix-unable-to-set-effective-uid-to-0-v9_16' into 'v9_16'
Resolve "BIND 9.14: unable to set effective uid to 0"

See merge request isc-projects/bind9!3440
2020-04-28 16:40:13 +00:00
Ondřej Surý
d6275ff6ee Add release notes for GL #1042, #1090
(cherry picked from commit 60b608b65b)
2020-04-28 17:29:35 +02:00
Ondřej Surý
368a016ce0 Add CHANGES for #1042, #1090
(cherry picked from commit a0a5eab31c)
2020-04-28 17:29:35 +02:00
Mark Andrews
1254db80bb Propagate first_time to named_os_openfile in generate_session_key.
named_os_openfile was being called with switch_user set to true
unconditionally leading to log messages about being unable to
switch user identity from named when regenerating the key.

(cherry picked from commit 071bc29962)
2020-04-28 17:29:35 +02:00
Ondřej Surý
fe0eca7c20 Don't change effective uid when we already dropped privileges
When running on Linux and system capabilities are available, named will
drop the extra capabilities before loading the configuration.  This led
to spurious warnings from `seteuid()` because named already dropped
CAP_SETUID and CAP_GETUID capabilities.

The fix removes setting the effective uid/gid when capabilities are
available, and adds a check that we are running under the user we were
requested to run.

(cherry picked from commit 6c82e2af92)
2020-04-28 17:29:35 +02:00
Ondřej Surý
7e72b69661 Merge branch '1672-stop-leaking-external-headers-and-symbols-to-the-public-api-isc/hmac.h-v9_16' into 'v9_16'
Stop leaking OpenSSL types and defines in the isc/hmac.h

See merge request isc-projects/bind9!3439
2020-04-28 14:29:55 +00:00
Ondřej Surý
8717ce376b Stop leaking OpenSSL types and defines in the isc/hmac.h
The <isc/md.h> header directly included <openssl/hmac.h> header which
enforced all users of the libisc library to explicitly list the include
path to OpenSSL and link with -lcrypto.  By hiding the specific
implementation into the private namespace, we no longer enforce this.
In the long run, this might also allow us to switch cryptographic
library implementation without affecting the downstream users.

(cherry picked from commit 70100c664a)
2020-04-28 16:28:54 +02:00
Ondřej Surý
1d3749819e Merge branch '1672-stop-leaking-external-headers-and-symbols-to-the-public-api-isc/safe.h-v9_16' into 'v9_16'
Stop leaking OpenSSL types and defines in the isc/safe.h

See merge request isc-projects/bind9!3438
2020-04-28 14:28:24 +00:00
Ondřej Surý
5948a29463 Stop leaking OpenSSL types and defines in the isc/safe.h
The two "functions" that isc/safe.h declared before were actually simple
defines to matching OpenSSL functions.  The downside of the approach was
enforcing all users of the libisc library to explicitly list the include
path to OpenSSL and link with -lcrypto.  By hiding the specific
implementation into the private namespace changing the defines into
simple functions, we no longer enforce this.  In the long run, this
might also allow us to switch cryptographic library implementation
without affecting the downstream users.

(cherry picked from commit ab827ab5bf)
2020-04-28 16:27:39 +02:00
Ondřej Surý
80725efe18 Merge branch '1672-stop-leaking-external-headers-and-symbols-to-the-public-api-isc/md.h-v9_16' into 'v9_16'
Stop leaking OpenSSL types and defines in the isc/md.h

See merge request isc-projects/bind9!3437
2020-04-28 14:08:29 +00:00
Ondřej Surý
c22c8cb0e1 Stop leaking OpenSSL types and defines in the isc/md.h
The <isc/md.h> header directly included <openssl/evp.h> header which
enforced all users of the libisc library to explicitly list the include
path to OpenSSL and link with -lcrypto.  By hiding the specific
implementation into the private namespace, we no longer enforce this.
In the long run, this might also allow us to switch cryptographic
library implementation without affecting the downstream users.

While making the isc_md_type_t type opaque, the API using the data type
was changed to use the pointer to isc_md_type_t instead of using the
type directly.

(cherry picked from commit 4e114f8ed6)
2020-04-28 15:24:07 +02:00
Michal Nowak
d4b002cac7 Merge branch 'mnowak/1751-abi-check-does-not-know-which-source-is-older-newer-v9_16' into 'v9_16'
[v9_16] Ensure proper comparison order in "abi-check" jobs

See merge request isc-projects/bind9!3420
2020-04-23 07:43:11 +00:00
Michal Nowak
313518dd3d Ensure proper comparison order in "abi-check" jobs
Right before the release API version (LIBINTERFACE, LIBREVISION, LIBAGE)
for older and newer libraries tends to be the same. Given that, commit
hash can't be the determining factor here, Unix time of the commit
should suit us better and is placed after the API version. The commit
hash is preserved as it's useful to see it in the actual report.

(cherry picked from commit 8e3e2836b0)
2020-04-23 09:38:25 +02:00
Ondřej Surý
c8ac079529 Merge branch 'ondrej/make-merge_copyrights-ignore-hidden-files-v9_16' into 'v9_16'
Make merge_copyrights ignore hidden files

See merge request isc-projects/bind9!3418
2020-04-23 06:03:48 +00:00
Ondřej Surý
250d16b9c2 Make merge_copyrights ignore hidden files
(cherry picked from commit 6d46082d82)
2020-04-23 08:00:40 +02:00
Evan Hunt
2fba60af58 Merge branch '1779-lock-rpzs-v9_16' into 'v9_16'
acquire maintenance lock when running incremental RPZ updates

See merge request isc-projects/bind9!3412
2020-04-22 00:45:07 +00:00
Evan Hunt
11bdacfcf9 CHANGES
(cherry picked from commit 2cf3d4c700)
2020-04-21 17:24:36 -07:00
Evan Hunt
7622f8ccfb acquire maintenance lock when running incremental RPZ updates
this addresses a race that could occur during shutdown or when
reconfiguring to remove RPZ zones.

this change should ensure that the rpzs structure and the incremental
updates don't interfere with each other: rpzs->zones entries cannot
be set to NULL while an update quantum is running, and the
task should be destroyed and its queue purged so that no subsequent
quanta will run.

(cherry picked from commit 286e8cd7ea)
2020-04-21 17:24:09 -07:00
Ondřej Surý
8a955ea403 Merge branch 'ondrej/enable-quota-test-in-Kyuatest-v9_16' into 'v9_16'
Fix and enable quota_test in Kyuafile

See merge request isc-projects/bind9!3409
2020-04-21 13:34:54 +00:00
Witold Kręcicki
90fc717ca3 Fix detaching the extra quotas in the quota_test
(cherry picked from commit 62f738ba48)
2020-04-21 14:18:54 +02:00
Ondřej Surý
c3e26ebd26 Enable quota_test in Kyuafile
(cherry picked from commit 54defc8b78)
2020-04-21 14:18:54 +02:00
Mark Andrews
351a488cf0 Merge branch '1674-warn-bad-id-in-axfr' into 'v9_16'
Warn about AXFR stream with inconsistent message id (9.16 and earlier)

See merge request isc-projects/bind9!3381
2020-04-20 09:53:57 +00:00
Mark Andrews
06e53c9e14 Check that bad message id's are caught by named 2020-04-20 19:13:48 +10:00
Mark Andrews
9937116f21 Convert to using retry_quiet and nextpart 2020-04-20 19:13:47 +10:00
Mark Andrews
998b2d5a57 Warn about AXFR streams that are incompatible with BIND 9.18 2020-04-20 19:13:47 +10:00
Matthijs Mekking
b0d5c23275 Merge branch '1737-coverity-dst_key_gettime-v9_16' into 'v9_16'
Address Coverity warnings in keymgr.c

See merge request isc-projects/bind9!3403
2020-04-20 08:10:34 +00:00
Matthijs Mekking
7ac4966a7a Address Coverity warnings in keymgr.c
Coverity showed that the return value of `dst_key_gettime` was
unchecked in INITIALIZE_STATE. If DST_TIME_CREATED was not set we
would set the state to be initialized to a weird last changed time.

This would normally not happen because DST_TIME_CREATED is always
set. However, we would rather set the time to now (as the comment
also indicates) not match the creation time.

The comment on INITIALIZE_STATE also needs updating as we no
longer always initialize to HIDDEN.

(cherry picked from commit 564f9dca35)
2020-04-20 09:43:23 +02:00
Michał Kępień
844cb55109 Merge branch '1753-make-isc-rwlock-implementation-the-default-again-v9_16' into 'v9_16'
[v9_16] Make ISC rwlock implementation the default again

See merge request isc-projects/bind9!3399
2020-04-17 06:41:37 +00:00
Michał Kępień
3763967607 Add CHANGES entry
5385.	[func]		Make ISC rwlock implementation the default again.
			[GL #1753]

(cherry picked from commit 58daa5af1e)
2020-04-17 08:40:24 +02:00
Michał Kępień
09720319a3 Add a release note
(cherry picked from commit 0cf1e2bf62)
2020-04-17 08:40:22 +02:00
Michał Kępień
76f0db42ec Make ISC rwlock implementation the default again
Revert the change from ad03c22e97 as
further testing has shown that with hyper-threading disabled, named with
ISC rwlocks outperforms named with pthread rwlocks in cold cache testing
scenarios.  Since building named with pthread rwlocks might still be a
better choice for some workloads, keep the compile-time option which
enables that.

(cherry picked from commit 17101fd093)
2020-04-17 08:39:34 +02:00
Michał Kępień
4bf68a6b21 Merge branch '1765-create-empty-release-notes-for-9-16-3' into 'v9_16'
create empty release notes for 9.16.3

See merge request isc-projects/bind9!3396
2020-04-17 06:31:10 +00:00
Mark Andrews
8d04b6b93a Add empty release notes for BIND 9.16.3 2020-04-17 10:23:50 +10:00
Michał Kępień
5f8fc7a934 Merge branch 'mnowak/abi-tracker-helper-v9_16_2' into 'v9_16'
abi-check: Update BIND_BASELINE_VERSION to v9_16_2

See merge request isc-projects/bind9!3385
2020-04-16 21:22:28 +00:00
Michal Nowak
035c632a7a abi-check: Update BIND_BASELINE_VERSION to v9_16_2 2020-04-16 21:22:06 +00:00
Michał Kępień
58175cdb4f Merge branch 'v9_16_2-release' into 'v9_16'
Merge 9.16.2 release branch

See merge request isc-projects/bind9!3393
2020-04-16 21:08:52 +00:00
Tinderbox User
f4e6b61b0f regen v9_16 2020-04-16 23:07:41 +02:00
Tinderbox User
152ff84f79 prep 9.16.2 2020-04-16 23:07:40 +02:00
Matthijs Mekking
fad5998fc9 Merge branch '1709-dnssec-policy-inlinesigning-v9_16' into 'v9_16'
Resolve "dnssec-policy implicitly enables inline-signing"

See merge request isc-projects/bind9!3389
2020-04-16 14:56:53 +00:00
Matthijs Mekking
a538ae2e1a Update changes
(cherry picked from commit acae6cf438)
2020-04-16 16:04:28 +02:00
Matthijs Mekking
75c330379c Add kasp tests dyn update zone
Add two tests that checks that dynamic zones
can be updated and will be signed appropriately.
One zone covers an update with freeze/thaw, the
other covers an update through nsupdate.

(cherry picked from commit e3aa12fc0a)
2020-04-16 16:04:28 +02:00
Matthijs Mekking
6e3654c434 dnssec-policy: to sign inline or not
When dnssec-policy was introduced, it implicitly set inline-signing.
But DNSSEC maintenance required either inline-signing to be enabled,
or a dynamic zone.  In other words, not in all cases you want to
DNSSEC maintain your zone with inline-signing.

Change the behavior and determine whether inline-signing is
required: if the zone is dynamic, don't use inline-signing,
otherwise implicitly set it.

You can also explicitly set inline-signing to yes with dnssec-policy,
the restriction that both inline-signing and dnssec-policy cannot
be set at the same time is now lifted.

However, 'inline-signing no;' on a non-dynamic zone with a
dnssec-policy is not possible.

(cherry picked from commit 644f0d958a)
2020-04-16 16:04:28 +02:00
Ondřej Surý
5d50f27bbe Merge branch '1763-improve-isc_buffer-API-documentation-v9_16' into 'v9_16'
Fix/improve some comments in buffer.h.

See merge request isc-projects/bind9!3390
2020-04-16 13:58:58 +00:00
Aaron Thompson
99f800df0d Fix/improve some comments in buffer.h.
isc_buffer_dup now cannot fail as a result of c73e5866c4.

(cherry picked from commit 850d8ae019)
2020-04-16 15:58:25 +02:00
Matthijs Mekking
ddbcf75c9c Merge branch 'matthijs-dnssec-keys-trust-anchors-leftovers-v9_16' into 'v9_16'
Replace leftover DNSSEC-KEYS with TRUST-ANCHORS - 9.16

See merge request isc-projects/bind9!3376
2020-04-16 13:08:40 +00:00
Matthijs Mekking
728112d70c Replace leftover DNSSEC-KEYS with TRUST-ANCHORS
Change 5332 renamed "dnssec-keys" configuration statement to the
more descriptive "trust-anchors".  Not all occurrences in the
documentation had been updated.

(cherry picked from commit 7c6dde024155585008e9bfd09c03722d69211d02)
2020-04-16 14:08:04 +02:00
Matthijs Mekking
4c87ea09c3 Merge branch 'matthijs-fix-digdelv-yamlget-v9_16' into 'v9_16'
Fix digdelv test - 9.16

See merge request isc-projects/bind9!3387
2020-04-16 12:06:14 +00:00
Matthijs Mekking
f980c888a5 Fix digdelv test
The yamlget.py file was changed in !3311 as part of making the
python code pylint and flake8 compliant.  This omitted setting
'item' to 'item[key]' which caused the digdelv yaml tests to fail.

Also, the pretty printing is not really necessary, so remove
the "if key not in item; print error" logic.

(cherry picked from commit 464d0417d1)
2020-04-16 13:28:54 +02:00
Ondřej Surý
e925880741 Merge branch '1755-tune-the-windows-build-so-we-can-use-wx-equivalent-of-werror-v9_16' into 'v9_16'
Resolve "Tune the Windows build, so we can use /WX (equivalent of -Werror)"

See merge request isc-projects/bind9!3378
2020-04-16 06:18:33 +00:00
Ondřej Surý
fd9237e18e Don't escape spaces in CONFIGARGS, use double backslash with all whitespace
(cherry picked from commit 9b0e85cbd5)
2020-04-16 07:56:38 +02:00
Ondřej Surý
7d87d88811 Align the irs_getnameinfo() declaration and definition on Windows
(cherry picked from commit e3076c4caa)
2020-04-16 07:56:38 +02:00
Ondřej Surý
8b84fb4f42 Disable MSB8028 warning
All our MSVS Project files share the same intermediate directory.  We
know that this doesn't cause any problems, so we can just disable the
detection in the project files.

Example of the warning:

  warning MSB8028: The intermediate directory (.\Release\) contains files shared from another project (dnssectool.vcxproj).  This can lead to incorrect clean and rebuild behavior.

(cherry picked from commit b6c2012d93)
2020-04-16 07:56:38 +02:00
Ondřej Surý
fd5167dd70 Fix the discrepancy between cfg_pluginlist_foreach declaration and definition
There was a missing indirection for the pluginlist_cb_t *callback in the
declaration of the cfg_pluginlist_foreach function.  Reported by MSVC as:

  lib\isccfg\parser.c(4057): warning C4028: formal parameter 4 different from declaration

(cherry picked from commit 4ffe725585)
2020-04-16 07:56:38 +02:00
Ondřej Surý
54f72ca7b6 Workaround MSVC warning C4477
Due to a way the stdatomic.h shim is implemented on Windows, the MSVC
always things that the outside type is the largest - atomic_(u)int_fast64_t.
This can lead to false positives as this one:

  lib\dns\adb.c(3678): warning C4477: 'fprintf' : format string '%u' requires an argument of type 'unsigned int', but variadic argument 2 has type 'unsigned __int64'

We workaround the issue by loading the value in a scoped local variable
with correct type first.

(cherry picked from commit 60c632ab91)
2020-04-16 07:56:37 +02:00
Ondřej Surý
d7948f9c8c Disable C4090 MSVC warning
MSVC documentation states: "This warning can be caused when a pointer to
a const or volatile item is assigned to a pointer not declared as
pointing to const or volatile."

Unfortunately, this happens when we dynamically allocate and deallocate
block of atomic variables using isc_mem_get and isc_mem_put.

Couple of examples:

  lib\isc\hp.c(134): warning C4090: 'function': different 'volatile' qualifiers [C:\builds\isc-projects\bind9\lib\isc\win32\libisc.vcxproj]
  lib\isc\hp.c(144): warning C4090: 'function': different 'volatile' qualifiers [C:\builds\isc-projects\bind9\lib\isc\win32\libisc.vcxproj]
  lib\isc\stats.c(55): warning C4090: 'function': different 'volatile' qualifiers [C:\builds\isc-projects\bind9\lib\isc\win32\libisc.vcxproj]
  lib\isc\stats.c(87): warning C4090: 'function': different 'volatile' qualifiers [C:\builds\isc-projects\bind9\lib\isc\win32\libisc.vcxproj]

(cherry picked from commit 063e05491b)
2020-04-16 07:56:37 +02:00
Ondřej Surý
c70159e792 Fix invalid cast in win32 stdatomic.h shim
The InterlockedOr8() and InterlockedAnd8() first argument was cast
to (atomic_int_fast8_t) instead of (atomic_int_fast8_t *), this was
reported by MSVC as:

  warning C4024: '_InterlockedOr8': different types for formal and actual parameter 1
  warning C4024: '_InterlockedAnd8': different types for formal and actual parameter 1

(cherry picked from commit 54168d55c0)
2020-04-16 07:56:37 +02:00
Ondřej Surý
9e6e1f587a Remove the Windows build job dependency on autoreconf job
(cherry picked from commit 70318943fe)
2020-04-16 07:56:37 +02:00
Ondřej Surý
8aef53cdb2 Disable MSVC C4133 when using stdatomic.h win32 shim
(cherry picked from commit b1f66d1e13)
2020-04-16 07:56:37 +02:00
Ondřej Surý
beee2a6598 Don't return from void function
(cherry picked from commit 948a23e6bb)
2020-04-16 07:55:40 +02:00
Ondřej Surý
820b9ba38a Set WarningLevel to Level1 for Release, treat warnings as errors
Our vcxproj files set the WarningLevel to Level3, which is too verbose
for a code that needs to be portable.  That basically leads to ignoring
all the errors that MSVC produces.  This commits downgrades the
WarningLevel to Level1 and enables treating warnings as errors for
Release builds.  For the Debug builds the WarningLevel got upgraded to
Level4, and treating warnings as errors is explicitly disabled.

We should eventually make the code clean of all MSVC warnings, but it's
a long way to go for Level4, so it's more reasonable to start at Level1.

For reference[1], these are the warning levels as described by MSVC
documentation:

  * /W0 suppresses all warnings. It's equivalent to /w.
  * /W1 displays level 1 (severe) warnings. /W1 is the default setting
    in the command-line compiler.
  * /W2 displays level 1 and level 2 (significant) warnings.
  * /W3 displays level 1, level 2, and level 3 (production quality)
    warnings. /W3 is the default setting in the IDE.
  * /W4 displays level 1, level 2, and level 3 warnings, and all level 4
    (informational) warnings that aren't off by default. We recommend
    that you use this option to provide lint-like warnings. For a new
    project, it may be best to use /W4 in all compilations. This option
    helps ensure the fewest possible hard-to-find code defects.
  * /Wall displays all warnings displayed by /W4 and all other warnings
    that /W4 doesn't include — for example, warnings that are off by
    default.
  * /WX treats all compiler warnings as errors. For a new project, it
    may be best to use /WX in all compilations; resolving all warnings
    ensures the fewest possible hard-to-find code defects.

1. https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=vs-2019

(cherry picked from commit 789d253e3d)
2020-04-16 07:55:40 +02:00
Michał Kępień
aab746701e Merge branch 'michal/fix-srcid-on-windows-v9_16' into 'v9_16'
[v9_16] Fix "srcid" on Windows

See merge request isc-projects/bind9!3371
2020-04-15 09:42:13 +00:00
Michał Kępień
021b83059e Fix "srcid" on Windows
Windows BIND releases produced by GitLab CI are built from Git
repositories, not from release tarballs, which means the "srcid" file is
not present in the top source directory when MSBuild is invoked.  This
causes the Git commit hash for such builds to be set to "unset_id".
Enable win32utils/Configure to try determining the commit hash for a
build by invoking Git on the build host if the "srcid" file is not
present (which is what its Unix counterpart does).

(cherry picked from commit 05e13e7caf)
2020-04-15 11:39:45 +02:00
Ondřej Surý
b0ca52f211 Merge branch 'ondrej/add-missing-time.h-on-win32-v9_16' into 'v9_16'
Add missing time.h header in windows isc/time.h for missing prototypes

See merge request isc-projects/bind9!3370
2020-04-15 08:43:45 +00:00
Ondřej Surý
ff967f9d65 Add missing time.h header in windows isc/time.h for missing prototypes
The win32 isc/time.h was missing <time.h> header leading to:

    lib\isc\win32\include\isc\time.h(29): warning C4013: 'gmtime_s'
    undefined; assuming extern returning int (compiling source file
    ..\app.c) [lib\isc\win32\libisc.vcxproj]

    lib\isc\win32\include\isc\time.h(39): warning C4013: 'localtime_s'
    undefined; assuming extern returning int (compiling source file
    ..\app.c) [lib\isc\win32\libisc.vcxproj]

(cherry picked from commit b9f68d098b)
2020-04-15 10:18:42 +02:00
Ondřej Surý
58201570c1 Merge branch 'ondrej/add-python-static-analysis-to-gitlab-ci-v9_16' into 'v9_16'
Add python static analysis to GitLab CI (v9.16)

See merge request isc-projects/bind9!3366
2020-04-15 07:48:01 +00:00
Ondřej Surý
4c4af11e5b Make the python code pylint and flake8 compliant
(cherry picked from commit 1e4ff9d485)
2020-04-15 07:43:35 +02:00
Ondřej Surý
4586a10327 Add pylint and flake8 tests to GitLab CI
Our python code didn't adhere to any coding standard.  In this commit, we add
flame8 (https://pypi.org/project/flake8/), and pylint (https://www.pylint.org/).

There's couple of exceptions:

- ans.py scripts are not checked, nor fixed as part of this MR
- pylint's missing-*-docstring and duplicate-code checks have
  been disabled via .pylintrc

Both exceptions should be removed in due time.

(cherry picked from commit ee534592e3)
2020-04-15 07:43:35 +02:00
Michał Kępień
e69c9b7fb9 Merge branch 'michal/misc-doc-fixes-v9_16' into 'v9_16'
[v9_16] Miscellaneous documentation fixes

See merge request isc-projects/bind9!3361
2020-04-09 05:50:04 +00:00
Stephen Morris
2b79ffb29c Tweak release notes for BIND 9.16.2 2020-04-08 22:49:00 +02:00
Michał Kępień
aeb1eb20e8 Tweak CHANGES for BIND 9.16.2 2020-04-08 22:49:00 +02:00
Ondřej Surý
2c0adf7e5a Merge branch 'bug/master/libisc-link-v9_16' into 'v9_16'
Link all required libraries to libisc

See merge request isc-projects/bind9!3360
2020-04-08 15:13:10 +00:00
Petr Menšík
ad79e7c080 Link all required libraries to libisc
It would fail to link -lisc without additional libraries, which should
not be required.

(cherry picked from commit 4cc7d2412f)
2020-04-08 17:03:27 +02:00
Ondřej Surý
e11d690ae7 Merge branch 'ondrej/changes-notes-v9_16-v9_16' into 'v9_16'
Add missing CHANGES notes from v9_16 branch

See merge request isc-projects/bind9!3358
2020-04-08 13:18:11 +00:00
Ondřej Surý
cb100ed530 Add missing CHANGES notes from v9_16 branch
(cherry picked from commit 2ef1149519)
2020-04-08 15:11:07 +02:00
Ondřej Surý
d42318d1ef Merge branch 'ondrej/missing-changes-v9_11-v9_16' into 'v9_16'
Add missing CHANGES notes from v9_11 branch

See merge request isc-projects/bind9!3353
2020-04-08 12:47:49 +00:00
Ondřej Surý
9777aab8ce Add missing CHANGES notes from v9_11 branch
(cherry picked from commit 434929b53d)
2020-04-08 14:46:07 +02:00
Michał Kępień
cc19294ac3 Merge branch '1742-work-around-an-msvc-bug-v9_16' into 'v9_16'
[v9_16] Work around an MSVC bug

See merge request isc-projects/bind9!3351
2020-04-08 12:30:18 +00:00
Michał Kępień
5b32f7362c Work around an MSVC bug
The assembly code generated by MSVC for at least some signed comparisons
involving atomic variables incorrectly uses unsigned conditional jumps
instead of signed ones.  In particular, the checks in isc_log_wouldlog()
are affected in a way which breaks logging on Windows and thus also all
system tests involving a named instance.  Work around the issue by
assigning the values returned by atomic_load_acquire() calls in
isc_log_wouldlog() to local variables before performing comparisons.

(cherry picked from commit 4c4f5cccaa)
2020-04-08 14:29:22 +02:00
Matthijs Mekking
83dcb7417b Merge branch '1669-kasp-test-fails-on-windows-v9_16' into 'v9_16'
Resolve ""kasp" system test is failing consistently on Windows"

See merge request isc-projects/bind9!3340
2020-04-08 08:44:56 +00:00
Matthijs Mekking
0d050323c0 Increase migrate.kasp DNSKEY TTL
Increate the DNSKEY TTL of the migrate.kasp zone for the following
reason:  The key states are initialized depending on the timing
metadata. If a key is present long enough in the zone it will be
initialized to OMNIPRESENT.  Long enough here is the time when it
was published (when the setup script was run) plus DNSKEY TTL.
Otherwise it is set to RUMOURED, or to HIDDEN if no timing metadata
is set or the time is still in the future.

Since the TTL is "only" 5 minutes, the DNSKEY state may be
initialized to OMNIPRESENT if the test is slow, but we expect it
to be in RUMOURED state.  If we increase the TTL to a couple of
hours it is very unlikely that it will be initialized to something
else than RUMOURED.

(cherry picked from commit 04e6711029)
2020-04-08 09:47:36 +02:00
Matthijs Mekking
02a2de8adb Fix ns6 template zonefile
The template zone file for server ns6 should have the ns6 domain
name, not ns3.

(cherry picked from commit 8d3c0156f4)
2020-04-08 09:47:36 +02:00
Matthijs Mekking
c923532b77 Remove kasp Windows prereq check
Now that the timing issue is fixed, we can enable the kasp test
again on Windows.

(cherry picked from commit 87c05fa62f)
2020-04-08 09:47:36 +02:00
Matthijs Mekking
9b57ad68d4 Fix kasp timing issue on Windows
This fixes another intermittent failure in the kasp system test.
It does not happen often, except for in the Windows platform tests
where it takes a long time to run the tests.

In the "kasp" system test, there is an "rndc reconfig" call which
triggers a new rekey event.  check_next_key_event() verifies the time
remaining from the moment "rndc reconfig" is called until the next key
event.  However, the next key event time is calculated from the key
times provided during key creation (i.e. during test setup).  Given
this, if "rndc reconfig" is called a significant amount of time after
the test is started, some check_next_key_event() checks will fail.

Fix by calculating the time passed since the start of the test and
when 'rndc reconfig' happens.  Substract this time from the
calculated next key event.

This only needs to be done after an "rndc reconfig" on zones where
the keymgr needs to wait for a period of time (for example for keys
to become OMNIPRESENT, or HIDDEN). This is on step 2 and step 5 of
the algorithm rollover.  In step 2 there is a waiting period before
the DNSKEY is OMNIPRESENT, in step 5 there is a waiting period
before the DNSKEY is HIDDEN.

In step 1 new keys are created, in step 3 and 4 key states just
entered OMNIPRESENT, and in step 6 we no longer care because the
key lifetime is unlimited and we default to checking once per hour.

Regardless of our indifference about the next key event after step 6,
change some of the key timings in the setup script to better
reflect reality: DNSKEY is in HIDDEN after step 5, DS times have
changed when the new DS became active.

(cherry picked from commit 62a97570b8)
2020-04-08 09:47:32 +02:00
Ondřej Surý
81259f8c18 Merge branch '1574-confidential-issue-rebinding-protection-fail-in-forwarding-mode-v9_16' into 'v9_16'
Resolve "DNS rebinding protection is ineffective when BIND is configured as a forwarding DNS server"

See merge request isc-projects/bind9!3343
2020-04-08 07:44:52 +00:00
Ondřej Surý
48110357ac Add release notes 2020-04-08 09:43:41 +02:00
Ondřej Surý
d092db3465 Add CHANGES 2020-04-08 09:43:41 +02:00
Diego Fronza
2cba24a6d5 Add test for the proposed fix
This test asserts that option "deny-answer-aliases" works correctly
when forwarding requests.

As a matter of example, the behavior expected for a forwarder BIND
instance, having an option such as deny-answer-aliases { "domain"; }
is that when forwarding a request for *.anything-but-domain, it is
expected that it will return SERVFAIL if any answer received has a CNAME
for "*.domain".

(cherry picked from commit 9bdb960a16a69997b08746e698b6b02c8dc6c795)
2020-04-08 08:52:58 +02:00
Diego Fronza
bba353d512 Fixed rebinding protection bug when using forwarder setups
BIND wasn't honoring option "deny-answer-aliases" when configured to
forward queries.

Before the fix it was possible for nameservers listed in "forwarders"
option to return CNAME answers pointing to unrelated domains of the
original query, which could be used as a vector for rebinding attacks.

The fix ensures that BIND apply filters even if configured as a forwarder
instance.

(cherry picked from commit af6a4de3d5ad6c1967173facf366e6c86b3ffc28)
2020-04-08 08:52:58 +02:00
Mark Andrews
e12ea4f4db Merge branch '1715-kasp-system-test-timing-issue-with-view-zones-2-v9_16' into 'v9_16'
Wait for zone to be signed

See merge request isc-projects/bind9!3338
2020-04-06 10:09:14 +00:00
Mark Andrews
f0d44c49c9 Wait for zone to be signed
(cherry picked from commit 78746cfabd)
2020-04-06 19:33:03 +10:00
Mark Andrews
8b2af5a1c9 Merge branch '1715-kasp-system-test-timing-issue-with-view-zones-v9_16' into 'v9_16'
Wait for DNSKEY records to be signed

See merge request isc-projects/bind9!3336
2020-04-06 09:31:11 +00:00
Mark Andrews
78b748b109 Wait for DNSKEY records to be signed
(cherry picked from commit 5a4ab3360d)
2020-04-06 19:01:25 +10:00
Ondřej Surý
5370e73340 Merge branch '1087-fix-the-nonmatching-statcounter-increments-decrements-v9_16' into 'v9_16'
Fix the some of the underflowing statistics (v9.16)

See merge request isc-projects/bind9!3332
2020-04-04 05:25:23 +00:00
Ondřej Surý
dfe202e29b Add CHANGES
(cherry picked from commit 22aaeb5150)
2020-04-03 20:22:56 +02:00
Ondřej Surý
cacaa94350 Fix the statistic counter underflow in ns_client_t
In case of normal fetch, the .recursionquota is attached and
ns_statscounter_recursclients is incremented when the fetch is created.  Then
the .recursionquota is detached and the counter decremented in the
fetch_callback().

In case of prefetch or rpzfetch, the quota is attached, but the counter is not
incremented.  When we reach the soft-quota, the function returns early but don't
detach from the quota, and it gets destroyed during the ns_client_endrequest(),
so no memory was leaked.

But because the ns_statscounter_recursclients is only incremented during the
normal fetch the counter would be incorrectly decremented on two occassions:

1) When we reached the softquota, because the quota was not properly detached
2) When the prefetch or rpzfetch was cancelled mid-flight and the callback
   function was never called.

(cherry picked from commit 78886d4bed)
2020-04-03 20:22:56 +02:00
Ondřej Surý
0e9b0d79fb Remove the extra decstats on STATID_ACTIVE for children sockets
(cherry picked from commit 26842ac25c)
2020-04-03 20:22:56 +02:00
Witold Kręcicki
3559b32dcc Fix the memory ordering for the isc stats to be acquire-release
(cherry picked from commit 4ffd4cd4f6)
2020-04-03 20:22:55 +02:00
Witold Krecicki
27be7a8bd1 Merge branch 'wpk/tcpdns-refactoring-v9_16' into 'v9_16'
netmgr refactoring: use generic functions when operating on sockets.

See merge request isc-projects/bind9!3331
2020-04-03 12:21:20 +00:00
Witold Kręcicki
365636dbc9 netmgr refactoring: use generic functions when operating on sockets.
tcpdns used transport-specific functions to operate on the outer socket.
Use generic ones instead, and select the proper call in netmgr.c.
Make the missing functions (e.g. isc_nm_read) generic and add type-specific
calls (isc__nm_tcp_read). This is the preparation for netmgr TLS layer.

(cherry picked from commit 5fedd21e16)
2020-04-03 13:44:28 +02:00
Matthijs Mekking
949846399d Merge branch '1179-dnssec-stats-oom-kill-v9_16' into 'v9_16'
Resolve "OOM issue after upgrade from 9.14.3 to 9.14.4"

See merge request isc-projects/bind9!3329
2020-04-03 08:33:28 +00:00
Matthijs Mekking
ed2d3c55c2 Update release notes
(cherry picked from commit 386890a161)
2020-04-03 10:04:32 +02:00
Matthijs Mekking
df16e24d66 Replace hard coded value with constant
(cherry picked from commit c1723b2535)
2020-04-03 10:04:24 +02:00
Matthijs Mekking
f46187bcaa Merge if blocks in statschannel.c
(cherry picked from commit 1596d3b498)
2020-04-03 10:04:16 +02:00
Matthijs Mekking
ae19d0f60a Replace sign operation bool with enum
(cherry picked from commit 44b49955e1)
2020-04-03 10:04:07 +02:00
Matthijs Mekking
c3d738c883 Embed algorithm in key tag counter
Key tags are not unique across algorithms.

(cherry picked from commit b2028e26da)
2020-04-03 10:03:58 +02:00
Matthijs Mekking
facd99fd9c Group the keyid with the counters
Rather than group key ids together, group key id with its
corresponding counters. This should make growing / shrinking easier
than having keyids then counters.

(cherry picked from commit eb6a8b47d7)
2020-04-03 10:03:49 +02:00
Matthijs Mekking
e67490cadb Add test for many keys
Add a statschannel test case for DNSSEC sign metrics that has more
keys than there are allocated stats counters for.  This will produce
gibberish, but at least it should not crash.

(cherry picked from commit 31e8b2b13c)
2020-04-03 10:03:39 +02:00
Matthijs Mekking
f59f446122 Redesign dnssec sign statistics
The first attempt to add DNSSEC sign statistics was naive: for each
zone we allocated 64K counters, twice.  In reality each zone has at
most four keys, so the new approach only has room for four keys per
zone. If after a rollover more keys have signed the zone, existing
keys are rotated out.

The DNSSEC sign statistics has three counters per key, so twelve
counters per zone. First counter is actually a key id, so it is
clear what key contributed to the metrics.  The second counter
tracks the number of generated signatures, and the third tracks
how many of those are refreshes.

This means that in the zone structure we no longer need two separate
references to DNSSEC sign metrics: both the resign and refresh stats
are kept in a single dns_stats structure.

Incrementing dnssecsignstats:

Whenever a dnssecsignstat is incremented, we look up the key id
to see if we already are counting metrics for this key.  If so,
we update the corresponding operation counter (resign or
refresh).

If the key is new, store the value in a new counter and increment
corresponding counter.

If all slots are full, we rotate the keys and overwrite the last
slot with the new key.

Dumping dnssecsignstats:

Dumping dnssecsignstats is no longer a simple wrapper around
isc_stats_dump, but uses the same principle.  The difference is that
rather than dumping the index (key tag) and counter, we have to look
up the corresponding counter.

(cherry picked from commit 705810d577)
2020-04-03 10:03:30 +02:00
Ondřej Surý
86933f4a27 Merge branch '1717-rwlock-contention-in-isc_log_wouldlog-api-performance-impact-v9_16' into 'v9_16'
Reduce rwlock contention in isc_log_wouldlog()

See merge request isc-projects/bind9!3327
2020-04-03 08:00:39 +00:00
Ondřej Surý
aec1578620 Reduce rwlock contention in isc_log_wouldlog()
The rwlock introduced to protect the .logconfig member of isc_log_t
structure caused a significant performance drop because of the rwlock
contention.  It was also found, that the debug_level member of said
structure was not protected from concurrent read/writes.

The .dynamic and .highest_level members of isc_logconfig_t structure
were actually just cached values pulled from the assigned channels.

We introduced an even higher cache level for .dynamic and .highest_level
members directly into the isc_log_t structure, so we don't have to
access the .logconfig member in the isc_log_wouldlog() function.

(cherry picked from commit 3a24eacbb6)
2020-04-03 07:59:34 +00:00
Matthijs Mekking
96660671e2 Merge branch '1706-dnssec-policy-migration-v9_16' into 'v9_16'
Resolve "Changing from auto-dnssec maintain to dnssec-policy x immediately deletes existing keys"

See merge request isc-projects/bind9!3328
2020-04-03 07:59:04 +00:00
Matthijs Mekking
3726d7f857 Test migration to dnssec-policy, change algorithm
Add a test to ensure migration from 'auto-dnssec maintain;' to
dnssec-policy works even if the algorithm is changed.  The existing
keys should not be removed immediately, but their goal should be
changed to become hidden, and the new keys with the different
algorithm should be introduced immediately.

(cherry picked from commit 551acb44f4)
2020-04-03 09:17:06 +02:00
Matthijs Mekking
9387729711 Only initialize goal on active keys
If we initialize goals on all keys, superfluous keys that match
the policy all desire to be active.  For example, there are six
keys available for a policy that needs just two, we only want to
set the goal state to OMNIPRESENT on two keys, not six.

(cherry picked from commit 2389fcb4dc)
2020-04-03 09:16:51 +02:00
Matthijs Mekking
1553411d43 Update documentation with !1706 fix
(cherry picked from commit f47e697da3)
2020-04-03 09:16:25 +02:00
Matthijs Mekking
4741f2d07e Test migration to dnssec-policy, retire old keys
Migrating from 'auto-dnssec maintain;' to dnssec-policy did not
work properly, mainly because the legacy keys were initialized
badly.  Earlier commit deals with migration where existing keys
match the policy.  This commit deals with migration where existing
keys do not match the policy.  In that case, named must not
immediately delete the existing keys, but gracefully roll to the
dnssec-policy.

However, named did remove the existing keys immediately.  This is
because the legacy key states were initialized badly.  Because
those keys had their states initialized to HIDDEN or RUMOURED, the
keymgr decides that they can be removed (because only when the key
has its states in OMNIPRESENT it can be used safely).

The original thought to initialize key states to HIDDEN (and
RUMOURED to deal with existing keys) was to ensure that those keys
will go through the required propagation time before the keymgr
decides they can be used safely.  However, those keys are already
in the zone for a long time and making the key states represent
otherwise is dangerous: keys may be pulled out of the zone while
in fact they are required to establish the chain of trust.

Fix initializing key states for existing keys by looking more closely
at the time metadata.  Add TTL and propagation delays to the time
metadata and see if the DNSSEC records have been propagated.
Initialize the state to OMNIPRESENT if so, otherwise initialize to
RUMOURED.  If the time metadata is in the future, or does not exist,
keep initializing the state to HIDDEN.

The added test makes sure that new keys matching the policy are
introduced, but existing keys are kept in the zone until the new
keys have been propagated.

(cherry picked from commit 7f43520893)
2020-04-03 09:16:11 +02:00
Matthijs Mekking
83a00866b0 Tweak kasp system test
A few kasp system test tweaks to improve test failure debugging and
deal with tests related to migration to dnssec-policy.

1. When clearing a key, set lifetime to "none".  If "none", skip
   expect no lifetime set in the state file.  Legacy keys that
   are migrated but don't match the dnssec-policy will not have a
   lifetime.

2. The kasp system test prints which key id and file it is checking.
   Log explicitly if we are checking the id or a file.

3. Add quotes around "ID" when setting the key id, for consistency.

4. Fix a typo (non -> none).

5. Print which key ids are found, this way it is easier to see what
   KEY[1-4] failed to match one of the key files.

(cherry picked from commit a224754d59)
2020-04-03 09:15:51 +02:00
Matthijs Mekking
7aa5a11bdd Fix and test migration to dnssec-policy
Migrating from 'auto-dnssec maintain;' to dnssec-policy did not
work properly, mainly because the legacy keys were initialized
badly. Several adjustments in the keymgr are required to get it right:

- Set published time on keys when we calculate prepublication time.
  This is not strictly necessary, but it is weird to have an active
  key without the published time set.

- Initalize key states also before matching keys. Determine the
  target state by looking at existing time metadata: If the time
  data is set and is in the past, it is a hint that the key and
  its corresponding records have been published in the zone already,
  and the state is initialized to RUMOURED. Otherwise, initialize it
  as HIDDEN. This fixes migration to dnssec-policy from existing
  keys.

- Initialize key goal on keys that match key policy to OMNIPRESENT.
  These may be existing legacy keys that are being migrated.

- A key that has its goal to OMNIPRESENT *or* an active key can
  match a kasp key.  The code was changed with CHANGE 5354 that
  was a bugfix to prevent creating new KSK keys for zones in the
  initial stage of signing.  However, this caused problems for
  restarts when rollovers are in progress, because an outroducing
  key can still be an active key.

The test for this introduces a new KEY property 'legacy'.  This is
used to skip tests related to .state files.

(cherry picked from commit 6801899134)
2020-04-03 09:15:39 +02:00
Evan Hunt
6c379655d9 Merge branch '1447-incremental-rpz-update-v9_16' into 'v9_16'
incrementally clean up old RPZ records during updates

See merge request isc-projects/bind9!3319
2020-04-01 09:55:26 +00:00
Evan Hunt
5700485c21 CHANGES and release note
(cherry picked from commit 899f9440c0)
2020-04-01 01:32:55 -07:00
Evan Hunt
a288dee81e incrementally clean up old RPZ records during updates
After an RPZ zone is updated via zone transfer, the RPZ summary
database is updated, inserting the newly added names in the policy
zone and deleting the newly removed ones. The first part of this
was quantized so it would not run too long and starve other tasks
during large updates, but the second part was not quantized, so
that an update in which a large number of records were deleted
could cause named to become briefly unresponsive.

(cherry picked from commit 32da119ed8)
2020-04-01 01:32:55 -07:00
Mark Andrews
4e32fd130f Merge branch 'marka-empty-release-notes-v9_16' into 'v9_16'
add empty release notes for 9.16.2

See merge request isc-projects/bind9!3314
2020-03-31 07:07:20 +00:00
Mark Andrews
657ad6de31 add empty release notes for 9.16.2
(cherry picked from commit 503e2dff64)
2020-03-31 17:12:03 +11:00
Witold Krecicki
df93653818 Merge branch '1700-proper-tcp-resuming-v9_16' into 'v9_16'
Deactivate the handle before sending the async close callback.

See merge request isc-projects/bind9!3310
2020-03-30 12:57:50 +00:00
Witold Kręcicki
3274650123 Deactivate the handle before sending the async close callback.
We could have a race between handle closing and processing async
callback. Deactivate the handle before issuing the callback - we
have the socket referenced anyway so it's not a problem.
2020-03-30 10:54:12 +00:00
Witold Krecicki
52ae7bf603 Merge branch 'wpk/quota-callback-v9_16' into 'v9_16'
Add a quota attach function with a callback, some code cleanups.

See merge request isc-projects/bind9!3309
2020-03-30 10:30:23 +00:00
Witold Kręcicki
7ab77d009d Add a quota attach function with a callback, some code cleanups.
We introduce a isc_quota_attach_cb function - if ISC_R_QUOTA is returned
at the time the function is called, then a callback will be called when
there's quota available (with quota already attached). The callbacks are
organized as a LIFO queue in the quota structure.
It's needed for TCP client quota -  with old networking code we had one
single place where tcp clients quota was processed so we could resume
accepting when the we had spare slots, but it's gone with netmgr - now
we need to notify the listener/accepter that there's quota available so
that it can resume accepting.

Remove unused isc_quota_force() function.

The isc_quote_reserve and isc_quota_release were used only internally
from the quota.c and the tests.  We should not expose API we are not
using.

(cherry picked from commit d151a10f30)
2020-03-30 10:29:33 +02:00
Mark Andrews
a5ec7f9c83 Merge branch '1678-bind-fails-to-build-with-mysql-support-against-mysql8-mysql-connector-8-v9_16' into 'v9_16'
Resolve "BIND fails to build with MYSQL support against mysql8/mysql-connector-8"

See merge request isc-projects/bind9!3305
2020-03-26 23:21:58 +00:00
Ondřej Surý
2f3272ef86 Use compound literals in mysql_options() call
Makes use of compound literals instead of using extra my_bool
variable just to hold "true/1" value.

(cherry picked from commit 715b7a7cec)
2020-03-27 09:05:46 +11:00
Mark Andrews
3387fa03e4 Typedef my_bool if missing.
ORACLE MySQL 8.0 has dropped the my_bool type, so we need to reinstate
it back when compiling with that version or higher.  MariaDB is still
keeping the my_bool type.  The numbering between the two (MariaDB 5.x
jumped to MariaDB 10.x) doesn't make the life of the developer easy.

(cherry picked from commit c6d5d5c88f)
2020-03-27 09:05:46 +11:00
Mark Andrews
5f6b54927e remove unused variable
(cherry picked from commit 7af9883b48)
2020-03-27 09:05:46 +11:00
Michał Kępień
4bade7774a Merge branch 'michal/misc-gitlab-ci-yml-cleanups-v9_16' into 'v9_16'
[v9_16] Miscellaneous .gitlab-ci.yml cleanups

See merge request isc-projects/bind9!3300
2020-03-26 10:43:11 +00:00
Michał Kępień
7910702fec Remove unused YAML anchors
Some YAML anchors defined in .gitlab-ci.yml are not subsequently used.
Remove them to prevent confusion.

(cherry picked from commit 3d121ede6c)
2020-03-26 11:41:55 +01:00
Michał Kępień
688b759ed0 Do not install compiledb in cppcheck job
compiledb is already included in the Docker image used by the cppcheck
job.  Do not attempt installing it again.

(cherry picked from commit 3d264dbe81)
2020-03-26 11:41:55 +01:00
Michał Kępień
89ef138ba6 Include compiler name in all build/test job names
Most build/test job names already contain a "clang", "gcc", or "msvc"
prefix which indicates the compiler used for a given job.  Apply that
naming convention to all build/test job names.

(cherry picked from commit 0c898084cd)
2020-03-26 11:41:55 +01:00
Michał Kępień
6044f6d73d Refactor TSAN unit test job definitions
Multiple YAML keys have identical values for both TSAN unit test job
definitions.  Extract these common keys to a YAML anchor and use it in
TSAN unit test job definitions to reduce code duplication.

(cherry picked from commit 84463f33bf)
2020-03-26 11:41:55 +01:00
Michał Kępień
536704c749 Run "kyua report-html" for TSAN unit test jobs
Definitions of jobs running unit tests under TSAN contain an
"after_script" YAML key.  Since the "unit_test_job" anchor is included
in those job definitions before "after_script" is defined, the
job-specific value of that key overrides the one defined in the included
anchor.  This prevents "kyua report-html" from being run for TSAN unit
test jobs.  Moving the invocation of "kyua report-html" to the "script"
key in the "unit_test_job" anchor is not acceptable as it would cause
the exit code of that command to determine the result of all unit test
jobs and we need that to be the exit code of "make unit".  Instead, add
"kyua report-html" invocations to the "after_script" key of TSAN unit
test job definitions to address the problem without affecting other job
definitions.

(cherry picked from commit 6ebce9425e)
2020-03-26 11:41:55 +01:00
Michał Kępień
873cefc8c9 Refactor TSAN system test job definitions
Multiple YAML keys have identical values for both TSAN system test job
definitions.  Extract these common keys to a YAML anchor and use it in
TSAN system test job definitions to reduce code duplication.

(cherry picked from commit a9aa295f1f)
2020-03-26 11:41:54 +01:00
Michał Kępień
0c726127f7 Drop "before_script" key from TSAN job definitions
Both "system_test_job" and "unit_test_job" YAML anchors contain a
"before_script" key.  TSAN job definitions first specify their own value
of the "before_script" key and then include the aforementioned YAML
anchors, which results in the value of the "before_script" key being
overridden with the value specified by the included anchor.  Given this,
remove "before_script" definitions specific to TSAN jobs as they serve
no practical purpose.

(cherry picked from commit 8ef01c7b50)
2020-03-26 11:41:54 +01:00
Michał Kępień
b358cf30b2 Define TSAN options in a global variable
All assignments for the TSAN_OPTIONS variable are identical across the
entire .gitlab-ci.yml file.  Define a global TSAN_OPTIONS_COMMON
variable and use it in job definitions to reduce code duplication.

(cherry picked from commit 6325c0993a)
2020-03-26 11:41:54 +01:00
Ondřej Surý
f24de93e80 Merge branch '1679-fix-the-tv_nsec_check-v9_16' into 'v9_16'
Fix the tv_nsec check in isc_stdtime_get() (v9.16)

See merge request isc-projects/bind9!3293
2020-03-25 22:00:24 +00:00
Ondřej Surý
e017574b74 Correct the typecast of .tv_sec in isc_stdtime_get() 2020-03-25 22:10:10 +01:00
Ondřej Surý
2bb2a10ba4 Fix the tv_nsec check in isc_stdtime_get()
(cherry picked from commit 0d06a62dd1)
2020-03-25 21:19:55 +01:00
Ondřej Surý
7e79134ec0 Merge branch 'ondrej/no-clang-on-debian-sid-v9_16' into 'v9_16'
Rewrite .gitlab-ci.yml to have 'base_image' and other GitLab CI improvements (v9.16)

See merge request isc-projects/bind9!3288
2020-03-25 17:29:25 +00:00
Ondřej Surý
71c5f29573 Replace clang:stretch:amd64 build with clang:buster:amd64 build (+ add missing system test)
(cherry picked from commit 281531d82b)
2020-03-25 18:12:39 +01:00
Ondřej Surý
691c8f6828 Replace bear with compiledb and drop MAKE_COMMAND because we don't need it
(cherry picked from commit ec72d1100d)
2020-03-25 18:12:38 +01:00
Ondřej Surý
591732e64c Adjust the GitLab CI jobs to match the new images
The custom builds (oot, asan, tsan) were mostly built using Debian sid
amd64 image.  The problem was that this image broke too easily, because
it's Debian "unstable" after all.

This commit introduces "base_image" that should be most stable with
extra bits on top (clang, coccinelle, cppcheck, ...).  Currently, that
would be Debian buster amd64.

Other changes introduced by this commit:

* Change the default clang version to 10
* Run both ASAN and TSAN with both gcc and clang compilers
* Remove Clang Debian stretch i386 job

(cherry picked from commit 5f5721aa11)
2020-03-25 18:12:38 +01:00
Ondřej Surý
206d3841df Merge branch 'ondrej/scan-build-10-fixes-v9_16' into 'v9_16'
Ondrej/scan build 10 fixes v9 16

See merge request isc-projects/bind9!3286
2020-03-25 17:10:21 +00:00
Ondřej Surý
0fdc09efb6 Fix 'Dereference of null pointer' from scan-build-10
These are mostly false positives, the clang-analyzer FAQ[1] specifies
why and how to fix it:

> The reason the analyzer often thinks that a pointer can be null is
> because the preceding code checked compared it against null. So if you
> are absolutely sure that it cannot be null, remove the preceding check
> and, preferably, add an assertion as well.

The 4 warnings reported are:

dnssec-cds.c:781:4: warning: Access to field 'base' results in a dereference of a null pointer (loaded from variable 'buf')
                        isc_buffer_availableregion(buf, &r);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:996:36: note: expanded from macro 'isc_buffer_availableregion'
                                   ^
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:821:16: note: expanded from macro 'ISC__BUFFER_AVAILABLEREGION'
                (_r)->base = isc_buffer_used(_b);              \
                             ^~~~~~~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:152:29: note: expanded from macro 'isc_buffer_used'
        ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/
                                   ^~~~~~~~~
1 warning generated.

--

byname_test.c:308:34: warning: Access to field 'fwdtable' results in a dereference of a null pointer (loaded from variable 'view')
                RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
                                               ^~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/util.h:318:52: note: expanded from macro 'RUNTIME_CHECK'
                                                   ^~~~
/builds/isc-projects/bind9/lib/isc/include/isc/error.h:50:21: note: expanded from macro 'ISC_ERROR_RUNTIMECHECK'
        ((void)(ISC_LIKELY(cond) ||  \
                           ^~~~
/builds/isc-projects/bind9/lib/isc/include/isc/likely.h:23:43: note: expanded from macro 'ISC_LIKELY'
                                            ^
1 warning generated.

--

./rndc.c:255:6: warning: Dereference of null pointer (loaded from variable 'host')
        if (*host == '/') {
            ^~~~~
1 warning generated.

--

./main.c:1254:9: warning: Access to field 'sctx' results in a dereference of a null pointer (loaded from variable 'named_g_server')
        sctx = named_g_server->sctx;
               ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

References:
1. https://clang-analyzer.llvm.org/faq.html#null_pointer

(cherry picked from commit ddd0d356e5)
2020-03-25 18:06:29 +01:00
Ondřej Surý
230d250b3d Fix 'Dead nested assignment's from scan-build-10
The 3 warnings reported are:

os.c:872:7: warning: Although the value stored to 'ptr' is used in the enclosing expression, the value is never actually read from 'ptr'
        if ((ptr = strtok_r(command, " \t", &last)) == NULL) {
             ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

--

rpz.c:1117:10: warning: Although the value stored to 'zbits' is used in the enclosing expression, the value is never actually read from 'zbits'
        return (zbits &= x);
                ^        ~
1 warning generated.

--

openssleddsa_link.c:532:10: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err'
        while ((err = ERR_get_error()) != 0) {
                ^     ~~~~~~~~~~~~~~~
1 warning generated.

(cherry picked from commit 262f087bcf)
2020-03-25 18:06:29 +01:00
Ondřej Surý
0db685ed43 Merge branch 'ondrej/remove-debian-jessie-from-gitlab-ci-v9_16' into 'v9_16'
Remove Debian 8 ("Jessie") from the GitLab CI

See merge request isc-projects/bind9!3282
2020-03-25 06:03:45 +00:00
Ondřej Surý
ed3dd7d67e Remove Debian 8 ("Jessie") from the GitLab CI
There are several reason why remove Debian 8 from the CI:

* Debian 8 ("jessie") has been superseded by Debian 9 ("stretch").
* Regular security support updates have been discontinued as of
  June 17th, 2018.
* Jessie LTS is supported from 17th June 2018 to June 30, 2020.

In other words, it's no longer officially supported by Debian security
team, but by the volunteer/paid contributor composed LTS team.  And the
release will be discontinued in three months from now.  We can use the
freed CI resources to bring new platforms or just to make the jobs run a
bit faster.

(cherry picked from commit 75f46cc3d1)
2020-03-24 14:51:33 +01:00
Mark Andrews
c04d7c28bb Merge branch '1698-converting-isc_log-to-rwlock-broke-windows-v9_16' into 'v9_16'
Used to the correct unlock type (read)

See merge request isc-projects/bind9!3277
2020-03-24 05:04:28 +00:00
Mark Andrews
0b13677f7f Used to the correct unlock type (read)
(cherry picked from commit b7dbfd14d8)
2020-03-24 15:44:06 +11:00
Ondřej Surý
6aebc6c207 Merge branch '4-gitlab-ci.yml-improvement-v9_16' into 'v9_16'
Improve GitLab CI configuration [v9.16]

See merge request isc-projects/bind9!3259
2020-03-20 15:13:43 +00:00
Ondřej Surý
b1475b1ffd Rename MAKE environment variable to MAKE_COMMAND
The environment variable MAKE has been replaced with MAKE_COMMAND,
because overriding MAKE variable also changed the definition of the MAKE
inside the Makefiles, and we want only a single wrapper around the whole
build process.

Previously, setting `MAKE` to `bear make` meant that `bear make` would
be run at every nested make invocation, which messed up the upcoming
automake transition as compile_commands.json would be generated in every
subdirectory instead of just having one central file at the top of the
build tree.

(cherry picked from commit de1a637a69)
2020-03-20 16:07:11 +01:00
Ondřej Surý
a872f0270a Remove cppcheck arm64 job
All *:sid:amd64 jobs were errorneously copied to *:sid:arm64 including
the extra cppcheck run.  Remove the extra definitions from arm64 jobs.

(cherry picked from commit 99f9e2c53e)
2020-03-20 16:07:11 +01:00
Ondřej Surý
7a296c60e1 Replace dependencies+needs with needs+artifacts in GitLabCI config
All jobs now use solely the newer needs configuration to declare
dependencies between jobs:

    needs:
      - job: <foo>
        artifacts: true

instead of combination of dependencies and needs which is deprecated.
This change completely unbundles the stages (alas the stages still needs
to stay because the job graph has to stay acyclic between the stages).

(cherry picked from commit 66ba808c1b)
2020-03-20 16:07:11 +01:00
Michal Nowak
8d46aba685 Merge branch 'mnowak/abi-tracker-helper-v9.17.0-v9_16' into 'v9_16'
[v9_16] Bump BIND baseline version for abi-check

See merge request isc-projects/bind9!3270
2020-03-20 12:12:26 +00:00
Michal Nowak
5fae0df7ee Bump BIND baseline version for abi-check
(cherry picked from commit 3730d59bf9)
2020-03-20 13:10:41 +01:00
Matthijs Mekking
3a13a96169 Merge branch 'v9_16_1-release' into 'v9_16'
Apply 9.16.1 release branch

See merge request isc-projects/bind9!3263
2020-03-20 11:29:29 +00:00
Tinderbox User
ecfea36b72 Update changes after QA review 2020-03-20 11:47:02 +01:00
Tinderbox User
d2c4cfcf1f regen v9_16 2020-03-20 11:47:02 +01:00
Tinderbox User
aed7d77c97 prep 9.16.1
Updated version and CHANGES files with new release number.

Check the API files:
- lib/bind9/api:
  Source code changes, but no interface changes: increment
  LIBREVISION.
- lib/dns/api:
  Function dns_acl_match changed, struct dns_badcache changed,
  function dns_badcache_add changed, function dns_clent_startupdate
  changed, struct dns_compress changed, struct dns_resolver changed,
  rwlock size changed. This means a LIBINTERFACE increment.
- lib/irs/api:
  Source code changes, but no interface changes: increment
  LIBREVISION.
- lib/isc/api:
  The structs isc__networker and isc_nmsocket changed. This means
  increment LIBINTERFACE.  The functions isc_uv_export and
  isc_uv_import are removed, so LIBAGE must beq zero.
- lib/isccc/api:
  Source code changes, but no interface changes: increment
  LIBREVISION.
- lib/isccfg/api:
  Source code changes, but no interface changes: increment
  LIBREVISION.
- lib/ns/api:
  Function ns_clientmgr_create, ns_interfacemgr_create, and
  structs ns_clientmgr, ns_interface, ns_interfacemgr changed:
  increment LIBINTERFACE.

No need to update README or release notes.

Updated CHANGES: Add GitLab MR reference to entry 5357. Remove
merge conflict gone wrong ("max-ixfr-ratio" is not in 9.16).

Add /util/check-make-install.in to .gitattributes.
2020-03-20 11:47:01 +01:00
Michal Nowak
2bddcc9e2b Merge branch 'mnowak/unit-test-debugging-enhancements-v9_16' into 'v9_16'
[v9_16] Enhance unit test debugging

See merge request isc-projects/bind9!3267
2020-03-20 10:37:43 +00:00
Michal Nowak
94fa27e43f Enhance unit test debugging
When unit test fails, core file is created. Kyua's 'debug' command can
run GDB on it and provide backtrace. Unfortunately Kyua is picky about
location of these core files we opt to use custom Kyua fork and copy
core files from Kyua working directory to source tree and make it
available in GitLab.

(cherry picked from commit 8fad74e0e5)
2020-03-20 10:55:09 +01:00
Ondřej Surý
509a06f7b0 Merge branch '1679-remove-workaround-for-systems-with-broken-gettimeofday-system-calls-v9_16' into 'v9_16'
Use clock_gettime() instead of gettimeofday() for isc_stdtime function

See merge request isc-projects/bind9!3258
2020-03-20 09:46:54 +00:00
Ondřej Surý
0345dac44c Use clock_gettime() instead of gettimeofday() for isc_stdtime function
This also removes Solaris 2.8 broken gettimeofday() workaround

(cherry picked from commit e691b89a9a)
2020-03-19 10:17:26 +01:00
Ondřej Surý
2de447b088 Merge branch '1675-logfileconfig-system-test-crashes-occasionally-rwlock-v9_16' into 'v9_16'
Use isc_rwlock to lock .logconfig member of isc_log_t

See merge request isc-projects/bind9!3256
2020-03-18 12:48:13 +00:00
Ondřej Surý
11a6ac594a Use isc_rwlock to lock .logconfig member of isc_log_t
In isc_log_woudlog() the .logconfig member of isc_log_t structure was
accessed unlocked on the merit that there could be just a race when
.logconfig would be NULL, so the message would not be logged.  This
turned not to be true, as there's also data race deeper.  The accessed
isc_logconfig_t object could be in the middle of destruction, so the
pointer would be still non-NULL, but the structure members could point
to a chunk of memory no longer belonging to the object.  Since we are
only accessing integer types (the log level), this would never lead to
a crash, it leads to memory access to memory area no longer belonging to
the object and this a) wrong, b) raises a red flag in thread-safety tools.

(cherry picked from commit 4d58856ff7)
2020-03-18 13:25:28 +01:00
Ondřej Surý
072dacfc30 Merge branch 'marka-memget-cannot-fail-logging-v9_16' into 'v9_16'
Refactor the isc_log API so it cannot fail on memory failures

See merge request isc-projects/bind9!3255
2020-03-18 11:45:13 +00:00
Mark Andrews
af14091f65 Refactor the isc_log API so it cannot fail on memory failures
The isc_mem API now crashes on memory allocation failure, and this is
the next commit in series to cleanup the code that could fail before,
but cannot fail now, e.g. isc_result_t return type has been changed to
void for the isc_log API functions that could only return ISC_R_SUCCESS.

(cherry picked from commit 0b793166d0)
2020-03-18 11:44:18 +01:00
Evan Hunt
8899b0c1e6 Merge branch 'each-lgtm-fixes-v9_16' into 'v9_16'
fix LGTM warnings

See merge request isc-projects/bind9!3249
2020-03-17 22:56:26 +00:00
Ondřej Surý
bfe832aea7 Add C11 localtime_r and gmtime_r shims for Windows
On Windows, C11 localtime_r() and gmtime_r() functions are not
available.  While localtime() and gmtime() functions are already thread
safe because they use Thread Local Storage, it's quite ugly to #ifdef
around every localtime_r() and gmtime_r() usage to make the usage also
thread-safe on POSIX platforms.

The commit adds wrappers around Windows localtime_s() and gmtime_s()
functions.

NOTE: The implementation of localtime_s and gmtime_s in Microsoft CRT
are incompatible with the C standard since it has reversed parameter
order and errno_t return type.

(cherry picked from commit 08f4c7d6c0)
2020-03-17 15:33:24 -07:00
Evan Hunt
82edb5a54a silence a warning about unsafe snprintf() call
(cherry picked from commit ec95b84e8d)
2020-03-17 15:33:24 -07:00
Evan Hunt
1ac200626b clean up dead code
removed an if statement that always evaluated to false

(cherry picked from commit fc5ae3192b)
2020-03-17 15:33:24 -07:00
Evan Hunt
3d9a46bcb8 replace unsafe ctime() and gmtime() function calls
This silences LGTM warnings that these functions are not thread-safe.

(cherry picked from commit 5703f70427)
2020-03-17 15:33:24 -07:00
Evan Hunt
a8184b35cd remove or comment empty conditional branches
some empty conditional branches which contained a semicolon were
"fixed" by clang-format to contain nothing. add comments to prevent this.

(cherry picked from commit 735be3b816)
2020-03-17 15:33:23 -07:00
Evan Hunt
10b3f7da89 Merge branch '1684-timer-test-build-v9_16' into 'v9_16'
fix a pointer-to-int cast error

See merge request isc-projects/bind9!3247
2020-03-17 20:27:31 +00:00
Evan Hunt
64ce02b5f8 fix a pointer-to-int cast error
(cherry picked from commit 6b76646037)
2020-03-17 13:10:42 -07:00
Mark Andrews
d2bb41c9b6 Merge branch '1682-dighost-c-idn_output_filter-has-off-by-one-error-v9_16' into 'v9_16'
address off by one error in idn_output_filter

See merge request isc-projects/bind9!3245
2020-03-17 05:48:24 +00:00
Mark Andrews
5dde15b0f2 address off by one error in idn_output_filter
(cherry picked from commit af67acc0d0)
2020-03-17 15:51:29 +11:00
Michał Kępień
056c3d752b Merge branch 'michal/update-gitlab-ci-to-freebsd-12.1-v9_16' into 'v9_16'
[v9_16] Update GitLab CI to FreeBSD 12.1

See merge request isc-projects/bind9!3239
2020-03-16 19:05:21 +00:00
Michał Kępień
e88a9a1be9 Move FreeBSD CI jobs to libvirt-based executors
To get rid of the currently used FreeBSD-specific executor, move FreeBSD
CI jobs to libvirt-based executors.  Make the necessary tag and variable
adjustments.

(cherry picked from commit 80618b5378)
2020-03-16 19:04:48 +00:00
Michał Kępień
c5cbb73f1b Update GitLab CI to FreeBSD 12.1
Since FreeBSD 12.1 is the current FreeBSD 12.x release, replace FreeBSD
12.0 GitLab CI jobs with their up-to-date counterparts.

(cherry picked from commit 4c68b56246)
2020-03-16 19:04:48 +00:00
Mark Andrews
2d05668744 Merge branch '1681-compile-error-geoip_test-c-maxminddb-h-file-not-found-v9_16' into 'v9_16'
Add MAXMINDDB_CFLAGS to CINCLUDES

See merge request isc-projects/bind9!3236
2020-03-16 13:14:23 +00:00
Mark Andrews
86a30a691b Add MAXMINDDB_CFLAGS to CINCLUDES
(cherry picked from commit 81a80274bd)
2020-03-16 18:51:52 +11:00
Mark Andrews
a7c32f4fe0 Merge branch '1676-address-timing-issue-in-forward-system-test-v9_16' into 'v9_16'
wait for the reply message before checking to avoid false negative.

See merge request isc-projects/bind9!3230
2020-03-16 00:18:07 +00:00
Mark Andrews
c3cd3ae488 wait for the reply message before checking to avoid false negative.
Waiting for the reply message will ensure that all messages being
looked for exist in the logs at the time of checking.  When the
test was only waiting for the send message there was a race between
grep and the ns1 instance of named logging that it had seen the
request.

(cherry picked from commit a38a324442)
2020-03-16 10:52:10 +11:00
Mark Andrews
a3c2e9ada6 Merge branch '1655-bind-9-11-5-writes-syntax-errors-to-its-zone-cache-v9_16' into 'v9_16'
Resolve "BIND 9.11.5 writes syntax errors to its zone cache"

See merge request isc-projects/bind9!3226
2020-03-13 04:25:01 +00:00
Mark Andrews
846d0c45bd Add CHANGES note
(cherry picked from commit c9c59db5b3)
2020-03-13 15:03:15 +11:00
Mark Andrews
743c509842 Quote zone name so that specials are handled
(cherry picked from commit 59498ce17f)
2020-03-13 15:02:27 +11:00
Mark Andrews
41060e3d45 Pass NUL terminated buffer name to cfg_parse_buffer
(cherry picked from commit 91efc587b2)
2020-03-13 15:02:26 +11:00
Mark Andrews
9f466b5b17 Test reloading of zones with special
(cherry picked from commit ad030332bd)
2020-03-13 15:02:26 +11:00
Mark Andrews
98d4b93c59 Merge branch 'marka-maybe-silence-missing-unlock-v9_16' into 'v9_16'
Silence missing unlock from Coverity.

See merge request isc-projects/bind9!3224
2020-03-13 02:36:35 +00:00
Mark Andrews
cf6b2a6c18 Silence missing unlock from Coverity.
Save 'i' to 'locknum' and use that rather than using
'header->node->locknum' when performing the deferred
unlock as 'header->node->locknum' can theoretically be
different to 'i'.

(cherry picked from commit 8dd8d48c9f)
2020-03-13 13:17:46 +11:00
Mark Andrews
075f74af95 Merge branch '1652-nslookup-assertion-at-soa_6-c-302-require-rdata-length-0-failed-back-trace-v9_16' into 'v9_16'
Resolve "nslookup: assertion at soa_6.c:302: REQUIRE(rdata->length != 0) failed, back trace"

See merge request isc-projects/bind9!3222
2020-03-13 01:30:14 +00:00
Mark Andrews
0cf72a9414 Check that dig/host/nslookup handle a UPDATE response.
Additionally check that "delete $qname SOA" in the update
reponse doesn't trigger a insertion in nslookup.

(cherry picked from commit 6593cf0b5a)
2020-03-13 11:47:10 +11:00
Mark Andrews
087cd378c4 Report opcode mismatch
(cherry picked from commit bb7576cc9b)
2020-03-13 11:47:10 +11:00
Mark Andrews
e57ff07a7d turn off best effort processing in host and add the ability to specify the port
(cherry picked from commit 4a7b9dba61)
2020-03-13 11:47:10 +11:00
Mark Andrews
7136044885 turn off best effort processing in nslookup
(cherry picked from commit d1cb30e747)
2020-03-13 11:47:10 +11:00
Evan Hunt
43d96d80c4 Merge branch '864-zone-type-table-in-arm-needs-improvement-v9_16' into 'v9_16'
Resolve "zone type table in ARM needs improvement"

See merge request isc-projects/bind9!3217
2020-03-12 09:52:09 +00:00
Evan Hunt
a4f3ec5d97 build doc 2020-03-12 02:25:42 -07:00
Evan Hunt
1a8b6481bf improve readability of bibliogrpahy
Change <biblioentry> and <citetitle> sections to improve the readability
of the bibliography sections. Thanks to Sun Guonian.
2020-03-12 02:22:55 -07:00
Evan Hunt
e1b6438fdd shorten text for mirror zones to prevent overspill 2020-03-12 02:22:50 -07:00
Mark Andrews
7acdb181c5 use relative widths for zone table 2020-03-12 02:22:33 -07:00
Evan Hunt
0cdca3a5fc Merge branch '1661-fix-dbsize-v9_16' into 'v9_16'
improve calculation of database size

See merge request isc-projects/bind9!3196
2020-03-12 08:11:38 +00:00
Evan Hunt
c5405c2700 improve calculation of database size
"max-journal-size" is set by default to twice the size of the zone
database. however, the calculation of zone database size was flawed.

- change the size calculations in dns_db_getsize() to more accurately
  represent the space needed for a journal file or *XFR message to
  contain the data in the database. previously we returned the sizes
  of all rdataslabs, including header overhead and offset tables,
  which resulted in the database size being reported as much larger
  than the equivalent journal transactions would have been.
- map files caused a particular problem here: the full name can't be
  determined from the node while a file is being deserialized, because
  the uppernode pointers aren't set yet. so we store "full name length"
  in the dns_rbtnode structure while serializing, and clear it after
  deserialization is complete.
2020-03-12 00:38:37 -07:00
Ondřej Surý
c99f7cf9bd Merge branch 'ondrej/fix-clang-format-headers-symlinks-v9_16' into 'v9_16'
Fix .clang-format.headers symlinks (v9.16)

See merge request isc-projects/bind9!3213
2020-03-11 09:24:21 +00:00
Ondřej Surý
67464af0bb Fixup the headers formatting 2020-03-11 10:23:35 +01:00
Ondřej Surý
60c6ff4ece Fix the deeper symlinks to .clang-format.headers 2020-03-11 10:21:54 +01:00
Ondřej Surý
ff60a59b7f Merge branch 'ondrej/clang-format-improve-includes-v9_16' into 'v9_16'
Improve #include block sorting and grouping in clang-format (v9_16)

See merge request isc-projects/bind9!3194
2020-03-11 08:55:38 +00:00
Ondřej Surý
f3c2274479 Use the new sorting rules to regroup #include headers 2020-03-11 08:55:12 +00:00
Ondřej Surý
ba0aff0d59 Improve the #include block sorting
The IncludeCategories was incomplete, it missed pk11/ and dst/ headers
and the rule that put "" header after all <> headers was broken.
2020-03-11 08:55:12 +00:00
Michał Kępień
164109087e Merge branch 'michal/minor-release-note-tweaks-v9_16' into 'v9_16'
[v9_16] Minor release note tweaks

See merge request isc-projects/bind9!3211
2020-03-11 08:54:48 +00:00
Michał Kępień
f483c4a6bb Add GitLab identifier to rwlock release note
(cherry picked from commit 3e6ef80706)
2020-03-11 09:52:51 +01:00
Michał Kępień
45170c828e Merge branch '1636-add-release-note-about-controlling-source-ports-v9_16' into 'v9_16'
[v9_16] Add release note about controlling source ports

See merge request isc-projects/bind9!3209
2020-03-11 08:32:58 +00:00
Michał Kępień
e6d4da4080 Add release note about controlling source ports
(cherry picked from commit 384b413dc5)
2020-03-11 09:30:42 +01:00
Michał Kępień
43bea15a7a Release note wording tweaks
(cherry picked from commit 2283d38ac2)
2020-03-11 09:29:44 +01:00
Michał Kępień
c7dee5dd84 Move pthread rwlocks release note to a section
(cherry picked from commit f8a8eaba8b)
2020-03-11 09:28:01 +01:00
Michał Kępień
1d1605fb57 Merge branch 'matthijs-disable-mscv-kasp-system-test-v9_16' into 'v9_16'
[v9_16] Disable kasp test on Windows

See merge request isc-projects/bind9!3208
2020-03-11 07:20:54 +00:00
Matthijs Mekking
e58c1cfe1a Remove leftover set_keydir
(cherry picked from commit 2094e5ed4d)
2020-03-10 16:04:13 +01:00
Matthijs Mekking
a22e881a97 Disable kasp test on Windows
The kasp system test is timing critical.  The test passes on all
Linux based machines, but fails frequently on Windows.  The test
takes a lot more time on Windows and at the final checks fail
because the expected next key event is too far off.  For example:

I:kasp:check next key event for zone step2.algorithm-roll.kasp (570)
I:kasp:error: bad next key event time 20909 for zone \
  step2.algorithm-roll.kasp (expect 21600)
I:kasp:failed

This is because the kasp system test calculates the time when the
next key event should occur based on the policy.  This assumes that
named is able to do key management within a minute.  But starting,
named, doing key management for other zones, and reconfiguring takes
much more time on Windows and thus the next key event on Windows is
much shorter than anticipated.

That this happens is a good thing because this means that the
correct next key event is used, but is not so nice for testing, as
it is hard to determine how much time named needed before finishing
the current key event.

Disable the kasp test on Windows now because it is blocking the
release.  We know the cause of these test failures, and it is clear
that this is a fault in the test, not the code.  Therefore we feel
comfortable disabling the test right now and work on a fix while
unblocking the release.

(cherry picked from commit 4e610b7f6b)
2020-03-10 16:04:13 +01:00
Michal Nowak
6d8f8abe49 Merge branch 'mnowak/abi-tracker-helper-v9_16' into 'v9_16'
[v9_16] Add API Checker

See merge request isc-projects/bind9!3203
2020-03-10 08:56:20 +00:00
Michal Nowak
0cff4c4e4f Add API Checker
ABI checker tools generate HTML and TXT API compatibility reports of
BIND libraries. Comparison is being done between two bind source trees
which hold built BIND.

In the CI one version is the reference version defined by
BIND_BASELINE_VERSION variable, the latter one is the HEAD of branch
under test.

(cherry picked from commit 49bc08e612)
2020-03-10 09:53:44 +01:00
Evan Hunt
15090b4dea Merge branch '1664-double-unlock-v9_16' into 'v9_16'
remove redundant ZONEDB_UNLOCK

See merge request isc-projects/bind9!3198
2020-03-10 00:08:51 +00:00
Evan Hunt
2db2a22f28 remove redundant ZONEDB_UNLOCK
(cherry picked from commit b54454b7c6)
2020-03-09 16:47:44 -07:00
Matthijs Mekking
44680ad1cf Merge branch '1653-dnssec-policy-view-race-v9_16' into 'v9_16'
Resolve "Race condition with dnssec-policy, same zone in different views"

See merge request isc-projects/bind9!3195
2020-03-09 15:59:51 +00:00
Matthijs Mekking
33ceecdde7 Update changes, documentation
(cherry picked from commit 47e42d5750)
2020-03-09 16:25:46 +01:00
Matthijs Mekking
29cde9e990 Fix race condition dnssec-policy with views
When configuring the same dnssec-policy for two zones with the same
name but in different views, there is a race condition for who will
run the keymgr first. If running sequential only one set of keys will
be created, if running parallel two set of keys will be created.

Lock the kasp when running looking for keys and running the key
manager. This way, for the same zone in different views only one
keyset will be created.

The dnssec-policy does not implement sharing keys between different
zones.

(cherry picked from commit e0bdff7ecd)
2020-03-09 16:25:35 +01:00
Matthijs Mekking
7508598b8d Merge branch 'matthijs-refactor-kasp-test-v9_16' into 'v9_16'
Refactor kasp test (backport v9_16)

See merge request isc-projects/bind9!3191
2020-03-09 15:21:57 +00:00
Matthijs Mekking
da9a1bc5f3 Add check calls to kasp zsk-retired test
The test case for zsk-retired was missing the actual checks.  Add
them and fix the set_policy call to expect three keys.

(cherry picked from commit 2e4b55de85)
2020-03-09 15:43:38 +01:00
Matthijs Mekking
44bacf33fc More consistent spacing and comments
Some comments started with a lowercased letter. Capitalized them to
be more consistent with the rest of the comments.

Add some newlines between `set_*` calls and check calls, also to be
more consistent with the other test cases.

(cherry picked from commit 7e54dd74f9)
2020-03-09 15:43:29 +01:00
Matthijs Mekking
c73cca2622 Replace key_states
(cherry picked from commit f500b16f83)
2020-03-09 15:43:17 +01:00
Matthijs Mekking
406f27ebae Replace key_timings
(cherry picked from commit 32e4916c59)
2020-03-09 15:43:10 +01:00
Matthijs Mekking
581e184a21 Replace key_properties
(cherry picked from commit 628e09a423)
2020-03-09 15:43:02 +01:00
Matthijs Mekking
0d9fef7768 Replace zone_properties
(cherry picked from commit 8a4787d585)
2020-03-09 15:42:54 +01:00
Matthijs Mekking
be84cc82af Merge branch 'matthijs-kasp-test-algoroll-v9_16' into 'v9_16'
Backport kasp algorithm rollover test plus bugfixes to v9_16

See merge request isc-projects/bind9!3187
2020-03-09 14:24:57 +00:00
Matthijs Mekking
bc02baa045 Add additional wait period for algorithm rollover
We may be checking the algorithm steps too fast: the reconfig
command may still be in progress. Make sure the zones are signed
and loaded by digging the NSEC records for these zones.

(cherry picked from commit d16520532f)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
01098fb81e Make clang-format happy
(cherry picked from commit 53bd81ad19)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
4e8ffc4ed8 update CHANGES
(cherry picked from commit 6ddfed3de0)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
b59dc6f89e Add CSK algorithm rollover test
(cherry picked from commit 917cf5f86f)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
c20ac664dd [#1624] dnssec-policy change retire unwanted keys
When changing a dnssec-policy, existing keys with properties that no
longer match were not being retired.

(cherry picked from commit 3905a03205)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
4bbefa8514 [#1625] Algorithm rollover waited too long
Algorithm rollover waited too long before introducing zone
signatures.  It waited to make sure all signatures were resigned,
but when introducing a new algorithm, all signatures are resigned
immediately.  Only add the sign delay if there is a predecessor key.

(cherry picked from commit 28506159f0)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
150464e719 [#1626] Fix stuck algorithm rollover
Algorithm rollover was stuck on submitting DS because keymgr thought
it would move to an invalid state.  It did not match the current
key because it checked it against the current key in the next state.
Fixed by when checking the current key, check it against the desired
state, not the existing state.

(cherry picked from commit a8542b8cab)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
f8b555a3a2 Add algorithm rollover test case
Add a test case for algorithm rollover.  This is triggered by
changing the dnssec-policy.  A new nameserver ns6 is introduced
for tests related to dnssec-policy changes.

This requires a slight change in check_next_key_event to only
check the last occurrence.  Also, change the debug log message in
lib/dns/zone.c to deal with checks when no next scheduled key event
exists (and default to loadkeys interval 3600).

(cherry picked from commit 88ebe9581b)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
08ed7461af Remove unneeded step6 zone
The zone 'step6.ksk-doubleksk.autosign' is configured but is not
set up nor tested.  Remove the unneeded configured zone.

(cherry picked from commit cc2afe853b)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
9dc207a363 Introduce enable dnssec test case
(cherry picked from commit fdb3f6f400)
2020-03-09 14:42:53 +01:00
Matthijs Mekking
5e3bad7c95 Prepare kasp for algorithm rollover test
Algorithm rollover will require four keys so introduce KEY4.
Also it requires to look at key files for multiple algorithms so
change getting key ids to be algorithm rollover agnostic (adjusting
count checks).  The algorithm will be verified in check_key so
relaxing 'get_keyids' is fine.

Replace '${_alg_num}' with '$(key_get KEY[1-4] ALG_NUM)' in checks
to deal with multiple algorithms.

(cherry picked from commit 00ced2d2e7)
2020-03-09 14:42:53 +01:00
Michał Kępień
a8563d7fdd Merge branch 'michal/do-not-run-openbsd-system-test-jobs-for-tags-v9_16' into 'v9_16'
[v9_16] Do not run OpenBSD system test jobs for tags

See merge request isc-projects/bind9!3188
2020-03-09 13:35:33 +00:00
Michał Kępień
2c645e10f0 Do not run OpenBSD system test jobs for tags
OpenBSD virtual machines seem to affected particularly badly by other
activity happening on the host.  This causes trouble around release
time: when multiple tags are pushed to the repository, a large number of
jobs is started concurrently on all CI runners.  In extreme cases, this
causes the system test suite to run for about an hour (!) on OpenBSD
VMs, with multiple tests failing.  We investigated the test artifacts
for all such cases in the past and the outcome was always the same: test
failures were caused by extremely slow I/O on the guest.  We tried
various tricks to work around this problem, but nothing helped.

Given the above, stop running OpenBSD system test jobs for pending BIND
releases to prevent the results of these jobs from affecting the
assessment of a given release's readiness for publication.  This change
does not affect OpenBSD build jobs.  OpenBSD system test jobs will still
be run for scheduled and web-requested pipelines, to make sure we catch
any severe issues with test code on that platform sooner or later.

(cherry picked from commit 7b002cea83)
2020-03-09 14:34:18 +01:00
Matthijs Mekking
c33930f99a Merge branch '1413-fix-dnssec-test-v9_16' into 'v9_16'
Fix dnssec test

See merge request isc-projects/bind9!3186
2020-03-09 12:09:47 +00:00
Matthijs Mekking
3b7bfa807f Fix dnssec test
There is a failure mode which gets triggered on heavily loaded
systems. A key change is scheduled in 5 seconds to make ZSK2 inactive
and ZSK3 active, but `named` takes more than 5 seconds to progress
from `rndc loadkeys` to the query check. At this time the SOA RRset
is already signed by the new ZSK which is not expected to be active
at that point yet.

Split up the checks to test the case where RRsets are signed
correctly with the offline KSK (maintained the signature) and
the active ZSK.  First run, RRsets should be signed with the still
active ZSK2, second run RRsets should be signed with the new active
ZSK3.

(cherry picked from commit aebb2aaa0f)
2020-03-09 12:04:12 +01:00
Diego dos Santos Fronza
213defd9e8 Merge branch '1472-threadsanitizer-lock-order-inversion-potential-deadlock-dns_resolver_createfetch-vs_v9_16' into 'v9_16'
Resolve "ThreadSanitizer: lock-order-inversion (potential deadlock) - dns_resolver_createfetch vs. dns_resolver_prime"

See merge request isc-projects/bind9!3157
2020-03-06 17:31:47 +00:00
Diego Fronza
277581c5a1 Fixed disposing of resolver->references in destroy() function 2020-03-06 13:37:07 -03:00
Diego Fronza
341b69aa7e Fixed potential-lock-inversion
This commit simplifies a bit the lock management within dns_resolver_prime()
and prime_done() functions by means of turning resolver's attribute
"priming" into an atomic_bool and by creating only one dependent object on the
lock "primelock", namely the "primefetch" attribute.

By having the attribute "priming" as an atomic type, it save us from having to
use a lock just to test if priming is on or off for the given resolver context
object, within "dns_resolver_prime" function.

The "primelock" lock is still necessary, since dns_resolver_prime() function
internally calls dns_resolver_createfetch(), and whenever this function
succeeds it registers an event in the task manager which could be called by
another thread, namely the "prime_done" function, and this function is
responsible for disposing the "primefetch" attribute in the resolver object,
also for resetting "priming" attribute to false.

It is important that the invariant "priming == false AND primefetch == NULL"
remains constant, so that any thread calling "dns_resolver_prime" knows for sure
that if the "priming" attribute is false, "primefetch" attribute should also be
NULL, so a new fetch context could be created to fulfill this purpose, and
assigned to "primefetch" attribute under the lock protection.

To honor the explanation above, dns_resolver_prime is implemented as follow:
	1. Atomically checks the attribute "priming" for the given resolver context.
	2. If "priming" is false, assumes that "primefetch" is NULL (this is
           ensured by the "prime_done" implementation), acquire "primelock"
	   lock and create a new fetch context, update "primefetch" pointer to
	   point to the newly allocated fetch context.
	3. If "priming" is true, assumes that the job is already in progress,
	   no locks are acquired, nothing else to do.

To keep the previous invariant consistent, "prime_done" is implemented as follow:
	1. Acquire "primefetch" lock.
	2. Keep a reference to the current "primefetch" object;
	3. Reset "primefetch" attribute to NULL.
	4. Release "primefetch" lock.
	5. Atomically update "priming" attribute to false.
	6. Destroy the "primefetch" object by using the temporary reference.

This ensures that if "priming" is false, "primefetch" was already reset to NULL.

It doesn't make any difference in having the "priming" attribute not protected
by a lock, since the visible state of this variable would depend on the calling
order of the functions "dns_resolver_prime" and "prime_done".

As an example, suppose that instead of using an atomic for the "priming" attribute
we employed a lock to protect it.
Now suppose that "prime_done" function is called by Thread A, it is then preempted
before acquiring the lock, thus not reseting "priming" to false.
In parallel to that suppose that a Thread B is scheduled and that it calls
"dns_resolver_prime()", it then acquires the lock and check that "priming" is true,
thus it will consider that this resolver object is already priming and it won't do
any more job.
Conversely if the lock order was acquired in the other direction, Thread B would check
that "priming" is false (since prime_done acquired the lock first and set "priming" to false)
and it would initiate a priming fetch for this resolver.

An atomic variable wouldn't change this behavior, since it would behave exactly the
same, depending on the function call order, with the exception that it would avoid
having to use a lock.

There should be no side effects resulting from this change, since the previous
implementation employed use of the more general resolver's "lock" mutex, which
is used in far more contexts, but in the specifics of the "dns_resolver_prime"
and "prime_done" it was only used to protect "primefetch" and "priming" attributes,
which are not used in any of the other critical sections protected by the same lock,
thus having zero dependency on those variables.
2020-03-06 13:37:07 -03:00
Diego Fronza
84d6896661 Added atomic_compare_exchange_strong_acq_rel macro
It is much better to read than:
atomic_compare_exchange_strong_explicit() with 5 arguments.
2020-03-06 13:37:07 -03:00
Michał Kępień
eb80b0c1d5 Merge branch 'michal/fix-using-sibling-root-libuv-for-windows-builds-v9_16' into 'v9_16'
[v9_16] Fix using sibling-root libuv for Windows builds

See merge request isc-projects/bind9!3182
2020-03-06 12:38:25 +00:00
Michał Kępień
11f2f7bfbf Fix using sibling-root libuv for Windows builds
HAVE_UV_IMPORT and other config.h macros must not be set unconditionally
because no existing libuv release exposes uv_import() and/or uv_export()
yet.  Windows builds not passing an explicit path to libuv to
win32utils/Configure are currently broken because of this, so comment
out the offending lines and describe when the aforementioned config.h
macros should be set.

(cherry picked from commit 57b430b8ca)
2020-03-06 13:37:25 +01:00
Mark Andrews
40fd6b8616 Merge branch '1628-release-process-failed-to-detect-that-header-file-was-not-installed-v9_16' into 'v9_16'
test installed header files

See merge request isc-projects/bind9!3175
2020-03-06 03:06:18 +00:00
Mark Andrews
fc199384c5 test installed header files
(cherry picked from commit a278b6bd84)
2020-03-06 02:20:03 +00:00
Mark Andrews
aa995a2f1d Merge branch 'marka-install-missing-header-files' into 'v9_16'
Fix lists of installed header files

See merge request isc-projects/bind9!3178
2020-03-06 02:17:35 +00:00
Mark Andrews
5d64049301 Fix lists of installed header files 2020-03-06 13:00:04 +11:00
Witold Krecicki
a5c21d5862 Merge branch '1650-fix-race-in-killoldestclient-v9_16' into 'v9_16'
Destroy query in killoldestquery under a lock.

See merge request isc-projects/bind9!3162
2020-03-06 00:58:40 +00:00
Witold Kręcicki
aec3dd28d6 Destroy query in killoldestquery under a lock.
Fixes a race between ns_client_killoldestquery and ns_client_endrequest -
killoldestquery takes a client from `recursing` list while endrequest
destroys client object, then killoldestquery works on a destroyed client
object. Prevent it by holding reclist lock while cancelling query.

(cherry picked from commit df3dbdff81)
2020-03-05 23:55:42 +00:00
Witold Krecicki
ce4866f456 Merge branch '1643-tcp-connections-accounting-v9_16' into 'v9_16'
Resolve "Problems reported in BIND 9.16.0 after hitting tcp-clients limit"

See merge request isc-projects/bind9!3172
2020-03-05 23:55:11 +00:00
Witold Kręcicki
5b22e3689d Only use tcpdns timer if it's initialized.
(cherry picked from commit 4b9962d4a3)
2020-03-05 23:27:56 +00:00
Witold Kręcicki
196d937007 CHANGES note
(cherry picked from commit d2445310e2)
2020-03-05 23:27:56 +00:00
Witold Kręcicki
b32b01d403 Fix TCPDNS socket closing issues
(cherry picked from commit ae1499ca19)
2020-03-05 23:27:56 +00:00
Evan Hunt
a8e9ef194c add a test of normal TCP query behavior before and after high-water test
(cherry picked from commit 1383804597)
2020-03-05 23:27:56 +00:00
Witold Kręcicki
11b80da9ff Limit TCP connection quota logging to 1/s
(cherry picked from commit fc9792eae8)
2020-03-05 23:27:56 +00:00
Witold Kręcicki
b85de76816 Proper accounting of active TCP connections
(cherry picked from commit fc9e2276ca)
2020-03-05 23:27:56 +00:00
Mark Andrews
ccc75390bb Merge branch 'marka-sort-AC_CONFIG_FILES-v9_16' into 'v9_16'
sort AC_CONFIG_FILES

See merge request isc-projects/bind9!3168
2020-03-05 22:30:29 +00:00
Mark Andrews
5390eee7cf sort AC_CONFIG_FILES
(cherry picked from commit fd0d4ba948)
2020-03-06 08:48:44 +11:00
Michal Nowak
0665c7f550 Merge branch 'mnowak/respdiff-v9_16' into 'v9_16'
[v9_16] Add respdiff job

See merge request isc-projects/bind9!3164
2020-03-05 14:47:10 +00:00
Michal Nowak
704eeb3288 Add respdiff job
This job leverages respdiff test from the private bind-qa repo.

(cherry picked from commit 04f8b65a8f)
2020-03-05 12:15:04 +01:00
Michal Nowak
fca6950ff5 Merge branch 'mnowak/pkcs11-test-fix-v9_16' into 'v9_16'
[v9_16] Fix pkcs11 test

See merge request isc-projects/bind9!3160
2020-03-05 07:00:51 +00:00
Michal Nowak
53ca8cac14 Fix "pkcs11" system test
- Define the SLOT environment variable before starting the test.  This
    variable defaults to 0 and that does not work with SoftHSM 2.

  - The system test expects the PIN environment variable to be set to
    "1234" while bin/tests/prepare-softhsm2.sh sets it to "0000".
    Update bin/tests/prepare-softhsm2.sh so that it sets the PIN to
    "1234".

  - Move contents of bin/tests/system/pkcs11/prereq.sh to
    bin/tests/system/pkcs11/setup.sh as the former was creating a file
    called "supported" that was getting removed by the latter before
    bin/tests/system/pkcs11/tests.sh could access it.

  - Fix typo in "have_ecx".

(cherry picked from commit 100a230e80f01a777b917b135b4bae9a4ac0e8ae)
2020-03-05 07:00:50 +00:00
Evan Hunt
15afc90941 Merge branch '1647-addtrustedkey-dnskey-v9_16' into 'v9_16'
Resolve "delv 9.16.0, failed to add trusted key '.': ran out of space"

See merge request isc-projects/bind9!3159
2020-03-05 00:44:08 +00:00
Evan Hunt
f827513c53 CHANGES
(cherry picked from commit d805fe821e)
2020-03-04 16:25:32 -08:00
Evan Hunt
d5107fb63a add a system test to check that delv loads trust anchors correctly
(cherry picked from commit a81ae32d8a)
2020-03-04 15:42:12 -08:00
Tony Finch
48860528d0 Fix dns_client_addtrustedkey(dns_rdatatype_dnskey)
Use a buffer that is big enough for DNSKEY records as well as DS
records.

(cherry picked from commit 689ef89b67)
2020-03-04 15:42:12 -08:00
Witold Krecicki
3d1a5e3ebb Merge branch 'wpk-use-pthread-rwlock-by-default-v9_16' into 'v9_16'
Use pthread rwlocks by default

See merge request isc-projects/bind9!3156
2020-03-04 11:36:06 +00:00
Witold Kręcicki
d6b4493aa9 Add release notes for pthread rwlocks change
(cherry picked from commit 4ca5c02d0e)
2020-03-04 10:11:17 +00:00
Witold Kręcicki
16cedf6e45 Use pthread rwlocks by default
(cherry picked from commit ad03c22e97)
2020-03-04 10:11:17 +00:00
Witold Krecicki
805a44eaff Merge branch 'wpk/perfwork-7-multilocked-badcache-v9_16' into 'v9_16'
Wpk/perfwork 7 multilocked badcache v9 16

See merge request isc-projects/bind9!3155
2020-03-04 10:07:55 +00:00
Witold Kręcicki
3212ab0052 Workaround for clang static analyzer bug.
(cherry picked from commit 6c8f309745)
2020-03-04 10:48:59 +01:00
Witold Kręcicki
1296e48e11 Badcache with multiple locks.
Previously badcache used one single mutex for everything, which
was causing performance issues. Use one global rwlock for the whole
hashtable and per-bucket mutexes.

(cherry picked from commit 47e5f5564c)
2020-03-04 10:48:59 +01:00
Mark Andrews
6bfe3fb988 Merge branch '1656-masterformat-system-test-failed-missing-sleep-1-v9_16' into 'v9_16'
properly wait for zone to be loaded

See merge request isc-projects/bind9!3153
2020-03-04 07:45:38 +00:00
Mark Andrews
50a03f82b2 properly wait for zone to be loaded
(cherry picked from commit 0abcface49)
2020-03-04 18:16:42 +11:00
Mark Andrews
c90d788d5b Merge branch 'marka-check-touched-v9_16' into 'v9_16'
Marka check touched v9 16

See merge request isc-projects/bind9!3147
2020-03-03 22:34:38 +00:00
Mark Andrews
e01e4d6921 Add CHANGES entry
(cherry picked from commit 64474db14e)
2020-03-04 09:11:47 +11:00
Mark Andrews
3e08796e85 Restart zone maintenance if it had been stalled.
(cherry picked from commit f171347b5f)
2020-03-04 09:11:46 +11:00
Mark Andrews
3cdfa9758b Check inline master zones that are touched reload correctly.
(cherry picked from commit 50e079d6c3)
2020-03-04 09:11:46 +11:00
Witold Krecicki
aa365bc905 Merge branch 'wpk/socket-destroy-race-v9_16' into 'v9_16'
Fix a race in isc_socket destruction.

See merge request isc-projects/bind9!3144
2020-03-03 09:02:14 +00:00
Witold Kręcicki
e4d39f57ff Fix a race in isc_socket destruction.
There was a very slim chance of a race between isc_socket_detach and
process_fd: isc_socket_detach decrements references to 0, and before it
calls destroy gets preempted. Second thread calls process_fd, increments
socket references temporarily to 1, and then gets preempted, first thread
then hits assertion in destroy() as the reference counter is now 1 and
not 0.

(cherry picked from commit 81ba0fe0e6)
2020-03-03 09:26:54 +01:00
Mark Andrews
b9a9407514 Merge branch '1627-call-set_resigntime-and-zone_settimer-v9_16' into 'v9_16'
Resolve "inline re-signing stops"

See merge request isc-projects/bind9!3138
2020-03-03 06:13:02 +00:00
Mark Andrews
d768a69377 add release note entry
(cherry picked from commit 23ce0f32e5)
2020-03-03 16:50:56 +11:00
Mark Andrews
14cf433d77 Add CHANGES note
(cherry picked from commit 905549f061)
2020-03-03 16:11:24 +11:00
Ondřej Surý
633f07e298 Adjust lock/unlock in zone_rekey()
(cherry picked from commit aaaa7e67fa)
2020-03-03 16:10:45 +11:00
Mark Andrews
b301dfcfe8 Ensure that resigintime and the zone timer are set
(cherry picked from commit a6626594aa)
2020-03-03 16:10:45 +11:00
Matthijs Mekking
8b34aeb874 Add more zone locks
Add more zone locks around code that touches zone timer setting
in failure modes.

(cherry picked from commit 143d1c9767)
2020-03-03 16:10:45 +11:00
Mark Andrews
f67202587f Always call set_resigntime with the zone lock held
(cherry picked from commit 7212961849)
2020-03-03 16:10:45 +11:00
Mark Andrews
7f86372e5a Always call zone_settimer()
zone_needdump() could potentially not call zone_settimer() so
explitly call zone_settimer() as zone->resigntime could have
gone backward.

(cherry picked from commit 5ec57f31b0)
2020-03-03 16:10:45 +11:00
Mark Andrews
91f75acb27 Call set_resigntime() in receive_secure_serial()
With RRSIG records no longer being signed with the full
sig-validity-interval we need to ensure the zone->resigntime
as it may need to be set to a earlier time.

(cherry picked from commit 5d1611afdc)
2020-03-03 16:10:45 +11:00
Michał Kępień
690591c3c9 Merge branch '1640-add-ZLIB_LIBS-to-ISCLIBS-v9_16' into 'v9_16'
[v9_16] Add ZLIB_LIBS to ISCLIBS

See merge request isc-projects/bind9!3131
2020-02-28 14:39:02 +00:00
Michał Kępień
69974ea278 Add ZLIB_LIBS to ISCLIBS
When --with-zlib is passed to ./configure (or when the latter
autodetects zlib's presence), libisc uses certain zlib functions and
thus libisc's users should be linked against zlib in that case.  Adjust
Makefile variables appropriately to prevent shared build failures caused
by underlinking.

(cherry picked from commit fc967ba092)
2020-02-28 15:22:59 +01:00
Witold Krecicki
0e6a8e8dc8 Merge branch 'wpk/perfwork-3-small-nits-v9_16' into 'v9_16'
Wpk/perfwork 3 small nits v9 16

See merge request isc-projects/bind9!3130
2020-02-28 09:36:49 +00:00
Evan Hunt
d794d85ce1 comments
(cherry picked from commit 0b76d8a490)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
e11a8e832e Don't define NS_CLIENT_TRACE by default
(cherry picked from commit 4b6a064972)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
fbc81f4ed7 Increase inactivehandles and inactivereqs size for better reuse.
(cherry picked from commit 4791263def)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
1e1c3f2e7f Increase nodelock count for both cache and regular db.
(cherry picked from commit 0344684385)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
3e3350809e Use RESOLVER_NTASKS_PERCPU - 32 for regular tuning, 8 for small
(cherry picked from commit 0d80266f7e)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
bd33adfb67 use SO_INCOMING_CPU for UDP sockets
(cherry picked from commit 517e6eccdf)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
0edf2e290b Remove some stale fields from ns_client_t; make sendbuf allocated on heap
(cherry picked from commit 8c6c07286f)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
1af2ca358e Don't update LRU if the node was recently used.
Updating LRU requires write-locking the node, which causes contention.
Update LRU only if time difference is large enough.

(cherry picked from commit fe584c01cc)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
4e422b3f10 We don't need to fill udp local address every time since we are bound to it.
(cherry picked from commit a658f7976c)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
d0b8c6a378 Don't check if the client is on recursing list (requires locking) if it's not RECURSING
(cherry picked from commit 938b61405b)
2020-02-28 10:05:25 +01:00
Witold Kręcicki
f7039eb27e Use the original threadid when sending a UDP packet to decrease probability of context switching
(cherry picked from commit eb874608c1)
2020-02-28 10:05:25 +01:00
Mark Andrews
68748443db Merge branch '1638-rrsig-soa-and-re-signing-v9_16' into 'v9_16'
Resolve "RRSIG(SOA) and re-signing."

See merge request isc-projects/bind9!3128
2020-02-28 00:27:20 +00:00
Mark Andrews
e2551b794f capture named-journalprint output
(cherry picked from commit 88c828cb9f)
2020-02-28 10:05:45 +11:00
Mark Andrews
761f66e2e3 sort RRSIG(SOA) to be last of RRSIGs with a common re-resign time
(cherry picked from commit a24fd55836)
2020-02-28 10:05:44 +11:00
Mark Andrews
9a16804eee use the full sig-validity-interval for RRSIG(SOA)
(cherry picked from commit 660dc3eba7)
2020-02-28 10:05:44 +11:00
Mark Andrews
994aa0a28e Merge branch 'marka-coverity-stop-taint-v9_16' into 'v9_16'
Simplify hash computation to prevent pointer being classed as tainted.

See merge request isc-projects/bind9!3127
2020-02-27 22:27:23 +00:00
Mark Andrews
aace42d663 Simplify hash computation to prevent pointer being classed as tainted.
mem.c:add_trace_entry() -> isc_hash_function() -> isc_siphash24()

129        for (; in != end; in += 8) {

	6. byte_swapping: Performing a byte swapping operation on
	in implies that it came from an external source, and is
	therefore tainted.

130                uint64_t m = U8TO64_LE(in);

(cherry picked from commit 8c983a7ebd)
2020-02-28 09:06:09 +11:00
Witold Krecicki
099540b8f5 Merge branch '1623-assertion-failure-ns-client-endrequest-v9_16' into 'v9_16'
Don't issue ns_client_endrequest on a NS_CLIENTSTATE_READY client.

See merge request isc-projects/bind9!3123
2020-02-27 12:41:48 +00:00
Witold Kręcicki
c8dd7e07cd Don't issue ns_client_endrequest on a NS_CLIENTSTATE_READY client.
Fix a potential assertion failure on shutdown in ns__client_endrequest.
Scenario:
1. We are shutting down, interface->clientmgr is gone.
2. We receive a packet, it gets through ns__client_request
3. mgr == NULL, return
4. isc_nmhandle_detach calls ns_client_reset_cb
5. ns_client_reset_cb calls ns_client_endrequest
6. INSIST(client->state == NS_CLIENTSTATE_WORKING ||
          client->state == NS_CLIENTSTATE_RECURSING) is not met
   - we haven't started processing this packet so
   client->state == NS_CLIENTSTATE_READY.
As a solution - don't do anything in ns_client_reset_cb if the client
is still in READY state.

(cherry picked from commit b0888ff039)
2020-02-27 12:08:02 +00:00
Witold Krecicki
9f7acb1dd0 Merge branch 'wpk/perfwork-5-isc-result-rwlock-v9_16' into 'v9_16'
Use isc_rwlock for isc_result tables

See merge request isc-projects/bind9!3124
2020-02-27 11:39:43 +00:00
Witold Kręcicki
a308064f9f Use isc_rwlock for isc_result tables
(cherry picked from commit 00f2146265)
2020-02-27 12:07:16 +01:00
Witold Krecicki
af500373e9 Merge branch 'wpk/perfwork-4-compressctx-arena-v9_16' into 'v9_16'
Add an arena to compressctx

See merge request isc-projects/bind9!3122
2020-02-27 09:12:39 +00:00
Witold Kręcicki
3dfa493f16 Add an arena to compressctx
(cherry picked from commit 3a3b5f557a)
2020-02-27 08:54:02 +01:00
Evan Hunt
c9996ae871 Merge branch 'each-speedup-serve-stale-test-v9_16' into 'v9_16'
Speed up serve-stale test

See merge request isc-projects/bind9!3121
2020-02-27 07:28:55 +00:00
Evan Hunt
8d3efd031b send bursts of queries in parallel to reduce test runtime
sending each group of queries simultaneously, and then checking the
output after the last one finishes, reduces the runtime of the
serve-stale test by about six minutes.

(cherry picked from commit 195d25b222)
2020-02-26 23:02:07 -08:00
Evan Hunt
817e2aaf14 stop testing 'serve-stale yes' and 'serve-fail no' alternate syntax
"yes" and "no" are permissible synonyms for "on" and "off", which
use exactly the same code paths. making sure they work isn't a good
use of 80 seconds of test time.

(cherry picked from commit 027601cd3e)
2020-02-26 23:02:07 -08:00
Evan Hunt
5691da9e9e use "on|off" in rndc -h output to match the man page
(cherry picked from commit 770bf4980f)
2020-02-26 23:02:07 -08:00
Evan Hunt
7bd96b9c24 Merge branch 'each-cosmetic-fixes-v9_16' into 'v9_16'
minor cosmetic fixes

See merge request isc-projects/bind9!3119
2020-02-25 19:55:11 +00:00
Evan Hunt
4926c232cd minor cosmetic fixes
- the configuration summary reported zlib compression was not
  supported even when it was.
- when bind.keys.h was regenerated it violated clang-format style.

(cherry picked from commit beda680f90)
2020-02-25 11:20:58 -08:00
Evan Hunt
7624ae6af8 Merge branch '1632-spelling-take2-v9_16' into 'v9_16'
some Fossies-reported spelling errors were accidentally left unfixed

See merge request isc-projects/bind9!3111
2020-02-21 22:17:54 +00:00
Evan Hunt
f0972d5bbd some Fossies-reported spelling errors were accidentally left unfixed
(cherry picked from commit a2aa29ed4f)
2020-02-21 14:15:18 -08:00
Evan Hunt
863f33f3eb Merge branch 'each-dlz-build-v9_16' into 'v9_16'
fix build errors in DLZ modules

See merge request isc-projects/bind9!3109
2020-02-21 17:22:24 +00:00
Evan Hunt
bb2dec1697 fix build errors in DLZ modules
(cherry picked from commit a06620fe59)
2020-02-21 09:21:07 -08:00
Michał Kępień
4f9e0936f0 Merge branch 'michal/clean-up-with-tuning-large-remnants-v9_16' into 'v9_16'
[v9_16] Clean up --with-tuning=large remnants

See merge request isc-projects/bind9!3107
2020-02-21 13:30:17 +00:00
Michał Kępień
01646805bb Clean up --with-tuning=large remnants
The change introduced by commit be159f5565
was not fully complete.  Adjust ./configure summary so that it reflects
the new way the --with-tuning switch works, fixing the Autoconf variable
used for determining the value of that switch.  Fix win32utils/Configure
so that it behaves the same way as its Unix counterpart.

(cherry picked from commit a5fc3a6364)
2020-02-21 13:43:16 +01:00
Evan Hunt
777ad343cc Merge branch '1632-spelling-v9_16' into 'v9_16'
fix spelling errors reported by Fossies.

See merge request isc-projects/bind9!3105
2020-02-21 07:49:44 +00:00
Mark Andrews
c6f73b5d0c update signatures
(cherry picked from commit 40fc5809cd)
2020-02-21 07:05:31 +00:00
Evan Hunt
11a0d771f9 fix spelling errors reported by Fossies.
(cherry picked from commit ba0313e649)
2020-02-21 07:05:31 +00:00
Mark Andrews
d133acc8bb Merge branch 'marka-fix-signature-test-v9_16' into 'v9_16'
Fix code to generate the test signatues.

See merge request isc-projects/bind9!3104
2020-02-21 06:51:32 +00:00
Mark Andrews
5aa1222cdf Fix code to generate the test signatues.
* ctx needs to be destroyed before it is regenerated.
* emit the name of the signature to be replaced.
* cleanup memory before asserting so post longjump doesn't detect a
  memory leak.
* comment code.

(cherry picked from commit 3a8c8a2a31)
2020-02-21 17:43:01 +11:00
Ondřej Surý
bfdd704889 Merge branch 'cherry-pick-e4671ef2' into 'v9_16'
Merge branch 'ondrej/fix-crash-on-arm64-from-weak-cmpxchg' into 'master'

See merge request isc-projects/bind9!3100
2020-02-20 19:57:09 +00:00
Ondřej Surý
36987a98d1 Merge branch 'ondrej/fix-crash-on-arm64-from-weak-cmpxchg' into 'master'
Fix crash on arm64 from using atomic_compare_exchange_weak outside of the loop

See merge request isc-projects/bind9!3042

(cherry picked from commit e4671ef2fa)

fa68a0d8 Added atomic_compare_exchange_strong_acq_rel macro
4cf275ba Replace non-loop usage of atomic_compare_exchange_weak with strong variant
4ff887db Add arm64 to GitLab CI
2020-02-20 19:21:01 +00:00
Michał Kępień
ab2676f74e Merge branch 'michal/make-a-sed-script-in-doc-arm-makefile.in-portable-v9_16' into 'v9_16'
[v9_16] Make a sed script in doc/arm/Makefile.in portable

See merge request isc-projects/bind9!3097
2020-02-20 11:27:44 +00:00
Michał Kępień
19be2e7efa Make a sed script in doc/arm/Makefile.in portable
BSD sed does not recognize \s as a whitespace matching token.  Make the
sed script in doc/arm/Makefile.in which ensures GitLab identifiers are
not split across lines portable by replacing \s with [[:space:]].

(cherry picked from commit b25e6b51f6)
2020-02-20 12:24:15 +01:00
Michał Kępień
0dfa6afa09 Merge branch 'michal/increase-lifetime-of-docs-sid-amd64-artifacts-v9_16' into 'v9_16'
[v9_16] Increase lifetime of docs:sid:amd64 artifacts

See merge request isc-projects/bind9!3096
2020-02-20 10:57:37 +00:00
Michał Kępień
e09e5cd7f5 Increase lifetime of docs:sid:amd64 artifacts
Artifacts generated by the docs:sid:amd64 job need to be retained longer
than for other jobs as they are used for building bind.isc.org contents.
If these artifacts are removed too quickly, pipelines in the pages/bind
GitLab project start failing, preventing content updates from being
published.  Increase lifetime of the relevant job artifacts to prevent
this from happening.

(cherry picked from commit 9751ba5a75)
2020-02-20 11:53:18 +01:00
Michał Kępień
d6777801a3 Merge branch 'michal/fix-lib-isc-tests-socket_test-hangs-v9_16' into 'v9_16'
[v9_16] Fix lib/isc/tests/socket_test hangs

See merge request isc-projects/bind9!3093
2020-02-20 10:49:48 +00:00
Witold Krecicki
e60ea71ec1 Fix lib/isc/tests/socket_test hangs
(cherry picked from commit 0fe149b2fa)
2020-02-20 11:40:51 +01:00
Witold Krecicki
eed269270e Merge branch 'wpk/perfork-2-libuv-tuning-v9_16' into 'v9_16'
Perfwork 2/6 - libuv tuning - support for uv_{recv/send}mmsg, use of libuv-provided uv_export/import

See merge request isc-projects/bind9!3084
2020-02-18 14:02:47 +00:00
Witold Kręcicki
32d00479e6 Use libuv-provided uv_{export,import} if available.
We were using our own versions of isc_uv_{export,import} functions
for multithreaded TCP listeners. Upcoming libuv version will
contain proper uv_{export,import} functions - use them if they're
available.
2020-02-18 14:21:16 +01:00
Witold Kręcicki
85c2f8dab5 Make nm->recvbuf larger and heap allocated, to allow uv_recvmmsg usage.
Upcoming version of libuv will suport uv_recvmmsg and uv_sendmmsg. To
use uv_recvmmsg we need to provide a larger buffer and be able to
properly free it.
2020-02-18 14:21:16 +01:00
Witold Krecicki
4880224a6a Merge branch 'wpk/perfwork-1-client-mctxpool-taskpool-v9_16' into 'v9_16'
Perfwork 1/6 - Use thread-sharded mctxpool and taskpool in ns_client

See merge request isc-projects/bind9!3083
2020-02-18 11:38:42 +00:00
Witold Kręcicki
1b9df6779d Use thread-friendly mctxpool and taskpool in ns_client.
Make ns_client mctxpool more thread-friendly by sharding it by
netmgr threadid, use task pool also sharded by thread id to avoid
lock contention.
2020-02-18 11:57:46 +01:00
Witold Kręcicki
777fb6a6f2 Make isc_task_pause/isc_task_unpause thread safe.
isc_task_pause/unpause were inherently thread-unsafe - a task
could be paused only once by one thread, if the task was running
while we paused it it led to races. Fix it by making sure that
the task will pause if requested to, and by using a 'pause reference
counter' to count task pause requests - a task will be unpaused
iff all threads unpause it.

Don't remove from queue when pausing task - we lock the queue lock
(expensive), while it's unlikely that the task will be running -
and we'll remove it anyway in dispatcher
2020-02-18 10:24:06 +01:00
Evan Hunt
8d0360474c Merge branch 'each-tweak-penalty-v9_16' into 'v9_16'
adjust the clang-format penalties to reduce string breaking

See merge request isc-projects/bind9!3080
2020-02-17 23:04:29 +00:00
Evan Hunt
25496b2299 adjust the clang-format penalties to reduce string breaking
this corrects some style glitches such as:
```
        long_function_call(arg, arg2, arg3, arg4, arg5, "str"
                                                        "ing");
```
...by adjusting the penalties for breaking strings and call
parameter lists.

(cherry picked from commit 0002377dca)
2020-02-17 14:43:46 -08:00
Ondřej Surý
887244ae86 Merge branch 'ondrej/clang-format-fixups-v9_16' into 'v9_16'
clang-format fixups v9_16

See merge request isc-projects/bind9!3074
2020-02-16 17:40:51 +00:00
Ondřej Surý
649fe9be35 Fixup the missing clang-format bits
(cherry picked from commit 3832e3ecc9)
2020-02-16 18:07:27 +01:00
Ondřej Surý
a16d99d3fe Switch to clang-format-10 that's more accessible on more platforms
(cherry picked from commit cbb127eb43)
2020-02-16 18:03:48 +01:00
Ondřej Surý
f6546a2466 Merge branch 'cherry-pick-a04cdde4' into 'v9_16'
Merge branch '46-enforce-clang-format-rules' into 'master'

See merge request isc-projects/bind9!3064
2020-02-14 08:46:35 +00:00
Ondřej Surý
829b461c54 Merge branch '46-enforce-clang-format-rules' into 'master'
Start enforcing the clang-format rules on changed files

Closes #46

See merge request isc-projects/bind9!3063

(cherry picked from commit a04cdde45d)

d2b5853b Start enforcing the clang-format rules on changed files
618947c6 Switch AlwaysBreakAfterReturnType from TopLevelDefinitions to All
654927c8 Add separate .clang-format files for headers
5777c44a Reformat using the new rules
60d29f69 Don't enforce copyrights on .clang-format
2020-02-14 08:45:59 +00:00
Ondřej Surý
99a019eb06 Merge branch 'cherry-pick-d3b49b66' into 'v9_16'
Merge branch 'each-style-tweak' into 'master'

See merge request isc-projects/bind9!3062
2020-02-14 05:57:37 +00:00
Ondřej Surý
cdef20bb66 Merge branch 'each-style-tweak' into 'master'
adjust clang-format options to get closer to ISC style

See merge request isc-projects/bind9!3061

(cherry picked from commit d3b49b6675)

0255a974 revise .clang-format and add a C formatting script in util
e851ed0b apply the modified style
2020-02-14 05:35:29 +00:00
Ondřej Surý
c646c20e79 Merge branch 'cherry-pick-67b68e06' into 'v9_16'
Merge branch '46-add-curly-braces' into 'master'

See merge request isc-projects/bind9!3060
2020-02-13 22:44:02 +00:00
Ondřej Surý
2e55baddd8 Merge branch '46-add-curly-braces' into 'master'
Add curly braces using uncrustify and then reformat with clang-format back

Closes #46

See merge request isc-projects/bind9!3057

(cherry picked from commit 67b68e06ad)

36c6105e Use coccinelle to add braces to nested single line statement
d14bb713 Add copy of run-clang-tidy that can fixup the filepaths
056e133c Use clang-tidy to add curly braces around one-line statements
2020-02-13 21:28:35 +00:00
Tinderbox User
6270e602ea Merge branch 'prep-release' into v9_16 2020-02-12 20:03:44 +00:00
Tinderbox User
29696e495f prep v9.16.0 2020-02-12 20:03:16 +00:00
Michał Kępień
932d618a13 Merge branch 'michal/prepare-release-notes-for-bind-9.16.0' into 'v9_16'
Prepare release notes for BIND 9.16.0

See merge request isc-projects/bind9!2881
2020-02-12 15:06:32 +00:00
Michał Kępień
d75b945a30 Add libuv information to win32utils/build.txt 2020-02-12 16:04:04 +01:00
Michał Kępień
241c7e91fe Fix broken link in configure.ac 2020-02-12 16:04:04 +01:00
Michał Kępień
e177963906 Update PLATFORMS for BIND 9.16 2020-02-12 16:04:04 +01:00
Michał Kępień
db3ce9c0a9 Update README for BIND 9.16 2020-02-12 16:04:04 +01:00
Michał Kępień
5eded8d66e Prepare release notes for BIND 9.16.0
- Merge release notes from all 9.15.x releases, leaving only those
    which do not apply to BIND 9.14.

  - Add missing GitLab/RT issue identifiers.

  - Update "Introduction", "Note on Version Numbering", and "End of
    Life" sections with BIND 9.16 information.
2020-02-12 16:04:04 +01:00
Ondřej Surý
cac3c8e6fb Merge branch 'cherry-pick-7099e79a' into 'v9_16'
Merge branch '46-just-use-clang-format-to-reformat-sources' into 'master'

See merge request isc-projects/bind9!3053
2020-02-12 14:53:37 +00:00
Ondřej Surý
c931d8e417 Merge branch '46-just-use-clang-format-to-reformat-sources' into 'master'
Reformat source code with clang-format

Closes #46

See merge request isc-projects/bind9!2156

(cherry picked from commit 7099e79a9b)

4c3b063e Import Linux kernel .clang-format with small modifications
f50b1e06 Use clang-format to reformat the source files
11341c76 Update the definition files for Windows
df6c1f76 Remove tkey_test (which is no-op anyway)
2020-02-12 14:51:18 +00:00
Michal Nowak
dbe15330fe Merge branch 'mnowak/coverity-disable-web-tag-v9_16' into 'v9_16'
[v9_16] Run Coverity Scan only when specific variables are present

See merge request isc-projects/bind9!3054
2020-02-12 14:47:52 +00:00
Michal Nowak
b833064648 Run Coverity Scan only when specific variables are present
Submissions to Coverity Scan should be limited to those originated from
release branches and only from a specific schedule which holds
COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN variables.

(cherry picked from commit 48530aa21395414b0f9788ea5ab158b2b09ab977)
2020-02-12 14:47:52 +00:00
1766 changed files with 125622 additions and 186810 deletions

73
.clang-format Normal file
View File

@@ -0,0 +1,73 @@
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterEnum: false
AfterStruct: false
AfterUnion: false
AfterControlStatement: MultiLine
AfterFunction: false # should also be MultiLine, but not yet supported
AfterExternBlock: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AlwaysBreakAfterReturnType: All
Cpp11BracedListStyle: false
ColumnLimit: 80
AlignAfterOpenBracket: Align
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
AlignEscapedNewlines: Left
DerivePointerAlignment: false
PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
Priority: 10
- Regex: '^<dns/'
Priority: 15
- Regex: '^<dst/'
Priority: 20
- Regex: '^<isccc/'
Priority: 25
- Regex: '^<isccfg/'
Priority: 30
- Regex: '^<ns/'
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<bind9/'
Priority: 45
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
Priority: 55
- Regex: '^".*"'
Priority: 99
- Regex: '<openssl/'
Priority: 1
- Regex: '<(mysql|protobuf-c)/'
Priority: 1
- Regex: '.*'
Priority: 0
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8

61
.clang-format.headers Normal file
View File

@@ -0,0 +1,61 @@
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterEnum: false
AfterStruct: false
AfterUnion: false
AfterControlStatement: MultiLine
AfterFunction: false # should also be MultiLine, but not yet supported
AfterExternBlock: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AlwaysBreakAfterReturnType: All
Cpp11BracedListStyle: false
ColumnLimit: 80
AlignAfterOpenBracket: Align
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
AlignEscapedNewlines: Left
DerivePointerAlignment: false
PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<isc/'
Priority: 2
- Regex: '^<dns/'
Priority: 3
- Regex: '^<iscccc/'
Priority: 4
- Regex: '^<isccfg/'
Priority: 5
- Regex: '^<ns/'
Priority: 6
- Regex: '^<bind9/)'
Priority: 7
- Regex: '^(<[^/]*)/)'
Priority: 8
- Regex: '<[[:alnum:].]+>'
Priority: 1
- Regex: '".*"'
Priority: 9
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8

1
.gitattributes vendored
View File

@@ -7,4 +7,5 @@
/doc/dev export-ignore
/util/** export-ignore
/util/bindkeys.pl -export-ignore
/util/check-make-install.in -export-ignore
/util/mksymtbl.pl -export-ignore

2
.gitignore vendored
View File

@@ -12,6 +12,7 @@
*_test
*.ipch # vscode/intellisense precompiled header
*~
__pycache__/
.ccache/
.cproject
.deps/
@@ -61,3 +62,4 @@ timestamp
/cppcheck_html/
/cppcheck.results
/tsan
/util/check-make-install

File diff suppressed because it is too large Load Diff

7
.pylintrc Normal file
View File

@@ -0,0 +1,7 @@
[MASTER]
disable=
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
R0801, # duplicate-code
C0103, # invalid-name

View File

@@ -24,7 +24,7 @@ string_escape_char2 = 0 # number
# Improvements to template detection may make this option obsolete.
tok_split_gte = false # false/true
# Control what to do with the UTF-8 BOM (recommed 'remove')
# Control what to do with the UTF-8 BOM (recommend 'remove')
utf8_bom = ignore # ignore/add/remove/force
# If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8
@@ -1352,7 +1352,7 @@ cmt_insert_func_header = "" # string
# Will substitute $(class) with the class name.
cmt_insert_class_header = "" # string
# The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment.
# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment.
# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff.
cmt_insert_oc_msg_header = "" # string

326
CHANGES
View File

@@ -1,3 +1,293 @@
5449. [bug] Fix a socket shutdown race in netmgr udp. [GL #1938]
5448. [bug] Fix a race condition in isc__nm_tcpdns_send().
[GL #1937]
5447. [bug] IPv6 addresses ending in "::" could break YAML
parsing. A "0" is now appended to such addresses
in YAML output from dig, mdig, delv, and dnstap-read.
[GL #1952]
5446. [bug] The validator could fail to accept a properly signed
RRset if an unsupported algorithm appeared earlier in
the DNSKEY RRset than a supported algorithm. It could
also stop if it detected a malformed public key.
[GL #1689]
5443. [bug] The "primary" and "secondary" keywords, when used
as parameters for "check-names", were not
processed correctly and were being ignored. [GL #1949]
5441. [bug] ${LMDB_CFLAGS} missing from make/includes.in
[GL #1955]
5440. [test] Properly handle missing kyua. [GL #1950]
5439. [bug] The dsset returned by dns_keynode_dsset() was not
thread safe. [GL #1926]
--- 9.16.4 released ---
5438. [bug] Fix a race in TCP accepting code. [GL #1930]
5437. [bug] Fix a data race in lib/dns/resolver.c:log_formerr().
[GL #1808]
5436. [security] It was possible to trigger an INSIST when determining
whether a record would fit into a TCP message buffer.
(CVE-2020-8618) [GL #1850]
5435. [tests] Add RFC 4592 responses examples to the wildcard system
test. [GL #1718]
5434. [security] It was possible to trigger an INSIST in
lib/dns/rbtdb.c:new_reference() with a particular zone
content and query patterns. (CVE-2020-8619) [GL #1111]
[GL #1718]
5431. [func] Reject DS records at the zone apex when loading
master files. Log but otherwise ignore attempts to
add DS records at the zone apex via UPDATE. [GL #1798]
5430. [doc] Update docs - with netmgr, a separate listening socket
is created for each IPv6 interface (just as with IPv4).
[GL #1782]
5428. [bug] Clean up GSSAPI resources in nsupdate only after taskmgr
has been destroyed. Thanks to Petr Menšík. [GL !3316]
5426. [bug] Don't abort() when setting SO_INCOMING_CPU on the socket
fails. [GL #1911]
5425. [func] The default value of "max-stale-ttl" has been changed
from 1 week to 12 hours. [GL #1877]
5424. [bug] With KASP, when creating a successor key, the "goal"
state of the current active key (predecessor) was not
changed and thus never removed from the zone. [GL #1846]
5423. [bug] Fix a bug in keymgr_key_has_successor(): it incorrectly
returned true if any other key in the keyring had a
successor. [GL #1845]
5422. [bug] When using dnssec-policy, print correct key timing
metadata. [GL #1843]
5421. [bug] Fix a race that could cause named to crash when looking
up the nodename of an RBT node if the tree was modified.
[GL #1857]
5420. [bug] Add missing isc_{mutex,conditional}_destroy() calls
that caused a memory leak on FreeBSD. [GL #1893]
5418. [bug] delv failed to parse deprecated trusted-keys-style
trust anchors. [GL #1860]
5416. [bug] Fix a lock order inversion in lib/isc/unix/socket.c.
[GL #1859]
5415. [test] Address race in dnssec system test that led to
test failures. [GL #1852]
5414. [test] Adjust time allowed for journal truncation to occur
in nsupdate system test to avoid test failure.
[GL #1855]
5413. [test] Address race in autosign system test that led to
test failures. [GL #1852]
5412. [bug] 'provide-ixfr no;' failed to return up-to-date responses
when the serial was greater than or equal to the
current serial. [GL #1714]
5411. [cleanup] TCP accept code has been refactored to use a single
accept() and pass the accepted socket to child threads
for processing. [GL !3320]
5409. [performance] When looking up NSEC3 data in a zone database, skip the
check for empty non-terminal nodes; the NSEC3 tree does
not have any. [GL #1834]
5408. [protocol] Print Extended DNS Errors if present in OPT record.
[GL #1835]
5407. [func] Zone timers are now exported via statistics channel.
Thanks to Paul Frieden, Verizon Media. [GL #1232]
5405. [bug] 'named-checkconf -p' could include spurious text in
server-addresses statements due to an uninitialized DSCP
value. [GL #1812]
--- 9.16.3 released ---
5404. [bug] 'named-checkconf -z' could incorrectly indicate
success if errors were found in one view but not in a
subsequent one. [GL #1807]
5403. [func] Do not set UDP receive/send buffer sizes - use system
defaults. [GL #1713]
5402. [bug] On FreeBSD, use SO_REUSEPORT_LB instead of SO_REUSEPORT.
Enable use of SO_REUSEADDR on all platforms which
support it. [GL !3365]
5401. [bug] The number of input queues allocated during dnstap
initialization was too low, which could prevent some
dnstap data from being logged. [GL #1795]
5400. [func] Add engine support to OpenSSL EdDSA implementation.
[GL #1763]
5399. [func] Add engine support to OpenSSL ECDSA implementation.
[GL #1534]
5398. [bug] Named could fail to restart if a zone with a double
quote (") in its name was added with 'rndc addzone'.
[GL #1695]
5397. [func] Update PKCS#11 EdDSA implementation to PKCS#11 v3.0.
Thanks to Aaron Thompson. [GL !3326]
5396. [func] When necessary (i.e. in libuv >= 1.37), use the
UV_UDP_RECVMMSG flag to enable recvmmsg() support in
libuv. [GL #1797]
5395. [security] Further limit the number of queries that can be
triggered from a request. Root and TLD servers
are no longer exempt from max-recursion-queries.
Fetches for missing name server address records
are limited to 4 for any domain. (CVE-2020-8616)
[GL #1388]
5394. [cleanup] Named formerly attempted to change the effective UID and
GID in named_os_openfile(), which could trigger a
spurious log message if they were already set to the
desired values. This has been fixed. [GL #1042]
[GL #1090]
5392. [bug] It was possible for named to crash during shutdown
or reconfiguration if an RPZ zone was still being
updated. [GL #1779]
5390. [security] Replaying a TSIG BADTIME response as a request could
trigger an assertion failure. (CVE-2020-8617)
[GL #1703]
5389. [bug] Finish PKCS#11 code cleanup, fix a couple of smaller
bugs and use PKCS#11 v3.0 EdDSA macros and constants.
Thanks to Aaron Thompson. [GL !3391]
5387. [func] Warn about AXFR streams with inconsistent message IDs.
[GL #1674]
5386. [cleanup] Address Coverity warnings in lib/dns/keymgr.c.
[GL #1737]
5385. [func] Make ISC rwlock implementation the default again.
[GL #1753]
5384. [bug] With "dnssec-policy" in effect, "inline-signing" was
implicitly set to "yes". Now "inline-signing" is only
set to "yes" if the zone is not dynamic. [GL #1709]
--- 9.16.2 released ---
5383. [func] Add a quota attach function with a callback and clean up
the isc_quota API. [GL !3280]
5382. [bug] Use clock_gettime() instead of gettimeofday() for
isc_stdtime() function. [GL #1679]
5381. [bug] Fix logging API data race by adding rwlock and caching
logging levels in stdatomic variables to restore
performance to original levels. [GL #1675] [GL #1717]
5380. [contrib] Fix building MySQL DLZ modules against MySQL 8
libraries. [GL #1678]
5378. [bug] Receiving invalid DNS data was triggering an assertion
failure in nslookup. [GL #1652]
5376. [bug] Fix ineffective DNS rebinding protection when BIND is
configured as a forwarding DNS server. Thanks to Tobias
Klein. [GL #1574]
5375. [test] Fix timing issues in the "kasp" system test. [GL #1669]
5374. [bug] Statistics counters tracking recursive clients and
active connections could underflow. [GL #1087]
5373. [bug] Collecting statistics for DNSSEC signing operations
(change 5254) caused an array of significant size (over
100 kB) to be allocated for each configured zone. Each
of these arrays is tracking all possible key IDs; this
could trigger an out-of-memory condition on servers with
a high enough number of zones configured. Fixed by
tracking up to four keys per zone and rotating counters
when keys are replaced. This fixes the immediate problem
of high memory usage, but should be improved in a future
release by growing or shrinking the number of keys to
track upon key rollover events. [GL #1179]
5372. [bug] Fix migration from existing DNSSEC key files
("auto-dnssec maintain") to "dnssec-policy". [GL #1706]
5371. [bug] Improve incremental updates of the RPZ summary
database to reduce delays that could occur when
a policy zone update included a large number of
record deletions. [GL #1447]
5370. [bug] Deactivation of a netmgr handle associated with a
socket could be skipped in some circumstances.
Fixed by deactivating the netmgr handle before
scheduling the asynchronous close routine. [GL #1700]
5368. [bug] Named failed to restart if 'rndc addzone' names
contained special characters (e.g. '/'). [GL #1655]
5367. [bug] Fixed a flaw in the calculation of the zone database
size so that "max-journal-size default" uses the correct
limit. [GL #1661]
--- 9.16.1 released ---
5366. [bug] Fix a race condition with the keymgr when the same
zone plus dnssec-policy is configured in multiple
views. [GL #1653]
5365. [bug] Algorithm rollover was stuck on submitting DS
because keymgr thought it would move to an invalid
state. Fixed by checking the current key against
the desired state, not the existing state. [GL #1626]
5364. [bug] Algorithm rollover waited too long before introducing
zone signatures. It waited to make sure all signatures
were regenerated, but when introducing a new algorithm,
all signatures are regenerated immediately. Only
add the sign delay if there is a predecessor key.
[GL #1625]
5363. [bug] When changing a dnssec-policy, existing keys with
properties that no longer match were not being retired.
[GL #1624]
5361. [bug] named might not accept new connections after
hitting tcp-clients quota. [GL #1643]
5360. [bug] delv could fail to load trust anchors in DNSKEY
format. [GL #1647]
5358. [bug] Inline master zones whose master files were touched
but otherwise unchanged and were subsequently reloaded
may have stopped re-signing. [GL !3135]
5357. [bug] Newly added RRSIG records with expiry times before
the previous earliest expiry times might not be
re-signed in time. This was a side effect of 5315.
[GL !3137]
--- 9.16.0 released ---
5356. [func] Update dnssec-policy configuration statements:
- Rename "zone-max-ttl" dnssec-policy option to
"max-zone-ttl" for consistency with the existing
@@ -40,7 +330,7 @@
5349. [bug] Fix a race in task_pause/unpause. [GL #1571]
5348. [bug] dnssec-settime -Psync was not being honoured.
[GL !2893]
[GL !2925]
--- 9.15.8 released ---
@@ -124,7 +414,7 @@
close all open sockets during shutdown. [GL #1312]
5324. [bug] Change the category of some log messages from general
to the more appopriate catergory of xfer-in. [GL #1394]
to the more appropriate catergory of xfer-in. [GL #1394]
5323. [bug] Fix a bug in DNSSEC trust anchor verification.
[GL !2609]
@@ -172,7 +462,7 @@
See the ARM for configuration details. [GL #1134]
5315. [bug] Apply the inital RRSIG expiration spread fixed
5315. [bug] Apply the initial RRSIG expiration spread fixed
to all dynamically created records in the zone
including NSEC3. Also fix the signature clusters
when the server has been offline for prolonged
@@ -1385,7 +1675,7 @@
4965. [func] Add support for marking options as deprecated.
[GL #322]
4964. [bug] Reduce the probabilty of double signature when deleting
4964. [bug] Reduce the probability of double signature when deleting
a DNSKEY by checking if the node is otherwise signed
by the algorithm of the key to be deleted. [GL #240]
@@ -1469,7 +1759,7 @@
for unsigned zones since change 4596. [GL #209]
4945. [func] BIND can no longer be built without DNSSEC support.
A cryptography provder (i.e., OpenSSL or a hardware
A cryptography provider (i.e., OpenSSL or a hardware
service module with PKCS#11 support) must be
available. [GL #244]
@@ -1528,7 +1818,7 @@
dig (+[no]raflag, +[no]tcflag). [GL #213]
4928. [func] The "dnskey-sig-validity" option allows
"sig-validity-interval" to be overriden for signatures
"sig-validity-interval" to be overridden for signatures
covering DNSKEY RRsets. [GL #145]
4927. [placeholder]
@@ -1867,7 +2157,7 @@
[RT #46725]
4831. [bug] Convert the RRSIG expirytime to 64 bits for
comparisions in diff.c:resign. [RT #46710]
comparisons in diff.c:resign. [RT #46710]
4830. [bug] Failure to configure ATF when requested did not cause
an error in top-level configure script. [RT #46655]
@@ -2093,7 +2383,7 @@
used to append a formatted string to the used region of
a buffer. [RT #46201]
4766. [cleanup] Addresss Coverity warnings. [RT #46150]
4766. [cleanup] Address Coverity warnings. [RT #46150]
4765. [bug] Address potential INSIST in dnssec-cds. [RT #46150]
@@ -2287,7 +2577,7 @@
4719. [bug] Address PVS static analyzer warnings. [RT #45946]
4718. [func] Avoid seaching for a owner name compression pointer
4718. [func] Avoid searching for a owner name compression pointer
more than once when writing out a RRset. [RT #45802]
4717. [bug] Treat replies with QCOUNT=0 as truncated if TC=1,
@@ -6432,7 +6722,7 @@
3518. [bug] Increase the size of dns_rrl_key.s.rtype by one bit
so that all dns_rrl_rtype_t enum values fit regardless
of whether it is teated as signed or unsigned by
of whether it is treated as signed or unsigned by
the compiler. [RT #32792]
3517. [bug] Reorder destruction to avoid shutdown race. [RT #32777]
@@ -7507,7 +7797,7 @@
--- 9.9.0b1 released ---
3186. [bug] Version/db mis-match in rpz code. [RT #26180]
3186. [bug] Version/db mismatch in rpz code. [RT #26180]
3185. [func] New 'rndc signing' option for auto-dnssec zones:
- 'rndc signing -list' displays the current
@@ -8172,7 +8462,7 @@
2998. [func] Add isc_task_beginexclusive and isc_task_endexclusive
to the task api. [RT #22776]
2997. [func] named -V now reports the OpenSSL and libxml2 verions
2997. [func] named -V now reports the OpenSSL and libxml2 versions
it was compiled against. [RT #22687]
2996. [security] Temporarily disable SO_ACCEPTFILTER support.
@@ -11155,7 +11445,7 @@
2096. [bug] libbind: handle applications that fail to detect
res_init() failures better.
2095. [port] libbind: alway prototype inet_cidr_ntop_ipv6() and
2095. [port] libbind: always prototype inet_cidr_ntop_ipv6() and
net_cidr_ntop_ipv6(). [RT #16388]
2094. [contrib] Update named-bootconf. [RT #16404]
@@ -11211,7 +11501,7 @@
2076. [bug] Several files were missing #include <config.h>
causing build failures on OSF. [RT #16341]
2075. [bug] The spillat timer event hander could leak memory.
2075. [bug] The spillat timer event handler could leak memory.
[RT #16357]
2074. [bug] dns_request_createvia2(), dns_request_createvia3(),
@@ -11973,7 +12263,7 @@
1831. [doc] Update named-checkzone documentation. [RT #13604]
1830. [bug] adb lame cache has sence of test reversed. [RT #13600]
1830. [bug] adb lame cache has sense of test reversed. [RT #13600]
1829. [bug] win32: "pid-file none;" broken. [RT #13563]
@@ -12084,7 +12374,7 @@
1796. [func] "rndc freeze/thaw" now freezes/thaws all zones.
1795. [bug] "rndc dumpdb" was not fully documented. Minor
formating issues with "rndc dumpdb -all". [RT #13396]
formatting issues with "rndc dumpdb -all". [RT #13396]
1794. [func] Named and named-checkzone can now both check for
non-terminal wildcard records.
@@ -13261,7 +13551,7 @@
acl.
1393. [port] Bind to individual IPv6 interfaces if IPV6_IPV6ONLY
is not available in the kernel to prevent accidently
is not available in the kernel to prevent accidentally
listening on IPv4 interfaces.
1392. [bug] named-checkzone: update usage.
@@ -14989,7 +15279,7 @@
839. [func] Dump packets for which there was no view or that the
class could not be determined to category "unmatched".
838. [port] UnixWare 7.x.x is now suported by
838. [port] UnixWare 7.x.x is now supported by
bin/tests/system/ifconfig.sh.
837. [cleanup] Multi-threading is now enabled by default only on

View File

@@ -99,7 +99,7 @@ e-mail is not a secure choice for communications concerning undisclosed
security issues so please encrypt your communications to us if possible,
using the ISC Security Officer public key.
Do not discuss undisclosed security vulnerabilites on any public mailing
Do not discuss undisclosed security vulnerabilities on any public mailing
list. ISC has a long history of handling reported vulnerabilities promptly
and effectively and we respect and acknowledge responsible reporters.

View File

@@ -8,8 +8,8 @@
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
## BIND Source Access and Contributor Guidelines
*Feb 22, 2018*
## BIND 9 Source Access and Contributor Guidelines
*May 28, 2020*
### Contents
@@ -19,12 +19,12 @@
### Introduction
Thank you for using BIND!
Thank you for using BIND 9!
BIND is open source software that implements the Domain Name System (DNS)
protocols for the Internet. It is a reference implementation of those
protocols, but it is also production-grade software, suitable for use in
high-volume and high-reliability applications. It is by far the most
high-volume and high-reliability applications. It is very
widely used DNS software, providing a robust and stable platform on top of
which organizations can build distributed computing systems with the
knowledge that those systems are fully compliant with published DNS
@@ -33,20 +33,20 @@ standards.
BIND is and will always remain free and openly available. It can be
used and modified in any way by anyone.
BIND is maintained by the [Internet Systems Consortium](https://www.isc.org),
BIND is maintained by [Internet Systems Consortium](https://www.isc.org),
a public-benefit 501(c)(3) nonprofit, using a "managed open source" approach:
anyone can see the source, but only ISC employees have commit access.
Until recently, the source could only be seen once ISC had published
a release: read access to the source repository was restricted just
as commit access was. That's now changing, with the opening of a
In the past, the source could only be seen once ISC had published
a release; read access to the source repository was restricted just
as commit access was. That has changed, as ISC now provides a
public git mirror to the BIND source tree (see below).
At [Internet Systems Consortium](https://www.isc.org), we're committed to
building communities that are welcoming and inclusive; environments where people
At ISC, we're committed to
building communities that are welcoming and inclusive: environments where people
are encouraged to share ideas, treat each other with respect, and collaborate
towards the best solutions. To reinforce our commitment, the [Internet Systems
Consortium](https://www.isc.org) has adopted the Contributor Covenant version
1.4 as our Code of Conduct for BIND 9 project, as well as for the conduct of our
towards the best solutions. To reinforce our commitment, ISC
has adopted a slightly modified version of the Django
[Code of Conduct](https://gitlab.isc.org/isc-projects/bind9/-/blob/master/CODE_OF_CONDUCT.md) for the BIND 9 project, as well as for the conduct of our
developers throughout the industry.
### <a name="access"></a>Access to source code
@@ -76,7 +76,7 @@ branch, use:
> $ git checkout v9_12
Whenever a branch is ready for publication, a tag will be placed of the
Whenever a branch is ready for publication, a tag is placed of the
form `v9_X_Y`. The 9.12.0 release, for instance, is tagged as `v9_12_0`.
The branch in which the next major release is being developed is called
@@ -86,16 +86,16 @@ The branch in which the next major release is being developed is called
Reports of flaws in the BIND package, including software bugs, errors
in the documentation, missing files in the tarball, suggested changes
or requests for new features, etc, can be filed using
or requests for new features, etc., can be filed using
[https://gitlab.isc.org/isc-projects/bind9/issues](https://gitlab.isc.org/isc-projects/bind9/issues).
Due to a large ticket backlog, we are sometimes slow to respond,
especially if a bug is cosmetic or if a feature request is vague or
low in priority, but we will try at least to acknowledge legitimate
low in priority, but we try at least to acknowledge legitimate
bug reports within a week.
ISC's ticketing system is publicly readable; however, you must have
an account to file a new issue. You can either register locally or
ISC's GitLab system is publicly readable; however, you must have
an account to create a new issue. You can either register locally or
use credentials from an existing account at GitHub, GitLab, Google,
Twitter, or Facebook.
@@ -105,26 +105,26 @@ If you think you may be seeing a potential security vulnerability in BIND
report it immediately by emailing to security-officer@isc.org. Plain-text
e-mail is not a secure choice for communications concerning undisclosed
security issues so please encrypt your communications to us if possible,
using the [ISC Security Officer public key](https://www.isc.org/downloads/software-support-policy/openpgp-key/).
using the [ISC Security Officer public key](https://www.isc.org/pgpkey/).
Do not discuss undisclosed security vulnerabilites on any public mailing list.
Do not discuss undisclosed security vulnerabilities on any public mailing list.
ISC has a long history of handling reported vulnerabilities promptly and
effectively and we respect and acknowledge responsible reporters.
ISC's Security Vulnerability Disclosure Policy is documented at [https://kb.isc.org/article/AA-00861/0](https://kb.isc.org/article/AA-00861/0).
ISC's Security Vulnerability Disclosure Policy is documented at [https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
If you have a crash, you may want to consult
[What to do if your BIND or DHCP server has crashed.](https://kb.isc.org/article/AA-00340/89/What-to-do-if-your-BIND-or-DHCP-server-has-crashed.html)
["What to do if your BIND or DHCP server has crashed."](https://kb.isc.org/docs/aa-00340)
### <a name="contrib"></a>Contributing code
BIND is licensed under the
[Mozilla Public License 2.0](http://www.isc.org/downloads/software-support-policy/isc-license/).
Earier versions (BIND 9.10 and earlier) were licensed under the [ISC License](http://www.isc.org/downloads/software-support-policy/isc-license/)
[Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/).
Earlier versions (BIND 9.10 and earlier) were licensed under the [ISC License](https://www.isc.org/licenses/)
ISC does not require an explicit copyright assignment for patch
contributions. However, by submitting a patch to ISC, you implicitly
certify that you are the author of the code, that you intend to reliquish
certify that you are the author of the code, that you intend to relinquish
exclusive copyright, and that you grant permission to publish your work
under the open source license used for the BIND version(s) to which your
patch will be applied.
@@ -132,7 +132,7 @@ patch will be applied.
#### <a name="bind"></a>BIND code
Patches for BIND may be submitted directly via merge requests in
[ISC's Gitlab](https://gitlab.isc.org/isc-projects/bind9/) source
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source
repository for BIND.
Patches can also be submitted as diffs against a specific version of
@@ -142,10 +142,9 @@ be generated using either `git format-patch` or `git diff`.
Those wanting to write code for BIND may be interested in the
[developer information](doc/dev/dev.md) page, which includes information
about BIND design and coding practices, including discussion of internal
APIs and overall system architecture. (This is a work in progress, and
still quite preliminary.)
APIs and overall system architecture.
Every patch submitted will be reviewed by ISC engineers following our
Every patch submitted is reviewed by ISC engineers following our
[code review process](doc/dev/dev.md#reviews) before it is merged.
It may take considerable time to review patch submissions, especially if
@@ -156,7 +155,7 @@ we're busy with other work, it may take us a long time to get to it.
To ensure your patch is acted on as promptly as possible, please:
* Try to adhere to the [BIND 9 coding style](doc/dev/style.md).
* Run `make` `check` to ensure your change hasn't caused any
* Run `make check` to ensure your change hasn't caused any
functional regressions.
* Document your work, both in the patch itself and in the
accompanying email.
@@ -182,28 +181,23 @@ All functional changes should be documented. There are three types
of documentation in the BIND source tree:
* Man pages are kept alongside the source code for the commands
they document, in files ending in `.docbook`; for example, the
`named` man page is `bin/named/named.docbook`.
* The *BIND 9 Administrator Reference Manual* is mostly in
`doc/arm/Bv9ARM-book.xml`, plus a few other XML files that are included
in it.
they document, in files ending in `.rst`: for example, the
`named` man page is `bin/named/named.rst`.
* The *BIND 9 Administrator Reference Manual* is in the .rst files in
`doc/arm/`; the PDF and HTML versions are automatically generated from the `.rst` files.
* API documentation is in the header file describing the API, in
Doxygen-formatted comments.
It is not necessary to edit any documentation files other than these;
all PDF, HTML, and `nroff`-format man page files will be updated
automatically from the `docbook` and `XML` files after merging.
Patches to improve existing documentation are also very welcome!
##### Tests
BIND is a large and complex project. We rely heavily on continuous
automated testing and cannot merge new code without adequate test coverage.
Please see [the 'Testing' section of doc/dev/dev.md](doc/dev/dev.md#testing)
Please see [the "Testing" section of doc/dev/dev.md](doc/dev/dev.md#testing)
for more information.
#### Thanks
Thank you for your interest in contributing to the ongoing development
of BIND.
of BIND 9.

10
HISTORY
View File

@@ -143,7 +143,7 @@ releases. New features include:
* "rndc modzone" reconfigures a single zone, without requiring the
entire server to be reconfigured.
* "rndc showzone" displays the current configuration of a zone.
* "rndc managed-keys" can be used to check the status of RFC 5001
* "rndc managed-keys" can be used to check the status of RFC 5011
managed trust anchors, or to force trust anchors to be refreshed.
* "max-cache-size" can now be set to a percentage of available memory.
The default is 90%.
@@ -515,8 +515,8 @@ BIND 9.4.0
* dig: report the number of extra bytes still left in the packet after
processing all the records.
* Support for IPSECKEY rdata type.
* Raise the UDP recieve buffer size to 32k if it is less than 32k.
* x86 and x86_64 now have seperate atomic locking implementations.
* Raise the UDP receive buffer size to 32k if it is less than 32k.
* x86 and x86_64 now have separate atomic locking implementations.
* named-checkconf now validates update-policy entries.
* Attempt to make the amount of work performed in a iteration self
tuning. The covers nodes clean from the cache per iteration, nodes
@@ -533,8 +533,8 @@ BIND 9.4.0
* dig now warns if 'RA' is not set in the answer when 'RD' was set in
the query. host/nslookup skip servers that fail to set 'RA' when 'RD'
is set unless a server is explicitly set.
* Integrate contibuted DLZ code into named.
* Integrate contibuted IDN code from JPNIC.
* Integrate contributed DLZ code into named.
* Integrate contributed IDN code from JPNIC.
* libbind: corresponds to that from BIND 8.4.7.
BIND 9.3.0

View File

@@ -533,8 +533,8 @@ BIND 9.4.0
- dig: report the number of extra bytes still left in the packet after
processing all the records.
- Support for IPSECKEY rdata type.
- Raise the UDP recieve buffer size to 32k if it is less than 32k.
- x86 and x86_64 now have seperate atomic locking implementations.
- Raise the UDP receive buffer size to 32k if it is less than 32k.
- x86 and x86_64 now have separate atomic locking implementations.
- named-checkconf now validates update-policy entries.
- Attempt to make the amount of work performed in a iteration self tuning.
The covers nodes clean from the cache per iteration, nodes written to
@@ -551,8 +551,8 @@ BIND 9.4.0
- dig now warns if 'RA' is not set in the answer when 'RD' was set in the
query. host/nslookup skip servers that fail to set 'RA' when 'RD' is set
unless a server is explicitly set.
- Integrate contibuted DLZ code into named.
- Integrate contibuted IDN code from JPNIC.
- Integrate contributed DLZ code into named.
- Integrate contributed IDN code from JPNIC.
- libbind: corresponds to that from BIND 8.4.7.
#### BIND 9.3.0

View File

@@ -18,8 +18,7 @@ SUBDIRS = make lib fuzz bin doc
TARGETS =
PREREQS = bind.keys.h
MANOBJS = README HISTORY OPTIONS CONTRIBUTING PLATFORMS CODE_OF_CONDUCT \
${MANPAGES} ${HTMLPAGES}
MANOBJS = README HISTORY OPTIONS CONTRIBUTING PLATFORMS CODE_OF_CONDUCT
@BIND9_MAKE_RULES@

View File

@@ -17,7 +17,7 @@ The following C11 features are used in BIND 9:
the form of C11 _Thread_local/thread_local, the __thread GCC
extension, or the __declspec(thread) MSVC extension on Windows.
BIND 9.15 requires a fairly recent version of libuv (at least 1.x). For
BIND 9.16 requires a fairly recent version of libuv (at least 1.x). For
some of the older systems listed below, you will have to install an
updated libuv package from sources such as EPEL, PPA, or other native
sources for updated packages. The other option is to build and install
@@ -34,14 +34,14 @@ offer support on a "best effort" basis for some.
Regularly tested platforms
As of Feb 2020, BIND 9.15 is fully supported and regularly tested on the
As of Mar 2020, BIND 9.16 is fully supported and regularly tested on the
following systems:
* Debian 9, 10
* Ubuntu LTS 16.04, 18.04
* Fedora 31
* Red Hat Enterprise Linux / CentOS 7, 8
* FreeBSD 11.3, 12.0
* FreeBSD 11.3, 12.1
* OpenBSD 6.6
* Alpine Linux
@@ -86,7 +86,7 @@ platforms.
Unsupported platforms
These are platforms on which BIND 9.15 is known not to build or run:
These are platforms on which BIND 9.16 is known not to build or run:
* Platforms without at least OpenSSL 1.0.2
* Windows 10 / x86

View File

@@ -25,7 +25,7 @@ The following C11 features are used in BIND 9:
of C11 `_Thread_local`/`thread_local`, the `__thread` GCC extension, or
the `__declspec(thread)` MSVC extension on Windows.
BIND 9.15 requires a fairly recent version of `libuv` (at least 1.x). For
BIND 9.16 requires a fairly recent version of `libuv` (at least 1.x). For
some of the older systems listed below, you will have to install an updated
`libuv` package from sources such as EPEL, PPA, or other native sources for
updated packages. The other option is to build and install `libuv` from
@@ -42,14 +42,14 @@ offer support on a "best effort" basis for some.
### Regularly tested platforms
As of Feb 2020, BIND 9.15 is fully supported and regularly tested on the
As of Mar 2020, BIND 9.16 is fully supported and regularly tested on the
following systems:
* Debian 9, 10
* Ubuntu LTS 16.04, 18.04
* Fedora 31
* Red Hat Enterprise Linux / CentOS 7, 8
* FreeBSD 11.3, 12.0
* FreeBSD 11.3, 12.1
* OpenBSD 6.6
* Alpine Linux
@@ -93,7 +93,7 @@ platforms.
## Unsupported platforms
These are platforms on which BIND 9.15 is known *not* to build or run:
These are platforms on which BIND 9.16 is known *not* to build or run:
* Platforms without at least OpenSSL 1.0.2
* Windows 10 / x86

19
README
View File

@@ -7,7 +7,7 @@ Contents
1. Introduction
2. Reporting bugs and getting help
3. Contributing to BIND
4. BIND 9.15 features
4. BIND 9.16 features
5. Building BIND
6. macOS
7. Dependencies
@@ -109,10 +109,11 @@ If you prefer, you may also submit code by opening a GitLab Issue and
including your patch as an attachment, preferably generated by git
format-patch.
BIND 9.15 features
BIND 9.16 features
BIND 9.15 is the newest development branch of BIND 9. It includes a number
of changes from BIND 9.14 and earlier releases. New features include:
BIND 9.16 is the current stable branch of BIND 9. It includes all changes
from the 9.15 development branch, updating the previous stable branch,
9.14. New features include:
* New dnssec-policy statement to configure a key and signing policy for
zones, enabling automatic key regeneration and rollover.
@@ -236,12 +237,10 @@ github.com/farsightsec/fstrm and libprotobuf-c https://
developers.google.com/protocol-buffers, and BIND must be configured with
--enable-dnstap.
Certain compiled-in constants and default settings can be increased to
values better suited to large servers with abundant memory resources (e.g,
64-bit servers with 12G or more of memory) by specifying --with-tuning=
large on the configure command line. This can improve performance on big
servers, but will consume more memory and may degrade performance on
smaller systems.
Certain compiled-in constants and default settings can be decreased to
values better suited to small machines, e.g. OpenWRT boxes, by specifying
--with-tuning=small on the configure command line. This will decrease
memory usage by using smaller structures, but will degrade performance.
On Linux, process capabilities are managed in user space using the libcap
library, which can be installed on most Linux systems via the libcap-dev

View File

@@ -15,7 +15,7 @@
1. [Introduction](#intro)
1. [Reporting bugs and getting help](#help)
1. [Contributing to BIND](#contrib)
1. [BIND 9.15 features](#features)
1. [BIND 9.16 features](#features)
1. [Building BIND](#build)
1. [macOS](#macos)
1. [Dependencies](#dependencies)
@@ -125,15 +125,15 @@ If you prefer, you may also submit code by opening a
including your patch as an attachment, preferably generated by
`git format-patch`.
### <a name="features"/> BIND 9.15 features
### <a name="features"/> BIND 9.16 features
BIND 9.15 is the newest development branch of BIND 9. It includes a
number of changes from BIND 9.14 and earlier releases. New features
include:
BIND 9.16 is the current stable branch of BIND 9. It includes all
changes from the 9.15 development branch, updating the previous stable
branch, 9.14. New features include:
* New `dnssec-policy` statement to configure a key and signing policy
for zones, enabling automatic key regeneration and rollover.
* New network manager based on libuv.
* New network manager based on `libuv`.
* Added support for the new GeoIP2 geolocation API, `libmaxminddb`.
* Improved DNSSEC trust anchor configuration using the `trust-anchors`
statement, permitting configuration of trust anchors in DS as well as
@@ -254,7 +254,7 @@ and `libprotobuf-c`
[https://developers.google.com/protocol-buffers](https://developers.google.com/protocol-buffers),
and BIND must be configured with `--enable-dnstap`.
Certain compiled-in constants and default settings can be increased to
Certain compiled-in constants and default settings can be decreased to
values better suited to small machines, e.g. OpenWRT boxes, by specifying
`--with-tuning=small` on the `configure` command line. This will decrease
memory usage by using smaller structures, but will degrade performance.

10
aclocal.m4 vendored
View File

@@ -1,6 +1,6 @@
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -290,7 +290,7 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -324,7 +324,7 @@ fi])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -357,7 +357,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
]
)
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,

View File

@@ -22,10 +22,10 @@ CINCLUDES = ${NS_INCLUDES} ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES}
CDEFINES = -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
NSLIBS = ../../lib/ns/libns.@A@
@@ -46,12 +46,6 @@ TARGETS = named-checkconf@EXEEXT@ named-checkzone@EXEEXT@
# Alphabetically
SRCS = named-checkconf.c named-checkzone.c check-tool.c
MANPAGES = named-checkconf.8 named-checkzone.8
HTMLPAGES = named-checkconf.html named-checkzone.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@
named-checkconf.@O@: named-checkconf.c
@@ -76,25 +70,15 @@ named-checkzone@EXEEXT@: named-checkzone.@O@ check-tool.@O@ ${ISCDEPLIBS} \
export LIBS0="${NSLIBS} ${ISCCFGLIBS} ${DNSLIBS}"; \
${FINALBUILDCMD}
doc man:: ${MANOBJS}
docclean manclean maintainer-clean::
rm -f ${MANOBJS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
install:: named-checkconf@EXEEXT@ named-checkzone@EXEEXT@ installdirs
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-checkconf@EXEEXT@ ${DESTDIR}${sbindir}
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-checkzone@EXEEXT@ ${DESTDIR}${sbindir}
(cd ${DESTDIR}${sbindir}; rm -f named-compilezone@EXEEXT@; ${LINK_PROGRAM} named-checkzone@EXEEXT@ named-compilezone@EXEEXT@)
for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8 || exit 1; done
(cd ${DESTDIR}${mandir}/man8; rm -f named-compilezone.8; ${LINK_PROGRAM} named-checkzone.8 named-compilezone.8)
uninstall::
rm -f ${DESTDIR}${mandir}/man8/named-compilezone.8
for m in ${MANPAGES}; do rm -f ${DESTDIR}${mandir}/man8/$$m || exit 1; done
rm -f ${DESTDIR}${sbindir}/named-compilezone@EXEEXT@
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named-checkconf@EXEEXT@
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named-checkzone@EXEEXT@

View File

@@ -9,23 +9,21 @@
* information regarding copyright ownership.
*/
/*! \file */
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#ifdef _WIN32
#include <Winsock2.h>
#endif
#endif /* ifdef _WIN32 */
#include "check-tool.h"
#include <isc/buffer.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/netdb.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/stdio.h>
@@ -52,29 +50,31 @@
#include <ns/log.h>
#include "check-tool.h"
#ifndef CHECK_SIBLING
#define CHECK_SIBLING 1
#endif
#endif /* ifndef CHECK_SIBLING */
#ifndef CHECK_LOCAL
#define CHECK_LOCAL 1
#endif
#endif /* ifndef CHECK_LOCAL */
#define CHECK(r) \
do { \
result = (r); \
#define CHECK(r) \
do { \
result = (r); \
if (result != ISC_R_SUCCESS) \
goto cleanup; \
goto cleanup; \
} while (0)
#define ERR_IS_CNAME 1
#define ERR_NO_ADDRESSES 2
#define ERR_IS_CNAME 1
#define ERR_NO_ADDRESSES 2
#define ERR_LOOKUP_FAILURE 3
#define ERR_EXTRA_A 4
#define ERR_EXTRA_AAAA 5
#define ERR_MISSING_GLUE 5
#define ERR_IS_MXCNAME 6
#define ERR_IS_SRVCNAME 7
#define ERR_EXTRA_A 4
#define ERR_EXTRA_AAAA 5
#define ERR_MISSING_GLUE 5
#define ERR_IS_MXCNAME 6
#define ERR_IS_SRVCNAME 7
static const char *dbtype[] = { "rbt" };
@@ -85,31 +85,26 @@ bool nomerge = true;
bool docheckmx = true;
bool dochecksrv = true;
bool docheckns = true;
#else
#else /* if CHECK_LOCAL */
bool docheckmx = false;
bool dochecksrv = false;
bool docheckns = false;
#endif
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_MANYERRORS |
DNS_ZONEOPT_CHECKNAMES |
#endif /* if CHECK_LOCAL */
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKINTEGRITY |
#if CHECK_SIBLING
DNS_ZONEOPT_CHECKSIBLING |
#endif
#endif /* if CHECK_SIBLING */
DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_WARNMXCNAME |
DNS_ZONEOPT_WARNSRVCNAME;
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
/*
* This needs to match the list in bin/named/log.c.
*/
static isc_logcategory_t categories[] = {
{ "", 0 },
{ "unmatched", 0 },
{ NULL, 0 }
};
static isc_logcategory_t categories[] = { { "", 0 },
{ "unmatched", 0 },
{ NULL, 0 } };
static isc_symtab_t *symtab = NULL;
static isc_mem_t *sym_mctx;
@@ -133,8 +128,9 @@ add(char *key, int value) {
if (symtab == NULL) {
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
false, &symtab);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return;
}
}
key = isc_mem_strdup(sym_mctx, key);
@@ -142,27 +138,29 @@ add(char *key, int value) {
symvalue.as_pointer = NULL;
result = isc_symtab_define(symtab, key, value, symvalue,
isc_symexists_reject);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
isc_mem_free(sym_mctx, key);
}
}
static bool
logged(char *key, int value) {
isc_result_t result;
if (symtab == NULL)
if (symtab == NULL) {
return (false);
}
result = isc_symtab_lookup(symtab, key, value, NULL);
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
return (true);
}
return (false);
}
static bool
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
dns_rdataset_t *a, dns_rdataset_t *aaaa)
{
dns_rdataset_t *a, dns_rdataset_t *aaaa) {
dns_rdataset_t *rdataset;
dns_rdata_t rdata = DNS_RDATA_INIT;
struct addrinfo hints, *ai, *cur;
@@ -180,8 +178,9 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
REQUIRE(aaaa == NULL || !dns_rdataset_isassociated(aaaa) ||
aaaa->type == dns_rdatatype_aaaa);
if (a == NULL || aaaa == NULL)
if (a == NULL || aaaa == NULL) {
return (answer);
}
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
@@ -208,16 +207,17 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
*/
cur = ai;
while (cur != NULL && cur->ai_canonname == NULL &&
cur->ai_next != NULL)
cur->ai_next != NULL) {
cur = cur->ai_next;
}
if (cur != NULL && cur->ai_canonname != NULL &&
strcasecmp(cur->ai_canonname, namebuf) != 0 &&
!logged(namebuf, ERR_IS_CNAME)) {
!logged(namebuf, ERR_IS_CNAME))
{
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' (out of zone) "
"is a CNAME '%s' (illegal)",
ownerbuf, namebuf,
cur->ai_canonname);
ownerbuf, namebuf, cur->ai_canonname);
/* XXX950 make fatal for 9.5.0 */
/* answer = false; */
add(namebuf, ERR_IS_CNAME);
@@ -226,7 +226,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
case EAI_NODATA:
#endif
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' (out of zone) "
@@ -240,8 +240,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s",
namebuf, gai_strerror(result));
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
@@ -250,15 +250,17 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
/*
* Check that all glue records really exist.
*/
if (!dns_rdataset_isassociated(a))
if (!dns_rdataset_isassociated(a)) {
goto checkaaaa;
}
result = dns_rdataset_first(a);
while (result == ISC_R_SUCCESS) {
dns_rdataset_current(a, &rdata);
match = false;
for (cur = ai; cur != NULL; cur = cur->ai_next) {
if (cur->ai_family != AF_INET)
if (cur->ai_family != AF_INET) {
continue;
}
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
match = true;
@@ -266,11 +268,12 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
}
}
if (!match && !logged(namebuf, ERR_EXTRA_A)) {
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' "
"extra GLUE A record (%s)",
ownerbuf, namebuf,
inet_ntop(AF_INET, rdata.data,
addrbuf, sizeof(addrbuf)));
inet_ntop(AF_INET, rdata.data, addrbuf,
sizeof(addrbuf)));
add(namebuf, ERR_EXTRA_A);
/* XXX950 make fatal for 9.5.0 */
/* answer = false; */
@@ -279,28 +282,32 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
result = dns_rdataset_next(a);
}
checkaaaa:
if (!dns_rdataset_isassociated(aaaa))
checkaaaa:
if (!dns_rdataset_isassociated(aaaa)) {
goto checkmissing;
}
result = dns_rdataset_first(aaaa);
while (result == ISC_R_SUCCESS) {
dns_rdataset_current(aaaa, &rdata);
match = false;
for (cur = ai; cur != NULL; cur = cur->ai_next) {
if (cur->ai_family != AF_INET6)
if (cur->ai_family != AF_INET6) {
continue;
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
}
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))
->sin6_addr;
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
match = true;
break;
}
}
if (!match && !logged(namebuf, ERR_EXTRA_AAAA)) {
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' "
"extra GLUE AAAA record (%s)",
ownerbuf, namebuf,
inet_ntop(AF_INET6, rdata.data,
addrbuf, sizeof(addrbuf)));
inet_ntop(AF_INET6, rdata.data, addrbuf,
sizeof(addrbuf)));
add(namebuf, ERR_EXTRA_AAAA);
/* XXX950 make fatal for 9.5.0. */
/* answer = false; */
@@ -309,7 +316,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
result = dns_rdataset_next(aaaa);
}
checkmissing:
checkmissing:
/*
* Check that all addresses appear in the glue.
*/
@@ -319,42 +326,50 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
switch (cur->ai_family) {
case AF_INET:
rdataset = a;
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
ptr = &((struct sockaddr_in *)(cur->ai_addr))
->sin_addr;
type = "A";
break;
case AF_INET6:
rdataset = aaaa;
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))
->sin6_addr;
type = "AAAA";
break;
default:
continue;
continue;
}
match = false;
if (dns_rdataset_isassociated(rdataset))
if (dns_rdataset_isassociated(rdataset)) {
result = dns_rdataset_first(rdataset);
else
} else {
result = ISC_R_FAILURE;
}
while (result == ISC_R_SUCCESS && !match) {
dns_rdataset_current(rdataset, &rdata);
if (memcmp(ptr, rdata.data, rdata.length) == 0)
{
match = true;
}
dns_rdata_reset(&rdata);
result = dns_rdataset_next(rdataset);
}
if (!match) {
dns_zone_log(zone, ISC_LOG_ERROR, "%s/NS '%s' "
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' "
"missing GLUE %s record (%s)",
ownerbuf, namebuf, type,
inet_ntop(cur->ai_family, ptr,
addrbuf, sizeof(addrbuf)));
addrbuf,
sizeof(addrbuf)));
/* XXX950 make fatal for 9.5.0. */
/* answer = false; */
missing_glue = true;
}
}
if (missing_glue)
if (missing_glue) {
add(namebuf, ERR_MISSING_GLUE);
}
}
freeaddrinfo(ai);
return (answer);
@@ -394,12 +409,15 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
*/
cur = ai;
while (cur != NULL && cur->ai_canonname == NULL &&
cur->ai_next != NULL)
cur->ai_next != NULL) {
cur = cur->ai_next;
}
if (cur != NULL && cur->ai_canonname != NULL &&
strcasecmp(cur->ai_canonname, namebuf) != 0) {
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0)
strcasecmp(cur->ai_canonname, namebuf) != 0)
{
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0) {
level = ISC_LOG_WARNING;
}
if ((zone_options & DNS_ZONEOPT_IGNOREMXCNAME) == 0) {
if (!logged(namebuf, ERR_IS_MXCNAME)) {
dns_zone_log(zone, level,
@@ -410,8 +428,9 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
cur->ai_canonname);
add(namebuf, ERR_IS_MXCNAME);
}
if (level == ISC_LOG_ERROR)
if (level == ISC_LOG_ERROR) {
answer = false;
}
}
}
freeaddrinfo(ai);
@@ -420,7 +439,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
case EAI_NODATA:
#endif
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/MX '%s' (out of zone) "
@@ -434,8 +453,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s",
namebuf, gai_strerror(result));
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
@@ -476,23 +495,28 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
*/
cur = ai;
while (cur != NULL && cur->ai_canonname == NULL &&
cur->ai_next != NULL)
cur->ai_next != NULL) {
cur = cur->ai_next;
}
if (cur != NULL && cur->ai_canonname != NULL &&
strcasecmp(cur->ai_canonname, namebuf) != 0) {
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0)
strcasecmp(cur->ai_canonname, namebuf) != 0)
{
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0) {
level = ISC_LOG_WARNING;
}
if ((zone_options & DNS_ZONEOPT_IGNORESRVCNAME) == 0) {
if (!logged(namebuf, ERR_IS_SRVCNAME)) {
dns_zone_log(zone, level, "%s/SRV '%s'"
dns_zone_log(zone, level,
"%s/SRV '%s'"
" (out of zone) is a "
"CNAME '%s' (illegal)",
ownerbuf, namebuf,
cur->ai_canonname);
add(namebuf, ERR_IS_SRVCNAME);
}
if (level == ISC_LOG_ERROR)
if (level == ISC_LOG_ERROR) {
answer = false;
}
}
}
freeaddrinfo(ai);
@@ -501,7 +525,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
case EAI_NODATA:
#endif
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/SRV '%s' (out of zone) "
@@ -515,8 +539,8 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s",
namebuf, gai_strerror(result));
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
@@ -529,7 +553,7 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
isc_logconfig_t *logconfig = NULL;
isc_log_t *log = NULL;
RUNTIME_CHECK(isc_log_create(mctx, &log, &logconfig) == ISC_R_SUCCESS);
isc_log_create(mctx, &log, &logconfig);
isc_log_registercategories(log, categories);
isc_log_setcontext(log);
dns_log_init(log);
@@ -541,12 +565,11 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
RUNTIME_CHECK(isc_log_createchannel(logconfig, "stderr",
ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC,
&destination, 0) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
NULL, NULL) == ISC_R_SUCCESS);
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC, &destination, 0);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
ISC_R_SUCCESS);
*logp = log;
return (ISC_R_SUCCESS);
@@ -573,18 +596,20 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
CHECK(dns_db_newversion(db, &version));
CHECK(dns_db_createiterator(db, 0, &dbiter));
for (result = dns_dbiterator_first(dbiter);
result == ISC_R_SUCCESS;
result = dns_dbiterator_next(dbiter)) {
for (result = dns_dbiterator_first(dbiter); result == ISC_R_SUCCESS;
result = dns_dbiterator_next(dbiter))
{
result = dns_dbiterator_current(dbiter, &node, name);
if (result == DNS_R_NEWORIGIN)
if (result == DNS_R_NEWORIGIN) {
result = ISC_R_SUCCESS;
}
CHECK(result);
CHECK(dns_db_allrdatasets(db, node, version, 0, &rdsiter));
for (result = dns_rdatasetiter_first(rdsiter);
result == ISC_R_SUCCESS;
result = dns_rdatasetiter_next(rdsiter)) {
result = dns_rdatasetiter_next(rdsiter))
{
dns_rdatasetiter_current(rdsiter, &rdataset);
if (rdataset.ttl > maxttl) {
char nbuf[DNS_NAME_FORMATSIZE];
@@ -607,28 +632,35 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
}
dns_rdataset_disassociate(&rdataset);
}
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
result = ISC_R_SUCCESS;
}
CHECK(result);
dns_rdatasetiter_destroy(&rdsiter);
dns_db_detachnode(db, &node);
}
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
result = ISC_R_SUCCESS;
}
cleanup:
if (node != NULL)
cleanup:
if (node != NULL) {
dns_db_detachnode(db, &node);
if (rdsiter != NULL)
}
if (rdsiter != NULL) {
dns_rdatasetiter_destroy(&rdsiter);
if (dbiter != NULL)
}
if (dbiter != NULL) {
dns_dbiterator_destroy(&dbiter);
if (version != NULL)
}
if (version != NULL) {
dns_db_closeversion(db, &version, false);
if (db != NULL)
}
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
}
@@ -637,8 +669,7 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
isc_result_t
load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
dns_masterformat_t fileformat, const char *classname,
dns_ttl_t maxttl, dns_zone_t **zonep)
{
dns_ttl_t maxttl, dns_zone_t **zonep) {
isc_result_t result;
dns_rdataclass_t rdclass;
isc_textregion_t region;
@@ -649,9 +680,10 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
REQUIRE(zonep == NULL || *zonep == NULL);
if (debug)
if (debug) {
fprintf(stderr, "loading \"%s\" from \"%s\" class \"%s\"\n",
zonename, filename, classname);
}
CHECK(dns_zone_create(&zone, mctx));
@@ -662,11 +694,12 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
origin = dns_fixedname_initname(&fixorigin);
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
CHECK(dns_zone_setorigin(zone, origin));
dns_zone_setdbtype(zone, 1, (const char * const *) dbtype);
dns_zone_setdbtype(zone, 1, (const char *const *)dbtype);
CHECK(dns_zone_setfile(zone, filename, fileformat,
&dns_master_style_default));
if (journal != NULL)
if (journal != NULL) {
CHECK(dns_zone_setjournal(zone, journal));
}
DE_CONST(classname, region.base);
region.length = strlen(classname);
@@ -678,12 +711,15 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
dns_zone_setmaxttl(zone, maxttl);
if (docheckmx)
if (docheckmx) {
dns_zone_setcheckmx(zone, checkmx);
if (docheckns)
}
if (docheckns) {
dns_zone_setcheckns(zone, checkns);
if (dochecksrv)
}
if (dochecksrv) {
dns_zone_setchecksrv(zone, checksrv);
}
CHECK(dns_zone_load(zone, false));
@@ -700,9 +736,10 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
zone = NULL;
}
cleanup:
if (zone != NULL)
cleanup:
if (zone != NULL) {
dns_zone_detach(&zone);
}
return (result);
}
@@ -710,8 +747,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_result_t
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
dns_masterformat_t fileformat, const dns_master_style_t *style,
const uint32_t rawversion)
{
const uint32_t rawversion) {
isc_result_t result;
FILE *output = stdout;
const char *flags;
@@ -719,27 +755,31 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
flags = (fileformat == dns_masterformat_text) ? "w" : "wb";
if (debug) {
if (filename != NULL && strcmp(filename, "-") != 0)
fprintf(stderr, "dumping \"%s\" to \"%s\"\n",
zonename, filename);
else
if (filename != NULL && strcmp(filename, "-") != 0) {
fprintf(stderr, "dumping \"%s\" to \"%s\"\n", zonename,
filename);
} else {
fprintf(stderr, "dumping \"%s\"\n", zonename);
}
}
if (filename != NULL && strcmp(filename, "-") != 0) {
result = isc_stdio_open(filename, flags, &output);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not open output "
"file \"%s\" for writing\n", filename);
fprintf(stderr,
"could not open output "
"file \"%s\" for writing\n",
filename);
return (ISC_R_FAILURE);
}
}
result = dns_zone_dumptostream(zone, output, fileformat, style,
rawversion);
if (output != stdout)
if (output != stdout) {
(void)isc_stdio_close(output);
}
return (result);
}
@@ -753,7 +793,7 @@ InitSockets(void) {
wVersionRequested = MAKEWORD(2, 0);
err = WSAStartup( wVersionRequested, &wsaData );
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
fprintf(stderr, "WSAStartup() failed: %d\n", err);
exit(1);
@@ -764,4 +804,4 @@ void
DestroySockets(void) {
WSACleanup();
}
#endif
#endif /* ifdef _WIN32 */

View File

@@ -9,7 +9,6 @@
* information regarding copyright ownership.
*/
#ifndef CHECK_TOOL_H
#define CHECK_TOOL_H
@@ -42,9 +41,11 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
const uint32_t rawversion);
#ifdef _WIN32
void InitSockets(void);
void DestroySockets(void);
#endif
void
InitSockets(void);
void
DestroySockets(void);
#endif /* ifdef _WIN32 */
extern int debug;
extern const char *journal;
@@ -56,4 +57,4 @@ extern dns_zoneopt_t zone_options;
ISC_LANG_ENDDECLS
#endif
#endif /* ifndef CHECK_TOOL_H */

View File

@@ -1,152 +0,0 @@
.\" Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: named-checkconf
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-01-10
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "NAMED\-CHECKCONF" "8" "2014\-01\-10" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
named-checkconf \- named configuration file syntax checking tool
.SH "SYNOPSIS"
.HP \w'\fBnamed\-checkconf\fR\ 'u
\fBnamed\-checkconf\fR [\fB\-chjlvz\fR] [\fB\-p\fR\ [\fB\-x\fR\ ]] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] {filename}
.SH "DESCRIPTION"
.PP
\fBnamed\-checkconf\fR
checks the syntax, but not the semantics, of a
\fBnamed\fR
configuration file\&. The file is parsed and checked for syntax errors, along with all files included by it\&. If no file is specified,
/etc/named\&.conf
is read by default\&.
.PP
Note: files that
\fBnamed\fR
reads in separate parser contexts, such as
rndc\&.key
and
bind\&.keys, are not automatically read by
\fBnamed\-checkconf\fR\&. Configuration errors in these files may cause
\fBnamed\fR
to fail to run, even if
\fBnamed\-checkconf\fR
was successful\&.
\fBnamed\-checkconf\fR
can be run on these files explicitly, however\&.
.SH "OPTIONS"
.PP
\-h
.RS 4
Print the usage summary and exit\&.
.RE
.PP
\-j
.RS 4
When loading a zonefile read the journal if it exists\&.
.RE
.PP
\-l
.RS 4
List all the configured zones\&. Each line of output contains the zone name, class (e\&.g\&. IN), view, and type (e\&.g\&. master or slave)\&.
.RE
.PP
\-c
.RS 4
Check "core" configuration only\&. This suppresses the loading of plugin modules, and causes all parameters to
\fBplugin\fR
statements to be ignored\&.
.RE
.PP
\-i
.RS 4
Ignore warnings on deprecated options\&.
.RE
.PP
\-p
.RS 4
Print out the
named\&.conf
and included files in canonical form if no errors were detected\&. See also the
\fB\-x\fR
option\&.
.RE
.PP
\-t \fIdirectory\fR
.RS 4
Chroot to
directory
so that include directives in the configuration file are processed as if run by a similarly chrooted
\fBnamed\fR\&.
.RE
.PP
\-v
.RS 4
Print the version of the
\fBnamed\-checkconf\fR
program and exit\&.
.RE
.PP
\-x
.RS 4
When printing the configuration files in canonical form, obscure shared secrets by replacing them with strings of question marks (\*(Aq?\*(Aq)\&. This allows the contents of
named\&.conf
and related files to be shared \(em for example, when submitting bug reports \(em without compromising private data\&. This option cannot be used without
\fB\-p\fR\&.
.RE
.PP
\-z
.RS 4
Perform a test load of all master zones found in
named\&.conf\&.
.RE
.PP
filename
.RS 4
The name of the configuration file to be checked\&. If not specified, it defaults to
/etc/named\&.conf\&.
.RE
.SH "RETURN VALUES"
.PP
\fBnamed\-checkconf\fR
returns an exit status of 1 if errors were detected and 0 otherwise\&.
.SH "SEE ALSO"
.PP
\fBnamed\fR(8),
\fBnamed-checkzone\fR(8),
BIND 9 Administrator Reference Manual\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -9,13 +9,12 @@
* information regarding copyright ownership.
*/
/*! \file */
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <isc/commandline.h>
#include <isc/dir.h>
@@ -27,11 +26,6 @@
#include <isc/string.h>
#include <isc/util.h>
#include <isccfg/namedconf.h>
#include <isccfg/grammar.h>
#include <bind9/check.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
@@ -41,6 +35,11 @@
#include <dns/rootns.h>
#include <dns/zone.h>
#include <isccfg/grammar.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include "check-tool.h"
static const char *program = "named-checkconf";
@@ -49,11 +48,11 @@ static bool loadplugins = true;
isc_log_t *logc = NULL;
#define CHECK(r)\
do { \
result = (r); \
#define CHECK(r) \
do { \
result = (r); \
if (result != ISC_R_SUCCESS) \
goto cleanup; \
goto cleanup; \
} while (0)
/*% usage */
@@ -62,8 +61,10 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
fprintf(stderr, "usage: %s [-chijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n", program);
fprintf(stderr,
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n",
program);
exit(1);
}
@@ -85,8 +86,8 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
result = isc_dir_chdir(directory);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
"change directory to '%s' failed: %s\n",
directory, isc_result_totext(result));
"change directory to '%s' failed: %s\n", directory,
isc_result_totext(result));
return (result);
}
@@ -97,10 +98,12 @@ static bool
get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
int i;
for (i = 0;; i++) {
if (maps[i] == NULL)
if (maps[i] == NULL) {
return (false);
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
}
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return (true);
}
}
}
@@ -114,25 +117,26 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
int i;
for (i = 0;; i++) {
if (maps[i] == NULL)
if (maps[i] == NULL) {
return (false);
}
checknames = NULL;
result = cfg_map_get(maps[i], "check-names", &checknames);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
continue;
}
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return (true);
}
for (element = cfg_list_first(checknames);
element != NULL;
element = cfg_list_next(element)) {
for (element = cfg_list_first(checknames); element != NULL;
element = cfg_list_next(element))
{
value = cfg_listelt_value(element);
type = cfg_tuple_get(value, "type");
if ((strcasecmp(cfg_obj_asstring(type),
"primary") != 0) &&
(strcasecmp(cfg_obj_asstring(type),
"master") != 0))
if ((strcasecmp(cfg_obj_asstring(type), "primary") !=
0) &&
(strcasecmp(cfg_obj_asstring(type), "master") != 0))
{
continue;
}
@@ -149,18 +153,21 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
dns_rdataclass_t rdclass;
isc_textregion_t r;
if (zfile == NULL)
if (zfile == NULL) {
return (ISC_R_FAILURE);
}
DE_CONST(zclass, r.base);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
result = dns_rootns_create(mctx, rdclass, zfile, &db);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
dns_db_detach(&db);
return (ISC_R_SUCCESS);
@@ -168,10 +175,9 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
/*% configure the zone */
static isc_result_t
configure_zone(const char *vclass, const char *view,
const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
const cfg_obj_t *config, isc_mem_t *mctx, bool list)
{
configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
const cfg_obj_t *vconfig, const cfg_obj_t *config,
isc_mem_t *mctx, bool list) {
int i = 0;
isc_result_t result;
const char *zclass;
@@ -195,19 +201,22 @@ configure_zone(const char *vclass, const char *view,
zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
classobj = cfg_tuple_get(zconfig, "class");
if (!cfg_obj_isstring(classobj))
if (!cfg_obj_isstring(classobj)) {
zclass = vclass;
else
} else {
zclass = cfg_obj_asstring(classobj);
}
zoptions = cfg_tuple_get(zconfig, "options");
maps[i++] = zoptions;
if (vconfig != NULL)
if (vconfig != NULL) {
maps[i++] = cfg_tuple_get(vconfig, "options");
}
if (config != NULL) {
cfg_map_get(config, "options", &obj);
if (obj != NULL)
if (obj != NULL) {
maps[i++] = obj;
}
}
maps[i] = NULL;
@@ -216,12 +225,14 @@ configure_zone(const char *vclass, const char *view,
const char *inview = cfg_obj_asstring(inviewobj);
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
}
if (inviewobj != NULL)
if (inviewobj != NULL) {
return (ISC_R_SUCCESS);
}
cfg_map_get(zoptions, "type", &typeobj);
if (typeobj == NULL)
if (typeobj == NULL) {
return (ISC_R_FAILURE);
}
if (list) {
const char *ztype = cfg_obj_asstring(typeobj);
@@ -233,18 +244,21 @@ configure_zone(const char *vclass, const char *view,
* Skip checks when using an alternate data source.
*/
cfg_map_get(zoptions, "database", &dbobj);
if (dbobj != NULL &&
strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
strcmp("rbt64", cfg_obj_asstring(dbobj)) != 0)
{
return (ISC_R_SUCCESS);
}
cfg_map_get(zoptions, "dlz", &dlzobj);
if (dlzobj != NULL)
if (dlzobj != NULL) {
return (ISC_R_SUCCESS);
}
cfg_map_get(zoptions, "file", &fileobj);
if (fileobj != NULL)
if (fileobj != NULL) {
zfile = cfg_obj_asstring(fileobj);
}
/*
* Check hints files for hint zones.
@@ -265,12 +279,14 @@ configure_zone(const char *vclass, const char *view,
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "redirect") == 0) {
cfg_map_get(zoptions, "masters", &mastersobj);
if (mastersobj != NULL)
if (mastersobj != NULL) {
return (ISC_R_SUCCESS);
}
}
if (zfile == NULL)
if (zfile == NULL) {
return (ISC_R_FAILURE);
}
obj = NULL;
if (get_maps(maps, "check-dup-records", &obj)) {
@@ -314,12 +330,14 @@ configure_zone(const char *vclass, const char *view,
obj = NULL;
if (get_maps(maps, "check-integrity", &obj)) {
if (cfg_obj_asboolean(obj))
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
else
} else {
zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
} else
}
} else {
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
}
obj = NULL;
if (get_maps(maps, "check-mx-cname", &obj)) {
@@ -363,10 +381,11 @@ configure_zone(const char *vclass, const char *view,
obj = NULL;
if (get_maps(maps, "check-sibling", &obj)) {
if (cfg_obj_asboolean(obj))
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKSIBLING;
else
} else {
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
}
}
obj = NULL;
@@ -399,8 +418,8 @@ configure_zone(const char *vclass, const char *view,
ISC_UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_CHECKNAMES;
zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL;
zone_options |= DNS_ZONEOPT_CHECKNAMES;
zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL;
}
masterformat = dns_masterformat_text;
@@ -425,19 +444,19 @@ configure_zone(const char *vclass, const char *view,
zone_options |= DNS_ZONEOPT_CHECKTTL;
}
result = load_zone(mctx, zname, zfile, masterformat,
zclass, maxttl, NULL);
if (result != ISC_R_SUCCESS)
result = load_zone(mctx, zname, zfile, masterformat, zclass, maxttl,
NULL);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
dns_result_totext(result));
}
return (result);
}
/*% configure a view */
static isc_result_t
configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list)
{
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list) {
const cfg_listelt_t *element;
const cfg_obj_t *voptions;
const cfg_obj_t *zonelist;
@@ -445,32 +464,33 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
isc_result_t tresult;
voptions = NULL;
if (vconfig != NULL)
if (vconfig != NULL) {
voptions = cfg_tuple_get(vconfig, "options");
}
zonelist = NULL;
if (voptions != NULL)
if (voptions != NULL) {
(void)cfg_map_get(voptions, "zone", &zonelist);
else
} else {
(void)cfg_map_get(config, "zone", &zonelist);
}
for (element = cfg_list_first(zonelist);
element != NULL;
for (element = cfg_list_first(zonelist); element != NULL;
element = cfg_list_next(element))
{
const cfg_obj_t *zconfig = cfg_listelt_value(element);
tresult = configure_zone(vclass, view, zconfig, vconfig,
config, mctx, list);
if (tresult != ISC_R_SUCCESS)
tresult = configure_zone(vclass, view, zconfig, vconfig, config,
mctx, list);
if (tresult != ISC_R_SUCCESS) {
result = tresult;
}
}
return (result);
}
static isc_result_t
config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
dns_rdataclass_t *classp)
{
dns_rdataclass_t *classp) {
isc_textregion_t r;
if (!cfg_obj_isstring(classobj)) {
@@ -485,8 +505,7 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
/*% load zones from the configuration */
static isc_result_t
load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
bool list_zones)
{
bool list_zones) {
const cfg_listelt_t *element;
const cfg_obj_t *views;
const cfg_obj_t *vconfig;
@@ -496,8 +515,7 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
views = NULL;
(void)cfg_map_get(config, "view", &views);
for (element = cfg_list_first(views);
element != NULL;
for (element = cfg_list_first(views); element != NULL;
element = cfg_list_next(element))
{
const cfg_obj_t *classobj;
@@ -506,28 +524,36 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
char buf[sizeof("CLASS65535")];
vconfig = cfg_listelt_value(element);
if (vconfig == NULL)
if (vconfig == NULL) {
continue;
}
classobj = cfg_tuple_get(vconfig, "class");
CHECK(config_getclass(classobj, dns_rdataclass_in,
&viewclass));
if (dns_rdataclass_ismeta(viewclass))
tresult = config_getclass(classobj, dns_rdataclass_in,
&viewclass);
if (tresult != ISC_R_SUCCESS) {
CHECK(tresult);
}
if (dns_rdataclass_ismeta(viewclass)) {
CHECK(ISC_R_FAILURE);
}
dns_rdataclass_format(viewclass, buf, sizeof(buf));
vname = cfg_obj_asstring(cfg_tuple_get(vconfig, "name"));
tresult = configure_view(buf, vname, config, vconfig, mctx,
list_zones);
if (tresult != ISC_R_SUCCESS)
if (tresult != ISC_R_SUCCESS) {
result = tresult;
}
}
if (views == NULL) {
tresult = configure_view("IN", "_default", config, NULL, mctx,
list_zones);
if (tresult != ISC_R_SUCCESS)
if (tresult != ISC_R_SUCCESS) {
result = tresult;
}
}
cleanup:
@@ -569,15 +595,23 @@ main(int argc, char **argv) {
switch (c) {
case 'm':
if (strcasecmp(isc_commandline_argument, "record") == 0)
{
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
}
if (strcasecmp(isc_commandline_argument, "trace") == 0)
{
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
}
if (strcasecmp(isc_commandline_argument, "usage") == 0)
{
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
if (strcasecmp(isc_commandline_argument, "size") == 0)
}
if (strcasecmp(isc_commandline_argument, "size") == 0) {
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
if (strcasecmp(isc_commandline_argument, "mctx") == 0)
}
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
}
break;
default:
break;
@@ -641,16 +675,17 @@ main(int argc, char **argv) {
break;
case '?':
if (isc_commandline_option != '?')
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
/* FALLTHROUGH */
}
/* FALLTHROUGH */
case 'h':
usage();
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
}
}
@@ -664,16 +699,19 @@ main(int argc, char **argv) {
exit(1);
}
if (isc_commandline_index + 1 < argc)
if (isc_commandline_index + 1 < argc) {
usage();
if (argv[isc_commandline_index] != NULL)
}
if (argv[isc_commandline_index] != NULL) {
conffile = argv[isc_commandline_index];
if (conffile == NULL || conffile[0] == '\0')
}
if (conffile == NULL || conffile[0] == '\0') {
conffile = NAMED_CONFFILE;
}
#ifdef _WIN32
InitSockets();
#endif
#endif /* ifdef _WIN32 */
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
@@ -699,12 +737,14 @@ main(int argc, char **argv) {
if (result == ISC_R_SUCCESS && (load_zones || list_zones)) {
result = load_zones_fromconfig(config, mctx, list_zones);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
exit_status = 1;
}
}
if (print && exit_status == 0)
if (print && exit_status == 0) {
cfg_printx(config, flags, output, NULL);
}
cfg_obj_destroy(parser, &config);
cfg_parser_destroy(&parser);
@@ -715,7 +755,7 @@ main(int argc, char **argv) {
#ifdef _WIN32
DestroySockets();
#endif
#endif /* ifdef _WIN32 */
return (exit_status);
}

View File

@@ -1,229 +0,0 @@
<!DOCTYPE book [
<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.named-checkconf">
<info>
<date>2014-01-10</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle><application>named-checkconf</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<docinfo>
<copyright>
<year>2000</year>
<year>2001</year>
<year>2002</year>
<year>2004</year>
<year>2005</year>
<year>2007</year>
<year>2009</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refnamediv>
<refname><application>named-checkconf</application></refname>
<refpurpose>named configuration file syntax checking tool</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>named-checkconf</command>
<arg choice="opt" rep="norepeat"><option>-chjlvz</option></arg>
<arg choice="opt" rep="norepeat"><option>-p</option>
<arg choice="opt" rep="norepeat"><option>-x</option>
</arg></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="req" rep="norepeat">filename</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>named-checkconf</command>
checks the syntax, but not the semantics, of a
<command>named</command> configuration file. The file is parsed
and checked for syntax errors, along with all files included by it.
If no file is specified, <filename>/etc/named.conf</filename> is read
by default.
</para>
<para>
Note: files that <command>named</command> reads in separate
parser contexts, such as <filename>rndc.key</filename> and
<filename>bind.keys</filename>, are not automatically read
by <command>named-checkconf</command>. Configuration
errors in these files may cause <command>named</command> to
fail to run, even if <command>named-checkconf</command> was
successful. <command>named-checkconf</command> can be run
on these files explicitly, however.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Print the usage summary and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-j</term>
<listitem>
<para>
When loading a zonefile read the journal if it exists.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-l</term>
<listitem>
<para>
List all the configured zones. Each line of output
contains the zone name, class (e.g. IN), view, and type
(e.g. master or slave).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c</term>
<listitem>
<para>
Check "core" configuration only. This suppresses the loading
of plugin modules, and causes all parameters to
<command>plugin</command> statements to be ignored.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-i</term>
<listitem>
<para>
Ignore warnings on deprecated options.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p</term>
<listitem>
<para>
Print out the <filename>named.conf</filename> and included files
in canonical form if no errors were detected.
See also the <option>-x</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">directory</replaceable></term>
<listitem>
<para>
Chroot to <filename>directory</filename> so that include
directives in the configuration file are processed as if
run by a similarly chrooted <command>named</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v</term>
<listitem>
<para>
Print the version of the <command>named-checkconf</command>
program and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-x</term>
<listitem>
<para>
When printing the configuration files in canonical
form, obscure shared secrets by replacing them with
strings of question marks ('?'). This allows the
contents of <filename>named.conf</filename> and related
files to be shared &mdash; for example, when submitting
bug reports &mdash; without compromising private data.
This option cannot be used without <option>-p</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-z</term>
<listitem>
<para>
Perform a test load of all master zones found in
<filename>named.conf</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>filename</term>
<listitem>
<para>
The name of the configuration file to be checked. If not
specified, it defaults to <filename>/etc/named.conf</filename>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>RETURN VALUES</title></info>
<para><command>named-checkconf</command>
returns an exit status of 1 if
errors were detected and 0 otherwise.
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named-checkzone</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>.
</para>
</refsection>
</refentry>

View File

@@ -1,180 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>named-checkconf</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.named-checkconf"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
<span class="application">named-checkconf</span>
&#8212; named configuration file syntax checking tool
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">named-checkconf</code>
[<code class="option">-chjlvz</code>]
[<code class="option">-p</code>
[<code class="option">-x</code>
]]
[<code class="option">-t <em class="replaceable"><code>directory</code></em></code>]
{filename}
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p><span class="command"><strong>named-checkconf</strong></span>
checks the syntax, but not the semantics, of a
<span class="command"><strong>named</strong></span> configuration file. The file is parsed
and checked for syntax errors, along with all files included by it.
If no file is specified, <code class="filename">/etc/named.conf</code> is read
by default.
</p>
<p>
Note: files that <span class="command"><strong>named</strong></span> reads in separate
parser contexts, such as <code class="filename">rndc.key</code> and
<code class="filename">bind.keys</code>, are not automatically read
by <span class="command"><strong>named-checkconf</strong></span>. Configuration
errors in these files may cause <span class="command"><strong>named</strong></span> to
fail to run, even if <span class="command"><strong>named-checkconf</strong></span> was
successful. <span class="command"><strong>named-checkconf</strong></span> can be run
on these files explicitly, however.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-h</span></dt>
<dd>
<p>
Print the usage summary and exit.
</p>
</dd>
<dt><span class="term">-j</span></dt>
<dd>
<p>
When loading a zonefile read the journal if it exists.
</p>
</dd>
<dt><span class="term">-l</span></dt>
<dd>
<p>
List all the configured zones. Each line of output
contains the zone name, class (e.g. IN), view, and type
(e.g. master or slave).
</p>
</dd>
<dt><span class="term">-c</span></dt>
<dd>
<p>
Check "core" configuration only. This suppresses the loading
of plugin modules, and causes all parameters to
<span class="command"><strong>plugin</strong></span> statements to be ignored.
</p>
</dd>
<dt><span class="term">-i</span></dt>
<dd>
<p>
Ignore warnings on deprecated options.
</p>
</dd>
<dt><span class="term">-p</span></dt>
<dd>
<p>
Print out the <code class="filename">named.conf</code> and included files
in canonical form if no errors were detected.
See also the <code class="option">-x</code> option.
</p>
</dd>
<dt><span class="term">-t <em class="replaceable"><code>directory</code></em></span></dt>
<dd>
<p>
Chroot to <code class="filename">directory</code> so that include
directives in the configuration file are processed as if
run by a similarly chrooted <span class="command"><strong>named</strong></span>.
</p>
</dd>
<dt><span class="term">-v</span></dt>
<dd>
<p>
Print the version of the <span class="command"><strong>named-checkconf</strong></span>
program and exit.
</p>
</dd>
<dt><span class="term">-x</span></dt>
<dd>
<p>
When printing the configuration files in canonical
form, obscure shared secrets by replacing them with
strings of question marks ('?'). This allows the
contents of <code class="filename">named.conf</code> and related
files to be shared &#8212; for example, when submitting
bug reports &#8212; without compromising private data.
This option cannot be used without <code class="option">-p</code>.
</p>
</dd>
<dt><span class="term">-z</span></dt>
<dd>
<p>
Perform a test load of all master zones found in
<code class="filename">named.conf</code>.
</p>
</dd>
<dt><span class="term">filename</span></dt>
<dd>
<p>
The name of the configuration file to be checked. If not
specified, it defaults to <code class="filename">/etc/named.conf</code>.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>RETURN VALUES</h2>
<p><span class="command"><strong>named-checkconf</strong></span>
returns an exit status of 1 if
errors were detected and 0 otherwise.
</p>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named-checkzone</span>(8)
</span>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>.
</p>
</div>
</div></body>
</html>

View File

@@ -0,0 +1,105 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_named-checkconf:
named-checkconf - named configuration file syntax checking tool
---------------------------------------------------------------
Synopsis
~~~~~~~~
:program:`named-checkconf` [**-chjlvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
Description
~~~~~~~~~~~
``named-checkconf`` checks the syntax, but not the semantics, of a
``named`` configuration file. The file is parsed and checked for syntax
errors, along with all files included by it. If no file is specified,
``/etc/named.conf`` is read by default.
Note: files that ``named`` reads in separate parser contexts, such as
``rndc.key`` and ``bind.keys``, are not automatically read by
``named-checkconf``. Configuration errors in these files may cause
``named`` to fail to run, even if ``named-checkconf`` was successful.
``named-checkconf`` can be run on these files explicitly, however.
Options
~~~~~~~
**-h**
Print the usage summary and exit.
**-j**
When loading a zonefile read the journal if it exists.
**-l**
List all the configured zones. Each line of output contains the zone
name, class (e.g. IN), view, and type (e.g. master or slave).
**-c**
Check "core" configuration only. This suppresses the loading of
plugin modules, and causes all parameters to ``plugin`` statements to
be ignored.
**-i**
Ignore warnings on deprecated options.
**-p**
Print out the ``named.conf`` and included files in canonical form if
no errors were detected. See also the ``-x`` option.
**-t** directory
Chroot to ``directory`` so that include directives in the
configuration file are processed as if run by a similarly chrooted
``named``.
**-v**
Print the version of the ``named-checkconf`` program and exit.
**-x**
When printing the configuration files in canonical form, obscure
shared secrets by replacing them with strings of question marks
('?'). This allows the contents of ``named.conf`` and related files
to be shared MDASH for example, when submitting bug reports MDASH
without compromising private data. This option cannot be used without
``-p``.
**-z**
Perform a test load of all master zones found in ``named.conf``.
filename
The name of the configuration file to be checked. If not specified,
it defaults to ``/etc/named.conf``.
Return Values
~~~~~~~~~~~~~
``named-checkconf`` returns an exit status of 1 if errors were detected
and 0 otherwise.
See Also
~~~~~~~~
:manpage:`named(8)`, :manpage:`named-checkzone(8)`, BIND 9 Administrator Reference Manual.

View File

@@ -1,329 +0,0 @@
.\" Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: named-checkzone
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-02-19
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "NAMED\-CHECKZONE" "8" "2014\-02\-19" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
named-checkzone, named-compilezone \- zone file validity checking or converting tool
.SH "SYNOPSIS"
.HP \w'\fBnamed\-checkzone\fR\ 'u
\fBnamed\-checkzone\fR [\fB\-d\fR] [\fB\-h\fR] [\fB\-j\fR] [\fB\-q\fR] [\fB\-v\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-F\ \fR\fB\fIformat\fR\fR] [\fB\-J\ \fR\fB\fIfilename\fR\fR] [\fB\-i\ \fR\fB\fImode\fR\fR] [\fB\-k\ \fR\fB\fImode\fR\fR] [\fB\-m\ \fR\fB\fImode\fR\fR] [\fB\-M\ \fR\fB\fImode\fR\fR] [\fB\-n\ \fR\fB\fImode\fR\fR] [\fB\-l\ \fR\fB\fIttl\fR\fR] [\fB\-L\ \fR\fB\fIserial\fR\fR] [\fB\-o\ \fR\fB\fIfilename\fR\fR] [\fB\-r\ \fR\fB\fImode\fR\fR] [\fB\-s\ \fR\fB\fIstyle\fR\fR] [\fB\-S\ \fR\fB\fImode\fR\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-T\ \fR\fB\fImode\fR\fR] [\fB\-w\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-W\ \fR\fB\fImode\fR\fR] {zonename} {filename}
.HP \w'\fBnamed\-compilezone\fR\ 'u
\fBnamed\-compilezone\fR [\fB\-d\fR] [\fB\-j\fR] [\fB\-q\fR] [\fB\-v\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-C\ \fR\fB\fImode\fR\fR] [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-F\ \fR\fB\fIformat\fR\fR] [\fB\-J\ \fR\fB\fIfilename\fR\fR] [\fB\-i\ \fR\fB\fImode\fR\fR] [\fB\-k\ \fR\fB\fImode\fR\fR] [\fB\-m\ \fR\fB\fImode\fR\fR] [\fB\-n\ \fR\fB\fImode\fR\fR] [\fB\-l\ \fR\fB\fIttl\fR\fR] [\fB\-L\ \fR\fB\fIserial\fR\fR] [\fB\-r\ \fR\fB\fImode\fR\fR] [\fB\-s\ \fR\fB\fIstyle\fR\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-T\ \fR\fB\fImode\fR\fR] [\fB\-w\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-W\ \fR\fB\fImode\fR\fR] {\fB\-o\ \fR\fB\fIfilename\fR\fR} {zonename} {filename}
.SH "DESCRIPTION"
.PP
\fBnamed\-checkzone\fR
checks the syntax and integrity of a zone file\&. It performs the same checks as
\fBnamed\fR
does when loading a zone\&. This makes
\fBnamed\-checkzone\fR
useful for checking zone files before configuring them into a name server\&.
.PP
\fBnamed\-compilezone\fR
is similar to
\fBnamed\-checkzone\fR, but it always dumps the zone contents to a specified file in a specified format\&. Additionally, it applies stricter check levels by default, since the dump output will be used as an actual zone file loaded by
\fBnamed\fR\&. When manually specified otherwise, the check levels must at least be as strict as those specified in the
\fBnamed\fR
configuration file\&.
.SH "OPTIONS"
.PP
\-d
.RS 4
Enable debugging\&.
.RE
.PP
\-h
.RS 4
Print the usage summary and exit\&.
.RE
.PP
\-q
.RS 4
Quiet mode \- exit code only\&.
.RE
.PP
\-v
.RS 4
Print the version of the
\fBnamed\-checkzone\fR
program and exit\&.
.RE
.PP
\-j
.RS 4
When loading a zone file, read the journal if it exists\&. The journal file name is assumed to be the zone file name appended with the string
\&.jnl\&.
.RE
.PP
\-J \fIfilename\fR
.RS 4
When loading the zone file read the journal from the given file, if it exists\&. (Implies \-j\&.)
.RE
.PP
\-c \fIclass\fR
.RS 4
Specify the class of the zone\&. If not specified, "IN" is assumed\&.
.RE
.PP
\-i \fImode\fR
.RS 4
Perform post\-load zone integrity checks\&. Possible modes are
\fB"full"\fR
(default),
\fB"full\-sibling"\fR,
\fB"local"\fR,
\fB"local\-sibling"\fR
and
\fB"none"\fR\&.
.sp
Mode
\fB"full"\fR
checks that MX records refer to A or AAAA record (both in\-zone and out\-of\-zone hostnames)\&. Mode
\fB"local"\fR
only checks MX records which refer to in\-zone hostnames\&.
.sp
Mode
\fB"full"\fR
checks that SRV records refer to A or AAAA record (both in\-zone and out\-of\-zone hostnames)\&. Mode
\fB"local"\fR
only checks SRV records which refer to in\-zone hostnames\&.
.sp
Mode
\fB"full"\fR
checks that delegation NS records refer to A or AAAA record (both in\-zone and out\-of\-zone hostnames)\&. It also checks that glue address records in the zone match those advertised by the child\&. Mode
\fB"local"\fR
only checks NS records which refer to in\-zone hostnames or that some required glue exists, that is when the nameserver is in a child zone\&.
.sp
Mode
\fB"full\-sibling"\fR
and
\fB"local\-sibling"\fR
disable sibling glue checks but are otherwise the same as
\fB"full"\fR
and
\fB"local"\fR
respectively\&.
.sp
Mode
\fB"none"\fR
disables the checks\&.
.RE
.PP
\-f \fIformat\fR
.RS 4
Specify the format of the zone file\&. Possible formats are
\fB"text"\fR
(default),
\fB"raw"\fR, and
\fB"map"\fR\&.
.RE
.PP
\-F \fIformat\fR
.RS 4
Specify the format of the output file specified\&. For
\fBnamed\-checkzone\fR, this does not cause any effects unless it dumps the zone contents\&.
.sp
Possible formats are
\fB"text"\fR
(default), which is the standard textual representation of the zone, and
\fB"map"\fR,
\fB"raw"\fR, and
\fB"raw=N"\fR, which store the zone in a binary format for rapid loading by
\fBnamed\fR\&.
\fB"raw=N"\fR
specifies the format version of the raw zone file: if N is 0, the raw file can be read by any version of
\fBnamed\fR; if N is 1, the file can be read by release 9\&.9\&.0 or higher; the default is 1\&.
.RE
.PP
\-k \fImode\fR
.RS 4
Perform
\fB"check\-names"\fR
checks with the specified failure mode\&. Possible modes are
\fB"fail"\fR
(default for
\fBnamed\-compilezone\fR),
\fB"warn"\fR
(default for
\fBnamed\-checkzone\fR) and
\fB"ignore"\fR\&.
.RE
.PP
\-l \fIttl\fR
.RS 4
Sets a maximum permissible TTL for the input file\&. Any record with a TTL higher than this value will cause the zone to be rejected\&. This is similar to using the
\fBmax\-zone\-ttl\fR
option in
named\&.conf\&.
.RE
.PP
\-L \fIserial\fR
.RS 4
When compiling a zone to "raw" or "map" format, set the "source serial" value in the header to the specified serial number\&. (This is expected to be used primarily for testing purposes\&.)
.RE
.PP
\-m \fImode\fR
.RS 4
Specify whether MX records should be checked to see if they are addresses\&. Possible modes are
\fB"fail"\fR,
\fB"warn"\fR
(default) and
\fB"ignore"\fR\&.
.RE
.PP
\-M \fImode\fR
.RS 4
Check if a MX record refers to a CNAME\&. Possible modes are
\fB"fail"\fR,
\fB"warn"\fR
(default) and
\fB"ignore"\fR\&.
.RE
.PP
\-n \fImode\fR
.RS 4
Specify whether NS records should be checked to see if they are addresses\&. Possible modes are
\fB"fail"\fR
(default for
\fBnamed\-compilezone\fR),
\fB"warn"\fR
(default for
\fBnamed\-checkzone\fR) and
\fB"ignore"\fR\&.
.RE
.PP
\-o \fIfilename\fR
.RS 4
Write zone output to
filename\&. If
filename
is
\-
then write to standard out\&. This is mandatory for
\fBnamed\-compilezone\fR\&.
.RE
.PP
\-r \fImode\fR
.RS 4
Check for records that are treated as different by DNSSEC but are semantically equal in plain DNS\&. Possible modes are
\fB"fail"\fR,
\fB"warn"\fR
(default) and
\fB"ignore"\fR\&.
.RE
.PP
\-s \fIstyle\fR
.RS 4
Specify the style of the dumped zone file\&. Possible styles are
\fB"full"\fR
(default) and
\fB"relative"\fR\&. The full format is most suitable for processing automatically by a separate script\&. On the other hand, the relative format is more human\-readable and is thus suitable for editing by hand\&. For
\fBnamed\-checkzone\fR
this does not cause any effects unless it dumps the zone contents\&. It also does not have any meaning if the output format is not text\&.
.RE
.PP
\-S \fImode\fR
.RS 4
Check if a SRV record refers to a CNAME\&. Possible modes are
\fB"fail"\fR,
\fB"warn"\fR
(default) and
\fB"ignore"\fR\&.
.RE
.PP
\-t \fIdirectory\fR
.RS 4
Chroot to
directory
so that include directives in the configuration file are processed as if run by a similarly chrooted
\fBnamed\fR\&.
.RE
.PP
\-T \fImode\fR
.RS 4
Check if Sender Policy Framework (SPF) records exist and issues a warning if an SPF\-formatted TXT record is not also present\&. Possible modes are
\fB"warn"\fR
(default),
\fB"ignore"\fR\&.
.RE
.PP
\-w \fIdirectory\fR
.RS 4
chdir to
directory
so that relative filenames in master file $INCLUDE directives work\&. This is similar to the directory clause in
named\&.conf\&.
.RE
.PP
\-D
.RS 4
Dump zone file in canonical format\&. This is always enabled for
\fBnamed\-compilezone\fR\&.
.RE
.PP
\-W \fImode\fR
.RS 4
Specify whether to check for non\-terminal wildcards\&. Non\-terminal wildcards are almost always the result of a failure to understand the wildcard matching algorithm (RFC 1034)\&. Possible modes are
\fB"warn"\fR
(default) and
\fB"ignore"\fR\&.
.RE
.PP
zonename
.RS 4
The domain name of the zone being checked\&.
.RE
.PP
filename
.RS 4
The name of the zone file\&.
.RE
.SH "RETURN VALUES"
.PP
\fBnamed\-checkzone\fR
returns an exit status of 1 if errors were detected and 0 otherwise\&.
.SH "SEE ALSO"
.PP
\fBnamed\fR(8),
\fBnamed-checkconf\fR(8),
RFC 1035,
BIND 9 Administrator Reference Manual\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2000-2002, 2004-2007, 2009-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -9,12 +9,11 @@
* information regarding copyright ownership.
*/
/*! \file */
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
#include <isc/app.h>
#include <isc/commandline.h>
@@ -53,14 +52,14 @@ static const char *prog_name = NULL;
static const dns_master_style_t *outputstyle = NULL;
static enum { progmode_check, progmode_compile } progmode;
#define ERRRET(result, function) \
do { \
if (result != ISC_R_SUCCESS) { \
if (!quiet) \
fprintf(stderr, "%s() returned %s\n", \
#define ERRRET(result, function) \
do { \
if (result != ISC_R_SUCCESS) { \
if (!quiet) \
fprintf(stderr, "%s() returned %s\n", \
function, dns_result_totext(result)); \
return (result); \
} \
return (result); \
} \
} while (0)
ISC_PLATFORM_NORETURN_PRE static void
@@ -71,9 +70,9 @@ usage(void) {
fprintf(stderr,
"usage: %s [-djqvD] [-c class] "
"[-f inputformat] [-F outputformat] [-J filename] "
"[-t directory] [-w directory] [-k (ignore|warn|fail)] "
"[-n (ignore|warn|fail)] [-m (ignore|warn|fail)] "
"[-r (ignore|warn|fail)] "
"[-s (full|relative)] [-t directory] [-w directory] "
"[-k (ignore|warn|fail)] [-m (ignore|warn|fail)] "
"[-n (ignore|warn|fail)] [-r (ignore|warn|fail)] "
"[-i (full|full-sibling|local|local-sibling|none)] "
"[-M (ignore|warn|fail)] [-S (ignore|warn|fail)] "
"[-W (ignore|warn)] "
@@ -121,18 +120,21 @@ main(int argc, char **argv) {
outputstyle = &dns_master_style_full;
prog_name = strrchr(argv[0], '/');
if (prog_name == NULL)
if (prog_name == NULL) {
prog_name = strrchr(argv[0], '\\');
if (prog_name != NULL)
}
if (prog_name != NULL) {
prog_name++;
else
} else {
prog_name = argv[0];
}
/*
* Libtool doesn't preserve the program name prior to final
* installation. Remove the libtool prefix ("lt-").
*/
if (strncmp(prog_name, "lt-", 3) == 0)
if (strncmp(prog_name, "lt-", 3) == 0) {
prog_name += 3;
}
#define PROGCMP(X) \
(strcasecmp(prog_name, X) == 0 || strcasecmp(prog_name, X ".exe") == 0)
@@ -148,24 +150,23 @@ main(int argc, char **argv) {
/* Compilation specific defaults */
if (progmode == progmode_compile) {
zone_options |= (DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_FATALNS |
DNS_ZONEOPT_CHECKSPF |
DNS_ZONEOPT_CHECKDUPRR |
zone_options |= (DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_FATALNS |
DNS_ZONEOPT_CHECKSPF | DNS_ZONEOPT_CHECKDUPRR |
DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKNAMESFAIL |
DNS_ZONEOPT_CHECKWILDCARD);
} else
zone_options |= (DNS_ZONEOPT_CHECKDUPRR |
DNS_ZONEOPT_CHECKSPF);
} else {
zone_options |= (DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF);
}
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
isc_commandline_errprint = false;
while ((c = isc_commandline_parse(argc, argv,
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
!= EOF) {
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:"
"M:S:T:W:")) != EOF)
{
switch (c) {
case 'c':
classname = isc_commandline_argument;
@@ -269,16 +270,15 @@ main(int argc, char **argv) {
}
break;
case 'n':
if (ARGCMP("ignore")) {
zone_options &= ~(DNS_ZONEOPT_CHECKNS|
zone_options &= ~(DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_FATALNS);
} else if (ARGCMP("warn")) {
zone_options |= DNS_ZONEOPT_CHECKNS;
zone_options &= ~DNS_ZONEOPT_FATALNS;
} else if (ARGCMP("fail")) {
zone_options |= DNS_ZONEOPT_CHECKNS|
zone_options |= DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_FATALNS;
} else {
fprintf(stderr, "invalid argument to -n: %s\n",
@@ -330,9 +330,9 @@ main(int argc, char **argv) {
break;
case 's':
if (ARGCMP("full"))
if (ARGCMP("full")) {
outputstyle = &dns_master_style_full;
else if (ARGCMP("relative")) {
} else if (ARGCMP("relative")) {
outputstyle = &dns_master_style_default;
} else {
fprintf(stderr,
@@ -411,23 +411,25 @@ main(int argc, char **argv) {
break;
case 'W':
if (ARGCMP("warn"))
if (ARGCMP("warn")) {
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
else if (ARGCMP("ignore"))
} else if (ARGCMP("ignore")) {
zone_options &= ~DNS_ZONEOPT_CHECKWILDCARD;
}
break;
case '?':
if (isc_commandline_option != '?')
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
prog_name, isc_commandline_option);
/* FALLTHROUGH */
}
/* FALLTHROUGH */
case 'h':
usage();
default:
fprintf(stderr, "%s: unhandled option -%c\n",
prog_name, isc_commandline_option);
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
isc_commandline_option);
exit(1);
}
}
@@ -435,26 +437,26 @@ main(int argc, char **argv) {
if (workdir != NULL) {
result = isc_dir_chdir(workdir);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chdir: %s: %s\n",
workdir, isc_result_totext(result));
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
isc_result_totext(result));
exit(1);
}
}
if (inputformatstr != NULL) {
if (strcasecmp(inputformatstr, "text") == 0)
if (strcasecmp(inputformatstr, "text") == 0) {
inputformat = dns_masterformat_text;
else if (strcasecmp(inputformatstr, "raw") == 0)
} else if (strcasecmp(inputformatstr, "raw") == 0) {
inputformat = dns_masterformat_raw;
else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
} else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
inputformat = dns_masterformat_raw;
fprintf(stderr,
"WARNING: input format raw, version ignored\n");
fprintf(stderr, "WARNING: input format raw, version "
"ignored\n");
} else if (strcasecmp(inputformatstr, "map") == 0) {
inputformat = dns_masterformat_map;
} else {
fprintf(stderr, "unknown file format: %s\n",
inputformatstr);
inputformatstr);
exit(1);
}
}
@@ -471,8 +473,7 @@ main(int argc, char **argv) {
rawversion = strtol(outputformatstr + 4, &end, 10);
if (end == outputformatstr + 4 || *end != '\0' ||
rawversion > 1U) {
fprintf(stderr,
"unknown raw format version\n");
fprintf(stderr, "unknown raw format version\n");
exit(1);
}
} else if (strcasecmp(outputformatstr, "map") == 0) {
@@ -485,42 +486,45 @@ main(int argc, char **argv) {
}
if (progmode == progmode_compile) {
dumpzone = 1; /* always dump */
dumpzone = 1; /* always dump */
logdump = !quiet;
if (output_filename == NULL) {
fprintf(stderr,
"output file required, but not specified\n");
fprintf(stderr, "output file required, but not "
"specified\n");
usage();
}
}
if (output_filename != NULL)
if (output_filename != NULL) {
dumpzone = 1;
}
/*
* If we are outputing to stdout then send the informational
* If we are printing to stdout then send the informational
* output to stderr.
*/
if (dumpzone &&
(output_filename == NULL ||
strcmp(output_filename, "-") == 0 ||
(output_filename == NULL || strcmp(output_filename, "-") == 0 ||
strcmp(output_filename, "/dev/fd/1") == 0 ||
strcmp(output_filename, "/dev/stdout") == 0)) {
strcmp(output_filename, "/dev/stdout") == 0))
{
errout = stderr;
logdump = false;
}
if (isc_commandline_index + 2 != argc)
if (isc_commandline_index + 2 != argc) {
usage();
}
#ifdef _WIN32
InitSockets();
#endif
#endif /* ifdef _WIN32 */
isc_mem_create(&mctx);
if (!quiet)
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
== ISC_R_SUCCESS);
if (!quiet) {
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) ==
ISC_R_SUCCESS);
}
dns_result_register();
@@ -541,20 +545,23 @@ main(int argc, char **argv) {
fprintf(errout, "dump zone to %s...", output_filename);
fflush(errout);
}
result = dump_zone(origin, zone, output_filename,
outputformat, outputstyle, rawversion);
if (logdump)
result = dump_zone(origin, zone, output_filename, outputformat,
outputstyle, rawversion);
if (logdump) {
fprintf(errout, "done\n");
}
}
if (!quiet && result == ISC_R_SUCCESS)
if (!quiet && result == ISC_R_SUCCESS) {
fprintf(errout, "OK\n");
}
destroy();
if (lctx != NULL)
if (lctx != NULL) {
isc_log_destroy(&lctx);
}
isc_mem_destroy(&mctx);
#ifdef _WIN32
DestroySockets();
#endif
#endif /* ifdef _WIN32 */
return ((result == ISC_R_SUCCESS) ? 0 : 1);
}

View File

@@ -1,529 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.named-checkzone">
<info>
<date>2014-02-19</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle><application>named-checkzone</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<docinfo>
<copyright>
<year>2000</year>
<year>2001</year>
<year>2002</year>
<year>2004</year>
<year>2005</year>
<year>2006</year>
<year>2007</year>
<year>2009</year>
<year>2010</year>
<year>2011</year>
<year>2012</year>
<year>2013</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refnamediv>
<refname><application>named-checkzone</application></refname>
<refname><application>named-compilezone</application></refname>
<refpurpose>zone file validity checking or converting tool</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>named-checkzone</command>
<arg choice="opt" rep="norepeat"><option>-d</option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-j</option></arg>
<arg choice="opt" rep="norepeat"><option>-q</option></arg>
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-f <replaceable class="parameter">format</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-F <replaceable class="parameter">format</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-J <replaceable class="parameter">filename</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-i <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-k <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-m <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-M <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-n <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-l <replaceable class="parameter">ttl</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-L <replaceable class="parameter">serial</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-o <replaceable class="parameter">filename</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">style</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-S <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-w <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D</option></arg>
<arg choice="opt" rep="norepeat"><option>-W <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="req" rep="norepeat">zonename</arg>
<arg choice="req" rep="norepeat">filename</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>named-compilezone</command>
<arg choice="opt" rep="norepeat"><option>-d</option></arg>
<arg choice="opt" rep="norepeat"><option>-j</option></arg>
<arg choice="opt" rep="norepeat"><option>-q</option></arg>
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-C <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-f <replaceable class="parameter">format</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-F <replaceable class="parameter">format</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-J <replaceable class="parameter">filename</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-i <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-k <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-m <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-n <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-l <replaceable class="parameter">ttl</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-L <replaceable class="parameter">serial</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">style</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-w <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D</option></arg>
<arg choice="opt" rep="norepeat"><option>-W <replaceable class="parameter">mode</replaceable></option></arg>
<arg choice="req" rep="norepeat"><option>-o <replaceable class="parameter">filename</replaceable></option></arg>
<arg choice="req" rep="norepeat">zonename</arg>
<arg choice="req" rep="norepeat">filename</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>named-checkzone</command>
checks the syntax and integrity of a zone file. It performs the
same checks as <command>named</command> does when loading a
zone. This makes <command>named-checkzone</command> useful for
checking zone files before configuring them into a name server.
</para>
<para>
<command>named-compilezone</command> is similar to
<command>named-checkzone</command>, but it always dumps the
zone contents to a specified file in a specified format.
Additionally, it applies stricter check levels by default,
since the dump output will be used as an actual zone file
loaded by <command>named</command>.
When manually specified otherwise, the check levels must at
least be as strict as those specified in the
<command>named</command> configuration file.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-d</term>
<listitem>
<para>
Enable debugging.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Print the usage summary and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-q</term>
<listitem>
<para>
Quiet mode - exit code only.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v</term>
<listitem>
<para>
Print the version of the <command>named-checkzone</command>
program and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-j</term>
<listitem>
<para>
When loading a zone file, read the journal if it exists.
The journal file name is assumed to be the zone file name
appended with the string <filename>.jnl</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-J <replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
When loading the zone file read the journal from the given
file, if it exists. (Implies -j.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c <replaceable class="parameter">class</replaceable></term>
<listitem>
<para>
Specify the class of the zone. If not specified, "IN" is assumed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-i <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Perform post-load zone integrity checks. Possible modes are
<command>"full"</command> (default),
<command>"full-sibling"</command>,
<command>"local"</command>,
<command>"local-sibling"</command> and
<command>"none"</command>.
</para>
<para>
Mode <command>"full"</command> checks that MX records
refer to A or AAAA record (both in-zone and out-of-zone
hostnames). Mode <command>"local"</command> only
checks MX records which refer to in-zone hostnames.
</para>
<para>
Mode <command>"full"</command> checks that SRV records
refer to A or AAAA record (both in-zone and out-of-zone
hostnames). Mode <command>"local"</command> only
checks SRV records which refer to in-zone hostnames.
</para>
<para>
Mode <command>"full"</command> checks that delegation NS
records refer to A or AAAA record (both in-zone and out-of-zone
hostnames). It also checks that glue address records
in the zone match those advertised by the child.
Mode <command>"local"</command> only checks NS records which
refer to in-zone hostnames or that some required glue exists,
that is when the nameserver is in a child zone.
</para>
<para>
Mode <command>"full-sibling"</command> and
<command>"local-sibling"</command> disable sibling glue
checks but are otherwise the same as <command>"full"</command>
and <command>"local"</command> respectively.
</para>
<para>
Mode <command>"none"</command> disables the checks.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-f <replaceable class="parameter">format</replaceable></term>
<listitem>
<para>
Specify the format of the zone file.
Possible formats are <command>"text"</command> (default),
<command>"raw"</command>, and <command>"map"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-F <replaceable class="parameter">format</replaceable></term>
<listitem>
<para>
Specify the format of the output file specified.
For <command>named-checkzone</command>,
this does not cause any effects unless it dumps the zone
contents.
</para>
<para>
Possible formats are <command>"text"</command> (default),
which is the standard textual representation of the zone,
and <command>"map"</command>, <command>"raw"</command>,
and <command>"raw=N"</command>, which store the zone in a
binary format for rapid loading by <command>named</command>.
<command>"raw=N"</command> specifies the format version of
the raw zone file: if N is 0, the raw file can be read by
any version of <command>named</command>; if N is 1, the file
can be read by release 9.9.0 or higher; the default is 1.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-k <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Perform <command>"check-names"</command> checks with the
specified failure mode.
Possible modes are <command>"fail"</command>
(default for <command>named-compilezone</command>),
<command>"warn"</command>
(default for <command>named-checkzone</command>) and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-l <replaceable class="parameter">ttl</replaceable></term>
<listitem>
<para>
Sets a maximum permissible TTL for the input file.
Any record with a TTL higher than this value will cause
the zone to be rejected. This is similar to using the
<command>max-zone-ttl</command> option in
<filename>named.conf</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-L <replaceable class="parameter">serial</replaceable></term>
<listitem>
<para>
When compiling a zone to "raw" or "map" format, set the
"source serial" value in the header to the specified serial
number. (This is expected to be used primarily for testing
purposes.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-m <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Specify whether MX records should be checked to see if they
are addresses. Possible modes are <command>"fail"</command>,
<command>"warn"</command> (default) and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-M <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Check if a MX record refers to a CNAME.
Possible modes are <command>"fail"</command>,
<command>"warn"</command> (default) and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-n <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Specify whether NS records should be checked to see if they
are addresses.
Possible modes are <command>"fail"</command>
(default for <command>named-compilezone</command>),
<command>"warn"</command>
(default for <command>named-checkzone</command>) and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-o <replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
Write zone output to <filename>filename</filename>.
If <filename>filename</filename> is <filename>-</filename> then
write to standard out.
This is mandatory for <command>named-compilezone</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-r <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Check for records that are treated as different by DNSSEC but
are semantically equal in plain DNS.
Possible modes are <command>"fail"</command>,
<command>"warn"</command> (default) and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s <replaceable class="parameter">style</replaceable></term>
<listitem>
<para>
Specify the style of the dumped zone file.
Possible styles are <command>"full"</command> (default)
and <command>"relative"</command>.
The full format is most suitable for processing
automatically by a separate script.
On the other hand, the relative format is more
human-readable and is thus suitable for editing by hand.
For <command>named-checkzone</command>
this does not cause any effects unless it dumps the zone
contents.
It also does not have any meaning if the output format
is not text.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-S <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Check if a SRV record refers to a CNAME.
Possible modes are <command>"fail"</command>,
<command>"warn"</command> (default) and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">directory</replaceable></term>
<listitem>
<para>
Chroot to <filename>directory</filename> so that
include
directives in the configuration file are processed as if
run by a similarly chrooted <command>named</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-T <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Check if Sender Policy Framework (SPF) records exist
and issues a warning if an SPF-formatted TXT record is
not also present. Possible modes are <command>"warn"</command>
(default), <command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-w <replaceable class="parameter">directory</replaceable></term>
<listitem>
<para>
chdir to <filename>directory</filename> so that
relative
filenames in master file $INCLUDE directives work. This
is similar to the directory clause in
<filename>named.conf</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Dump zone file in canonical format.
This is always enabled for <command>named-compilezone</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-W <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Specify whether to check for non-terminal wildcards.
Non-terminal wildcards are almost always the result of a
failure to understand the wildcard matching algorithm (RFC 1034).
Possible modes are <command>"warn"</command> (default)
and
<command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>zonename</term>
<listitem>
<para>
The domain name of the zone being checked.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>filename</term>
<listitem>
<para>
The name of the zone file.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>RETURN VALUES</title></info>
<para><command>named-checkzone</command>
returns an exit status of 1 if
errors were detected and 0 otherwise.
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named-checkconf</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>RFC 1035</citetitle>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>.
</para>
</refsection>
</refentry>

View File

@@ -1,429 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>named-checkzone</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.named-checkzone"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
<span class="application">named-checkzone</span>,
<span class="application">named-compilezone</span>
&#8212; zone file validity checking or converting tool
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">named-checkzone</code>
[<code class="option">-d</code>]
[<code class="option">-h</code>]
[<code class="option">-j</code>]
[<code class="option">-q</code>]
[<code class="option">-v</code>]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-f <em class="replaceable"><code>format</code></em></code>]
[<code class="option">-F <em class="replaceable"><code>format</code></em></code>]
[<code class="option">-J <em class="replaceable"><code>filename</code></em></code>]
[<code class="option">-i <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-k <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-m <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-M <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-n <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-l <em class="replaceable"><code>ttl</code></em></code>]
[<code class="option">-L <em class="replaceable"><code>serial</code></em></code>]
[<code class="option">-o <em class="replaceable"><code>filename</code></em></code>]
[<code class="option">-r <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-s <em class="replaceable"><code>style</code></em></code>]
[<code class="option">-S <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>directory</code></em></code>]
[<code class="option">-T <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-w <em class="replaceable"><code>directory</code></em></code>]
[<code class="option">-D</code>]
[<code class="option">-W <em class="replaceable"><code>mode</code></em></code>]
{zonename}
{filename}
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">named-compilezone</code>
[<code class="option">-d</code>]
[<code class="option">-j</code>]
[<code class="option">-q</code>]
[<code class="option">-v</code>]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-C <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-f <em class="replaceable"><code>format</code></em></code>]
[<code class="option">-F <em class="replaceable"><code>format</code></em></code>]
[<code class="option">-J <em class="replaceable"><code>filename</code></em></code>]
[<code class="option">-i <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-k <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-m <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-n <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-l <em class="replaceable"><code>ttl</code></em></code>]
[<code class="option">-L <em class="replaceable"><code>serial</code></em></code>]
[<code class="option">-r <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-s <em class="replaceable"><code>style</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>directory</code></em></code>]
[<code class="option">-T <em class="replaceable"><code>mode</code></em></code>]
[<code class="option">-w <em class="replaceable"><code>directory</code></em></code>]
[<code class="option">-D</code>]
[<code class="option">-W <em class="replaceable"><code>mode</code></em></code>]
{<code class="option">-o <em class="replaceable"><code>filename</code></em></code>}
{zonename}
{filename}
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p><span class="command"><strong>named-checkzone</strong></span>
checks the syntax and integrity of a zone file. It performs the
same checks as <span class="command"><strong>named</strong></span> does when loading a
zone. This makes <span class="command"><strong>named-checkzone</strong></span> useful for
checking zone files before configuring them into a name server.
</p>
<p>
<span class="command"><strong>named-compilezone</strong></span> is similar to
<span class="command"><strong>named-checkzone</strong></span>, but it always dumps the
zone contents to a specified file in a specified format.
Additionally, it applies stricter check levels by default,
since the dump output will be used as an actual zone file
loaded by <span class="command"><strong>named</strong></span>.
When manually specified otherwise, the check levels must at
least be as strict as those specified in the
<span class="command"><strong>named</strong></span> configuration file.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-d</span></dt>
<dd>
<p>
Enable debugging.
</p>
</dd>
<dt><span class="term">-h</span></dt>
<dd>
<p>
Print the usage summary and exit.
</p>
</dd>
<dt><span class="term">-q</span></dt>
<dd>
<p>
Quiet mode - exit code only.
</p>
</dd>
<dt><span class="term">-v</span></dt>
<dd>
<p>
Print the version of the <span class="command"><strong>named-checkzone</strong></span>
program and exit.
</p>
</dd>
<dt><span class="term">-j</span></dt>
<dd>
<p>
When loading a zone file, read the journal if it exists.
The journal file name is assumed to be the zone file name
appended with the string <code class="filename">.jnl</code>.
</p>
</dd>
<dt><span class="term">-J <em class="replaceable"><code>filename</code></em></span></dt>
<dd>
<p>
When loading the zone file read the journal from the given
file, if it exists. (Implies -j.)
</p>
</dd>
<dt><span class="term">-c <em class="replaceable"><code>class</code></em></span></dt>
<dd>
<p>
Specify the class of the zone. If not specified, "IN" is assumed.
</p>
</dd>
<dt><span class="term">-i <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Perform post-load zone integrity checks. Possible modes are
<span class="command"><strong>"full"</strong></span> (default),
<span class="command"><strong>"full-sibling"</strong></span>,
<span class="command"><strong>"local"</strong></span>,
<span class="command"><strong>"local-sibling"</strong></span> and
<span class="command"><strong>"none"</strong></span>.
</p>
<p>
Mode <span class="command"><strong>"full"</strong></span> checks that MX records
refer to A or AAAA record (both in-zone and out-of-zone
hostnames). Mode <span class="command"><strong>"local"</strong></span> only
checks MX records which refer to in-zone hostnames.
</p>
<p>
Mode <span class="command"><strong>"full"</strong></span> checks that SRV records
refer to A or AAAA record (both in-zone and out-of-zone
hostnames). Mode <span class="command"><strong>"local"</strong></span> only
checks SRV records which refer to in-zone hostnames.
</p>
<p>
Mode <span class="command"><strong>"full"</strong></span> checks that delegation NS
records refer to A or AAAA record (both in-zone and out-of-zone
hostnames). It also checks that glue address records
in the zone match those advertised by the child.
Mode <span class="command"><strong>"local"</strong></span> only checks NS records which
refer to in-zone hostnames or that some required glue exists,
that is when the nameserver is in a child zone.
</p>
<p>
Mode <span class="command"><strong>"full-sibling"</strong></span> and
<span class="command"><strong>"local-sibling"</strong></span> disable sibling glue
checks but are otherwise the same as <span class="command"><strong>"full"</strong></span>
and <span class="command"><strong>"local"</strong></span> respectively.
</p>
<p>
Mode <span class="command"><strong>"none"</strong></span> disables the checks.
</p>
</dd>
<dt><span class="term">-f <em class="replaceable"><code>format</code></em></span></dt>
<dd>
<p>
Specify the format of the zone file.
Possible formats are <span class="command"><strong>"text"</strong></span> (default),
<span class="command"><strong>"raw"</strong></span>, and <span class="command"><strong>"map"</strong></span>.
</p>
</dd>
<dt><span class="term">-F <em class="replaceable"><code>format</code></em></span></dt>
<dd>
<p>
Specify the format of the output file specified.
For <span class="command"><strong>named-checkzone</strong></span>,
this does not cause any effects unless it dumps the zone
contents.
</p>
<p>
Possible formats are <span class="command"><strong>"text"</strong></span> (default),
which is the standard textual representation of the zone,
and <span class="command"><strong>"map"</strong></span>, <span class="command"><strong>"raw"</strong></span>,
and <span class="command"><strong>"raw=N"</strong></span>, which store the zone in a
binary format for rapid loading by <span class="command"><strong>named</strong></span>.
<span class="command"><strong>"raw=N"</strong></span> specifies the format version of
the raw zone file: if N is 0, the raw file can be read by
any version of <span class="command"><strong>named</strong></span>; if N is 1, the file
can be read by release 9.9.0 or higher; the default is 1.
</p>
</dd>
<dt><span class="term">-k <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Perform <span class="command"><strong>"check-names"</strong></span> checks with the
specified failure mode.
Possible modes are <span class="command"><strong>"fail"</strong></span>
(default for <span class="command"><strong>named-compilezone</strong></span>),
<span class="command"><strong>"warn"</strong></span>
(default for <span class="command"><strong>named-checkzone</strong></span>) and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-l <em class="replaceable"><code>ttl</code></em></span></dt>
<dd>
<p>
Sets a maximum permissible TTL for the input file.
Any record with a TTL higher than this value will cause
the zone to be rejected. This is similar to using the
<span class="command"><strong>max-zone-ttl</strong></span> option in
<code class="filename">named.conf</code>.
</p>
</dd>
<dt><span class="term">-L <em class="replaceable"><code>serial</code></em></span></dt>
<dd>
<p>
When compiling a zone to "raw" or "map" format, set the
"source serial" value in the header to the specified serial
number. (This is expected to be used primarily for testing
purposes.)
</p>
</dd>
<dt><span class="term">-m <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Specify whether MX records should be checked to see if they
are addresses. Possible modes are <span class="command"><strong>"fail"</strong></span>,
<span class="command"><strong>"warn"</strong></span> (default) and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-M <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Check if a MX record refers to a CNAME.
Possible modes are <span class="command"><strong>"fail"</strong></span>,
<span class="command"><strong>"warn"</strong></span> (default) and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-n <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Specify whether NS records should be checked to see if they
are addresses.
Possible modes are <span class="command"><strong>"fail"</strong></span>
(default for <span class="command"><strong>named-compilezone</strong></span>),
<span class="command"><strong>"warn"</strong></span>
(default for <span class="command"><strong>named-checkzone</strong></span>) and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-o <em class="replaceable"><code>filename</code></em></span></dt>
<dd>
<p>
Write zone output to <code class="filename">filename</code>.
If <code class="filename">filename</code> is <code class="filename">-</code> then
write to standard out.
This is mandatory for <span class="command"><strong>named-compilezone</strong></span>.
</p>
</dd>
<dt><span class="term">-r <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Check for records that are treated as different by DNSSEC but
are semantically equal in plain DNS.
Possible modes are <span class="command"><strong>"fail"</strong></span>,
<span class="command"><strong>"warn"</strong></span> (default) and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-s <em class="replaceable"><code>style</code></em></span></dt>
<dd>
<p>
Specify the style of the dumped zone file.
Possible styles are <span class="command"><strong>"full"</strong></span> (default)
and <span class="command"><strong>"relative"</strong></span>.
The full format is most suitable for processing
automatically by a separate script.
On the other hand, the relative format is more
human-readable and is thus suitable for editing by hand.
For <span class="command"><strong>named-checkzone</strong></span>
this does not cause any effects unless it dumps the zone
contents.
It also does not have any meaning if the output format
is not text.
</p>
</dd>
<dt><span class="term">-S <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Check if a SRV record refers to a CNAME.
Possible modes are <span class="command"><strong>"fail"</strong></span>,
<span class="command"><strong>"warn"</strong></span> (default) and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-t <em class="replaceable"><code>directory</code></em></span></dt>
<dd>
<p>
Chroot to <code class="filename">directory</code> so that
include
directives in the configuration file are processed as if
run by a similarly chrooted <span class="command"><strong>named</strong></span>.
</p>
</dd>
<dt><span class="term">-T <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Check if Sender Policy Framework (SPF) records exist
and issues a warning if an SPF-formatted TXT record is
not also present. Possible modes are <span class="command"><strong>"warn"</strong></span>
(default), <span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">-w <em class="replaceable"><code>directory</code></em></span></dt>
<dd>
<p>
chdir to <code class="filename">directory</code> so that
relative
filenames in master file $INCLUDE directives work. This
is similar to the directory clause in
<code class="filename">named.conf</code>.
</p>
</dd>
<dt><span class="term">-D</span></dt>
<dd>
<p>
Dump zone file in canonical format.
This is always enabled for <span class="command"><strong>named-compilezone</strong></span>.
</p>
</dd>
<dt><span class="term">-W <em class="replaceable"><code>mode</code></em></span></dt>
<dd>
<p>
Specify whether to check for non-terminal wildcards.
Non-terminal wildcards are almost always the result of a
failure to understand the wildcard matching algorithm (RFC 1034).
Possible modes are <span class="command"><strong>"warn"</strong></span> (default)
and
<span class="command"><strong>"ignore"</strong></span>.
</p>
</dd>
<dt><span class="term">zonename</span></dt>
<dd>
<p>
The domain name of the zone being checked.
</p>
</dd>
<dt><span class="term">filename</span></dt>
<dd>
<p>
The name of the zone file.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>RETURN VALUES</h2>
<p><span class="command"><strong>named-checkzone</strong></span>
returns an exit status of 1 if
errors were detected and 0 otherwise.
</p>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named-checkconf</span>(8)
</span>,
<em class="citetitle">RFC 1035</em>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>.
</p>
</div>
</div></body>
</html>

View File

@@ -0,0 +1,214 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_named-checkzone:
named-checkzone, named-compilezone - zone file validity checking or converting tool
-----------------------------------------------------------------------------------
Synopsis
~~~~~~~~
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
:program:`named-compilezone` [**-d**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-s** style] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
Description
~~~~~~~~~~~
``named-checkzone`` checks the syntax and integrity of a zone file. It
performs the same checks as ``named`` does when loading a zone. This
makes ``named-checkzone`` useful for checking zone files before
configuring them into a name server.
``named-compilezone`` is similar to ``named-checkzone``, but it always
dumps the zone contents to a specified file in a specified format.
Additionally, it applies stricter check levels by default, since the
dump output will be used as an actual zone file loaded by ``named``.
When manually specified otherwise, the check levels must at least be as
strict as those specified in the ``named`` configuration file.
Options
~~~~~~~
**-d**
Enable debugging.
**-h**
Print the usage summary and exit.
**-q**
Quiet mode - exit code only.
**-v**
Print the version of the ``named-checkzone`` program and exit.
**-j**
When loading a zone file, read the journal if it exists. The journal
file name is assumed to be the zone file name appended with the
string ``.jnl``.
**-J** filename
When loading the zone file read the journal from the given file, if
it exists. (Implies -j.)
**-c** class
Specify the class of the zone. If not specified, "IN" is assumed.
**-i** mode
Perform post-load zone integrity checks. Possible modes are
``"full"`` (default), ``"full-sibling"``, ``"local"``,
``"local-sibling"`` and ``"none"``.
Mode ``"full"`` checks that MX records refer to A or AAAA record
(both in-zone and out-of-zone hostnames). Mode ``"local"`` only
checks MX records which refer to in-zone hostnames.
Mode ``"full"`` checks that SRV records refer to A or AAAA record
(both in-zone and out-of-zone hostnames). Mode ``"local"`` only
checks SRV records which refer to in-zone hostnames.
Mode ``"full"`` checks that delegation NS records refer to A or AAAA
record (both in-zone and out-of-zone hostnames). It also checks that
glue address records in the zone match those advertised by the child.
Mode ``"local"`` only checks NS records which refer to in-zone
hostnames or that some required glue exists, that is when the
nameserver is in a child zone.
Mode ``"full-sibling"`` and ``"local-sibling"`` disable sibling glue
checks but are otherwise the same as ``"full"`` and ``"local"``
respectively.
Mode ``"none"`` disables the checks.
**-f** format
Specify the format of the zone file. Possible formats are ``"text"``
(default), ``"raw"``, and ``"map"``.
**-F** format
Specify the format of the output file specified. For
``named-checkzone``, this does not cause any effects unless it dumps
the zone contents.
Possible formats are ``"text"`` (default), which is the standard
textual representation of the zone, and ``"map"``, ``"raw"``, and
``"raw=N"``, which store the zone in a binary format for rapid
loading by ``named``. ``"raw=N"`` specifies the format version of the
raw zone file: if N is 0, the raw file can be read by any version of
``named``; if N is 1, the file can be read by release 9.9.0 or
higher; the default is 1.
**-k** mode
Perform ``"check-names"`` checks with the specified failure mode.
Possible modes are ``"fail"`` (default for ``named-compilezone``),
``"warn"`` (default for ``named-checkzone``) and ``"ignore"``.
**-l** ttl
Sets a maximum permissible TTL for the input file. Any record with a
TTL higher than this value will cause the zone to be rejected. This
is similar to using the ``max-zone-ttl`` option in ``named.conf``.
**-L** serial
When compiling a zone to "raw" or "map" format, set the "source
serial" value in the header to the specified serial number. (This is
expected to be used primarily for testing purposes.)
**-m** mode
Specify whether MX records should be checked to see if they are
addresses. Possible modes are ``"fail"``, ``"warn"`` (default) and
``"ignore"``.
**-M** mode
Check if a MX record refers to a CNAME. Possible modes are
``"fail"``, ``"warn"`` (default) and ``"ignore"``.
**-n** mode
Specify whether NS records should be checked to see if they are
addresses. Possible modes are ``"fail"`` (default for
``named-compilezone``), ``"warn"`` (default for ``named-checkzone``)
and ``"ignore"``.
**-o** filename
Write zone output to ``filename``. If ``filename`` is ``-`` then
write to standard out. This is mandatory for ``named-compilezone``.
**-r** mode
Check for records that are treated as different by DNSSEC but are
semantically equal in plain DNS. Possible modes are ``"fail"``,
``"warn"`` (default) and ``"ignore"``.
**-s** style
Specify the style of the dumped zone file. Possible styles are
``"full"`` (default) and ``"relative"``. The full format is most
suitable for processing automatically by a separate script. On the
other hand, the relative format is more human-readable and is thus
suitable for editing by hand. For ``named-checkzone`` this does not
cause any effects unless it dumps the zone contents. It also does not
have any meaning if the output format is not text.
**-S** mode
Check if a SRV record refers to a CNAME. Possible modes are
``"fail"``, ``"warn"`` (default) and ``"ignore"``.
**-t** directory
Chroot to ``directory`` so that include directives in the
configuration file are processed as if run by a similarly chrooted
``named``.
**-T** mode
Check if Sender Policy Framework (SPF) records exist and issues a
warning if an SPF-formatted TXT record is not also present. Possible
modes are ``"warn"`` (default), ``"ignore"``.
**-w** directory
chdir to ``directory`` so that relative filenames in master file
$INCLUDE directives work. This is similar to the directory clause in
``named.conf``.
**-D**
Dump zone file in canonical format. This is always enabled for
``named-compilezone``.
**-W** mode
Specify whether to check for non-terminal wildcards. Non-terminal
wildcards are almost always the result of a failure to understand the
wildcard matching algorithm (:rfc:`1034`). Possible modes are ``"warn"``
(default) and ``"ignore"``.
zonename
The domain name of the zone being checked.
filename
The name of the zone file.
Return Values
~~~~~~~~~~~~~
``named-checkzone`` returns an exit status of 1 if errors were detected
and 0 otherwise.
See Also
~~~~~~~~
:manpage:`named(8)`, :manpage:`named-checkconf(8)`, :rfc:`1035`, BIND 9 Administrator Reference
Manual.

View File

@@ -44,19 +44,22 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>named-$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>named-$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -79,7 +82,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -48,18 +48,21 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<OutDir>.\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -78,7 +81,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -44,19 +44,22 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>named-$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>named-$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -85,7 +88,8 @@ copy /Y named-checkzone.ilk named-compilezone.ilk
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -27,9 +27,9 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
@@ -53,12 +53,6 @@ SUBDIRS = unix
TARGETS = rndc-confgen@EXEEXT@ ddns-confgen@EXEEXT@ tsig-keygen@EXEEXT@
MANPAGES = rndc-confgen.8 ddns-confgen.8
HTMLPAGES = rndc-confgen.html ddns-confgen.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
UOBJS = unix/os.@O@
@BIND9_MAKE_RULES@
@@ -84,28 +78,16 @@ tsig-keygen@EXEEXT@: ddns-confgen@EXEEXT@
rm -f tsig-keygen@EXEEXT@
${LINK_PROGRAM} ddns-confgen@EXEEXT@ tsig-keygen@EXEEXT@
doc man:: ${MANOBJS}
docclean manclean maintainer-clean::
rm -f ${MANOBJS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
install:: rndc-confgen@EXEEXT@ ddns-confgen@EXEEXT@ installdirs
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} rndc-confgen@EXEEXT@ ${DESTDIR}${sbindir}
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} ddns-confgen@EXEEXT@ ${DESTDIR}${sbindir}
${INSTALL_DATA} ${srcdir}/rndc-confgen.8 ${DESTDIR}${mandir}/man8
${INSTALL_DATA} ${srcdir}/ddns-confgen.8 ${DESTDIR}${mandir}/man8
(cd ${DESTDIR}${sbindir}; rm -f tsig-keygen@EXEEXT@; ${LINK_PROGRAM} ddns-confgen@EXEEXT@ tsig-keygen@EXEEXT@)
(cd ${DESTDIR}${mandir}/man8; rm -f tsig-keygen.8; ${LINK_PROGRAM} ddns-confgen.8 tsig-keygen.8)
uninstall::
rm -f ${DESTDIR}${mandir}/man8/tsig-keygen.8
rm -f ${DESTDIR}${sbindir}/tsig-keygen@EXEEXT@
rm -f ${DESTDIR}${mandir}/man8/ddns-confgen.8
rm -f ${DESTDIR}${mandir}/man8/rndc-confgen.8
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/ddns-confgen@EXEEXT@
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/rndc-confgen@EXEEXT@

View File

@@ -1,148 +0,0 @@
.\" Copyright (C) 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: ddns-confgen
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-03-06
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "DDNS\-CONFGEN" "8" "2014\-03\-06" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ddns-confgen \- ddns key generation tool
.SH "SYNOPSIS"
.HP \w'\fBtsig\-keygen\fR\ 'u
\fBtsig\-keygen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-h\fR] [name]
.HP \w'\fBddns\-confgen\fR\ 'u
\fBddns\-confgen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkeyname\fR\fR] [\fB\-q\fR] [\fB\-r\ \fR\fB\fIrandomfile\fR\fR] [\-s\ \fIname\fR | \-z\ \fIzone\fR]
.SH "DESCRIPTION"
.PP
\fBtsig\-keygen\fR
and
\fBddns\-confgen\fR
are invocation methods for a utility that generates keys for use in TSIG signing\&. The resulting keys can be used, for example, to secure dynamic DNS updates to a zone or for the
\fBrndc\fR
command channel\&.
.PP
When run as
\fBtsig\-keygen\fR, a domain name can be specified on the command line which will be used as the name of the generated key\&. If no name is specified, the default is
\fBtsig\-key\fR\&.
.PP
When run as
\fBddns\-confgen\fR, the generated key is accompanied by configuration text and instructions that can be used with
\fBnsupdate\fR
and
\fBnamed\fR
when setting up dynamic DNS, including an example
\fBupdate\-policy\fR
statement\&. (This usage similar to the
\fBrndc\-confgen\fR
command for setting up command channel security\&.)
.PP
Note that
\fBnamed\fR
itself can configure a local DDNS key for use with
\fBnsupdate \-l\fR: it does this when a zone is configured with
\fBupdate\-policy local;\fR\&.
\fBddns\-confgen\fR
is only needed when a more elaborate configuration is required: for instance, if
\fBnsupdate\fR
is to be used from a remote system\&.
.SH "OPTIONS"
.PP
\-a \fIalgorithm\fR
.RS 4
Specifies the algorithm to use for the TSIG key\&. Available choices are: hmac\-md5, hmac\-sha1, hmac\-sha224, hmac\-sha256, hmac\-sha384 and hmac\-sha512\&. The default is hmac\-sha256\&. Options are case\-insensitive, and the "hmac\-" prefix may be omitted\&.
.RE
.PP
\-h
.RS 4
Prints a short summary of options and arguments\&.
.RE
.PP
\-k \fIkeyname\fR
.RS 4
Specifies the key name of the DDNS authentication key\&. The default is
\fBddns\-key\fR
when neither the
\fB\-s\fR
nor
\fB\-z\fR
option is specified; otherwise, the default is
\fBddns\-key\fR
as a separate label followed by the argument of the option, e\&.g\&.,
\fBddns\-key\&.example\&.com\&.\fR
The key name must have the format of a valid domain name, consisting of letters, digits, hyphens and periods\&.
.RE
.PP
\-q
.RS 4
(\fBddns\-confgen\fR
only\&.) Quiet mode: Print only the key, with no explanatory text or usage examples; This is essentially identical to
\fBtsig\-keygen\fR\&.
.RE
.PP
\-s \fIname\fR
.RS 4
(\fBddns\-confgen\fR
only\&.) Generate configuration example to allow dynamic updates of a single hostname\&. The example
\fBnamed\&.conf\fR
text shows how to set an update policy for the specified
\fIname\fR
using the "name" nametype\&. The default key name is ddns\-key\&.\fIname\fR\&. Note that the "self" nametype cannot be used, since the name to be updated may differ from the key name\&. This option cannot be used with the
\fB\-z\fR
option\&.
.RE
.PP
\-z \fIzone\fR
.RS 4
(\fBddns\-confgen\fR
only\&.) Generate configuration example to allow dynamic updates of a zone: The example
\fBnamed\&.conf\fR
text shows how to set an update policy for the specified
\fIzone\fR
using the "zonesub" nametype, allowing updates to all subdomain names within that
\fIzone\fR\&. This option cannot be used with the
\fB\-s\fR
option\&.
.RE
.SH "SEE ALSO"
.PP
\fBnsupdate\fR(1),
\fBnamed.conf\fR(5),
\fBnamed\fR(8),
BIND 9 Administrator Reference Manual\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -36,24 +36,25 @@
#if USE_PKCS11
#include <pk11/result.h>
#endif
#endif /* if USE_PKCS11 */
#include <dns/keyvalues.h>
#include <dns/name.h>
#include <dns/result.h>
#include <dst/dst.h>
#include <confgen/os.h>
#include "util.h"
#include "keygen.h"
#include "util.h"
#define KEYGEN_DEFAULT "tsig-key"
#define CONFGEN_DEFAULT "ddns-key"
#define KEYGEN_DEFAULT "tsig-key"
#define CONFGEN_DEFAULT "ddns-key"
static char program[256];
const char *progname;
static enum { progmode_keygen, progmode_confgen} progmode;
static enum { progmode_keygen, progmode_confgen } progmode;
bool verbose = false; /* needed by util.c but not used here */
ISC_PLATFORM_NORETURN_PRE static void
@@ -70,16 +71,16 @@ Usage:\n\
-s name: domain name to be updated using the created key\n\
-z zone: name of the zone as it will be used in named.conf\n\
-q: quiet mode: print the key, with no explanatory text\n",
progname);
progname);
} else {
fprintf(stderr, "\
Usage:\n\
%s [-a alg] [keyname]\n\
-a alg: algorithm (default hmac-sha256)\n\n",
progname);
progname);
}
exit (status);
exit(status);
}
int
@@ -102,20 +103,22 @@ main(int argc, char **argv) {
#if USE_PKCS11
pk11_result_register();
#endif
#endif /* if USE_PKCS11 */
dns_result_register();
result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
memmove(program, "tsig-keygen", 11);
}
progname = program;
/*
* Libtool doesn't preserve the program name prior to final
* installation. Remove the libtool prefix ("lt-").
*/
if (strncmp(progname, "lt-", 3) == 0)
if (strncmp(progname, "lt-", 3) == 0) {
progname += 3;
}
#define PROGCMP(X) \
(strcasecmp(progname, X) == 0 || strcasecmp(progname, X ".exe") == 0)
@@ -132,24 +135,26 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
while ((ch = isc_commandline_parse(argc, argv,
"a:hk:Mmr:qs:y:z:")) != -1) {
while ((ch = isc_commandline_parse(argc, argv, "a:hk:Mmr:qs:y:z:")) !=
-1) {
switch (ch) {
case 'a':
algname = isc_commandline_argument;
alg = alg_fromtext(algname);
if (alg == DST_ALG_UNKNOWN)
if (alg == DST_ALG_UNKNOWN) {
fatal("Unsupported algorithm '%s'", algname);
}
keysize = alg_bits(alg);
break;
case 'h':
usage(0);
case 'k':
case 'y':
if (progmode == progmode_confgen)
if (progmode == progmode_confgen) {
keyname = isc_commandline_argument;
else
} else {
usage(1);
}
break;
case 'M':
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
@@ -158,51 +163,58 @@ main(int argc, char **argv) {
show_final_mem = true;
break;
case 'q':
if (progmode == progmode_confgen)
if (progmode == progmode_confgen) {
quiet = true;
else
} else {
usage(1);
}
break;
case 'r':
fatal("The -r option has been deprecated.");
break;
case 's':
if (progmode == progmode_confgen)
if (progmode == progmode_confgen) {
self_domain = isc_commandline_argument;
else
} else {
usage(1);
}
break;
case 'z':
if (progmode == progmode_confgen)
if (progmode == progmode_confgen) {
zone = isc_commandline_argument;
else
} else {
usage(1);
}
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(1);
} else
} else {
usage(0);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
}
}
if (progmode == progmode_keygen)
if (progmode == progmode_keygen) {
keyname = argv[isc_commandline_index++];
}
POST(argv);
if (self_domain != NULL && zone != NULL)
usage(1); /* -s and -z cannot coexist */
if (self_domain != NULL && zone != NULL) {
usage(1); /* -s and -z cannot coexist */
}
if (argc > isc_commandline_index)
if (argc > isc_commandline_index) {
usage(1);
}
/* Use canonical algorithm name */
algname = alg_totext(alg);
@@ -212,18 +224,18 @@ main(int argc, char **argv) {
if (keyname == NULL) {
const char *suffix = NULL;
keyname = ((progmode == progmode_keygen)
? KEYGEN_DEFAULT
: CONFGEN_DEFAULT);
if (self_domain != NULL)
keyname = ((progmode == progmode_keygen) ? KEYGEN_DEFAULT
: CONFGEN_DEFAULT);
if (self_domain != NULL) {
suffix = self_domain;
else if (zone != NULL)
} else if (zone != NULL) {
suffix = zone;
}
if (suffix != NULL) {
len = strlen(keyname) + strlen(suffix) + 2;
keybuf = isc_mem_get(mctx, len);
snprintf(keybuf, len, "%s.%s", keyname, suffix);
keyname = (const char *) keybuf;
keyname = (const char *)keybuf;
}
}
@@ -231,20 +243,19 @@ main(int argc, char **argv) {
generate_key(mctx, alg, keysize, &key_txtbuffer);
if (!quiet)
if (!quiet) {
printf("\
# To activate this key, place the following in named.conf, and\n\
# in a separate keyfile on the system or systems from which nsupdate\n\
# will be run:\n");
}
printf("\
key \"%s\" {\n\
algorithm %s;\n\
secret \"%.*s\";\n\
};\n",
keyname, algname,
(int)isc_buffer_usedlength(&key_txtbuffer),
keyname, algname, (int)isc_buffer_usedlength(&key_txtbuffer),
(char *)isc_buffer_base(&key_txtbuffer));
if (!quiet) {
@@ -282,14 +293,15 @@ update-policy {\n\
# After the keyfile has been placed, the following command will\n\
# execute nsupdate using this key:\n\
nsupdate -k <keyfile>\n");
}
if (keybuf != NULL)
if (keybuf != NULL) {
isc_mem_put(mctx, keybuf, len);
}
if (show_final_mem)
if (show_final_mem) {
isc_mem_stats(mctx, stderr);
}
isc_mem_destroy(&mctx);

View File

@@ -1,213 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.ddns-confgen">
<info>
<date>2014-03-06</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle><application>ddns-confgen</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>ddns-confgen</application></refname>
<refpurpose>ddns key generation tool</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2009</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>tsig-keygen</command>
<arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat">name</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>ddns-confgen</command>
<arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-k <replaceable class="parameter">keyname</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-q</option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">randomfile</replaceable></option></arg>
<group choice="opt" rep="norepeat">
<arg choice="plain" rep="norepeat">-s <replaceable class="parameter">name</replaceable></arg>
<arg choice="plain" rep="norepeat">-z <replaceable class="parameter">zone</replaceable></arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para>
<command>tsig-keygen</command> and <command>ddns-confgen</command>
are invocation methods for a utility that generates keys for use
in TSIG signing. The resulting keys can be used, for example,
to secure dynamic DNS updates to a zone or for the
<command>rndc</command> command channel.
</para>
<para>
When run as <command>tsig-keygen</command>, a domain name
can be specified on the command line which will be used as
the name of the generated key. If no name is specified,
the default is <constant>tsig-key</constant>.
</para>
<para>
When run as <command>ddns-confgen</command>, the generated
key is accompanied by configuration text and instructions
that can be used with <command>nsupdate</command> and
<command>named</command> when setting up dynamic DNS,
including an example <command>update-policy</command>
statement. (This usage similar to the
<command>rndc-confgen</command> command for setting
up command channel security.)
</para>
<para>
Note that <command>named</command> itself can configure a
local DDNS key for use with <command>nsupdate -l</command>:
it does this when a zone is configured with
<command>update-policy local;</command>.
<command>ddns-confgen</command> is only needed when a
more elaborate configuration is required: for instance,
if <command>nsupdate</command> is to be used from a remote
system.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-a <replaceable class="parameter">algorithm</replaceable></term>
<listitem>
<para>
Specifies the algorithm to use for the TSIG key. Available
choices are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,
hmac-sha384 and hmac-sha512. The default is hmac-sha256.
Options are case-insensitive, and the "hmac-" prefix
may be omitted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Prints a short summary of options and arguments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-k <replaceable class="parameter">keyname</replaceable></term>
<listitem>
<para>
Specifies the key name of the DDNS authentication key.
The default is <constant>ddns-key</constant> when neither
the <option>-s</option> nor <option>-z</option> option is
specified; otherwise, the default
is <constant>ddns-key</constant> as a separate label
followed by the argument of the option, e.g.,
<constant>ddns-key.example.com.</constant>
The key name must have the format of a valid domain name,
consisting of letters, digits, hyphens and periods.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-q</term>
<listitem>
<para>
(<command>ddns-confgen</command> only.) Quiet mode: Print
only the key, with no explanatory text or usage examples;
This is essentially identical to <command>tsig-keygen</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s <replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
(<command>ddns-confgen</command> only.)
Generate configuration example to allow dynamic updates
of a single hostname. The example <command>named.conf</command>
text shows how to set an update policy for the specified
<replaceable class="parameter">name</replaceable>
using the "name" nametype. The default key name is
ddns-key.<replaceable class="parameter">name</replaceable>.
Note that the "self" nametype cannot be used, since
the name to be updated may differ from the key name.
This option cannot be used with the <option>-z</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-z <replaceable class="parameter">zone</replaceable></term>
<listitem>
<para>
(<command>ddns-confgen</command> only.)
Generate configuration example to allow dynamic updates
of a zone: The example <command>named.conf</command> text
shows how to set an update policy for the specified
<replaceable class="parameter">zone</replaceable>
using the "zonesub" nametype, allowing updates to
all subdomain names within that
<replaceable class="parameter">zone</replaceable>.
This option cannot be used with the <option>-s</option> option.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>nsupdate</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named.conf</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>.
</para>
</refsection>
</refentry>

View File

@@ -1,187 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2009, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ddns-confgen</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.ddns-confgen"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
<span class="application">ddns-confgen</span>
&#8212; ddns key generation tool
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">tsig-keygen</code>
[<code class="option">-a <em class="replaceable"><code>algorithm</code></em></code>]
[<code class="option">-h</code>]
[name]
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">ddns-confgen</code>
[<code class="option">-a <em class="replaceable"><code>algorithm</code></em></code>]
[<code class="option">-h</code>]
[<code class="option">-k <em class="replaceable"><code>keyname</code></em></code>]
[<code class="option">-q</code>]
[<code class="option">-r <em class="replaceable"><code>randomfile</code></em></code>]
[
-s <em class="replaceable"><code>name</code></em>
| -z <em class="replaceable"><code>zone</code></em>
]
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p>
<span class="command"><strong>tsig-keygen</strong></span> and <span class="command"><strong>ddns-confgen</strong></span>
are invocation methods for a utility that generates keys for use
in TSIG signing. The resulting keys can be used, for example,
to secure dynamic DNS updates to a zone or for the
<span class="command"><strong>rndc</strong></span> command channel.
</p>
<p>
When run as <span class="command"><strong>tsig-keygen</strong></span>, a domain name
can be specified on the command line which will be used as
the name of the generated key. If no name is specified,
the default is <code class="constant">tsig-key</code>.
</p>
<p>
When run as <span class="command"><strong>ddns-confgen</strong></span>, the generated
key is accompanied by configuration text and instructions
that can be used with <span class="command"><strong>nsupdate</strong></span> and
<span class="command"><strong>named</strong></span> when setting up dynamic DNS,
including an example <span class="command"><strong>update-policy</strong></span>
statement. (This usage similar to the
<span class="command"><strong>rndc-confgen</strong></span> command for setting
up command channel security.)
</p>
<p>
Note that <span class="command"><strong>named</strong></span> itself can configure a
local DDNS key for use with <span class="command"><strong>nsupdate -l</strong></span>:
it does this when a zone is configured with
<span class="command"><strong>update-policy local;</strong></span>.
<span class="command"><strong>ddns-confgen</strong></span> is only needed when a
more elaborate configuration is required: for instance,
if <span class="command"><strong>nsupdate</strong></span> is to be used from a remote
system.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-a <em class="replaceable"><code>algorithm</code></em></span></dt>
<dd>
<p>
Specifies the algorithm to use for the TSIG key. Available
choices are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,
hmac-sha384 and hmac-sha512. The default is hmac-sha256.
Options are case-insensitive, and the "hmac-" prefix
may be omitted.
</p>
</dd>
<dt><span class="term">-h</span></dt>
<dd>
<p>
Prints a short summary of options and arguments.
</p>
</dd>
<dt><span class="term">-k <em class="replaceable"><code>keyname</code></em></span></dt>
<dd>
<p>
Specifies the key name of the DDNS authentication key.
The default is <code class="constant">ddns-key</code> when neither
the <code class="option">-s</code> nor <code class="option">-z</code> option is
specified; otherwise, the default
is <code class="constant">ddns-key</code> as a separate label
followed by the argument of the option, e.g.,
<code class="constant">ddns-key.example.com.</code>
The key name must have the format of a valid domain name,
consisting of letters, digits, hyphens and periods.
</p>
</dd>
<dt><span class="term">-q</span></dt>
<dd>
<p>
(<span class="command"><strong>ddns-confgen</strong></span> only.) Quiet mode: Print
only the key, with no explanatory text or usage examples;
This is essentially identical to <span class="command"><strong>tsig-keygen</strong></span>.
</p>
</dd>
<dt><span class="term">-s <em class="replaceable"><code>name</code></em></span></dt>
<dd>
<p>
(<span class="command"><strong>ddns-confgen</strong></span> only.)
Generate configuration example to allow dynamic updates
of a single hostname. The example <span class="command"><strong>named.conf</strong></span>
text shows how to set an update policy for the specified
<em class="replaceable"><code>name</code></em>
using the "name" nametype. The default key name is
ddns-key.<em class="replaceable"><code>name</code></em>.
Note that the "self" nametype cannot be used, since
the name to be updated may differ from the key name.
This option cannot be used with the <code class="option">-z</code> option.
</p>
</dd>
<dt><span class="term">-z <em class="replaceable"><code>zone</code></em></span></dt>
<dd>
<p>
(<span class="command"><strong>ddns-confgen</strong></span> only.)
Generate configuration example to allow dynamic updates
of a zone: The example <span class="command"><strong>named.conf</strong></span> text
shows how to set an update policy for the specified
<em class="replaceable"><code>zone</code></em>
using the "zonesub" nametype, allowing updates to
all subdomain names within that
<em class="replaceable"><code>zone</code></em>.
This option cannot be used with the <code class="option">-s</code> option.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">nsupdate</span>(1)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named.conf</span>(5)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>.
</p>
</div>
</div></body>
</html>

View File

@@ -0,0 +1,103 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_ddns-confgen:
ddns-confgen - ddns key generation tool
---------------------------------------
Synopsis
~~~~~~~~
:program:`tsig-keygen` [**-a** algorithm] [**-h**] [**-r** randomfile] [**-s** name]
:program:`ddns-confgen` [**-a** algorithm] [**-h**] [**-k** keyname] [**-q**] [**-r** randomfile] [**-s** name] [**-z** zone]
Description
~~~~~~~~~~~
``tsig-keygen`` and ``ddns-confgen`` are invocation methods for a
utility that generates keys for use in TSIG signing. The resulting keys
can be used, for example, to secure dynamic DNS updates to a zone or for
the ``rndc`` command channel.
When run as ``tsig-keygen``, a domain name can be specified on the
command line which will be used as the name of the generated key. If no
name is specified, the default is ``tsig-key``.
When run as ``ddns-confgen``, the generated key is accompanied by
configuration text and instructions that can be used with ``nsupdate``
and ``named`` when setting up dynamic DNS, including an example
``update-policy`` statement. (This usage similar to the ``rndc-confgen``
command for setting up command channel security.)
Note that ``named`` itself can configure a local DDNS key for use with
``nsupdate -l``: it does this when a zone is configured with
``update-policy local;``. ``ddns-confgen`` is only needed when a more
elaborate configuration is required: for instance, if ``nsupdate`` is to
be used from a remote system.
Options
~~~~~~~
**-a** algorithm
Specifies the algorithm to use for the TSIG key. Available choices
are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384 and
hmac-sha512. The default is hmac-sha256. Options are
case-insensitive, and the "hmac-" prefix may be omitted.
**-h**
Prints a short summary of options and arguments.
**-k** keyname
Specifies the key name of the DDNS authentication key. The default is
``ddns-key`` when neither the ``-s`` nor ``-z`` option is specified;
otherwise, the default is ``ddns-key`` as a separate label followed
by the argument of the option, e.g., ``ddns-key.example.com.`` The
key name must have the format of a valid domain name, consisting of
letters, digits, hyphens and periods.
**-q**
(``ddns-confgen`` only.) Quiet mode: Print only the key, with no
explanatory text or usage examples; This is essentially identical to
``tsig-keygen``.
**-s** name
(``ddns-confgen`` only.) Generate configuration example to allow
dynamic updates of a single hostname. The example ``named.conf`` text
shows how to set an update policy for the specified name using the
"name" nametype. The default key name is ddns-key.name. Note that the
"self" nametype cannot be used, since the name to be updated may
differ from the key name. This option cannot be used with the ``-z``
option.
**-z** zone
(``ddns-confgen`` only.) Generate configuration example to allow
dynamic updates of a zone: The example ``named.conf`` text shows how
to set an update policy for the specified zone using the "zonesub"
nametype, allowing updates to all subdomain names within that zone.
This option cannot be used with the ``-s`` option.
See Also
~~~~~~~~
:manpage:`nsupdate(1)`, :manpage:`named.conf(5)`, :manpage:`named(8)`, BIND 9 Administrator Reference Manual.

View File

@@ -0,0 +1 @@
../../../.clang-format.headers

View File

@@ -9,18 +9,19 @@
* information regarding copyright ownership.
*/
/*! \file */
#ifndef RNDC_OS_H
#define RNDC_OS_H 1
#include <isc/lang.h>
#include <stdio.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
int set_user(FILE *fd, const char *user);
int
set_user(FILE *fd, const char *user);
/*%<
* Set the owner of the file referenced by 'fd' to 'user'.
* Returns:
@@ -30,4 +31,4 @@ int set_user(FILE *fd, const char *user);
ISC_LANG_ENDDECLS
#endif
#endif /* ifndef RNDC_OS_H */

View File

@@ -9,11 +9,11 @@
* information regarding copyright ownership.
*/
/*! \file */
#include <stdlib.h>
#include "keygen.h"
#include <stdarg.h>
#include <stdlib.h>
#include <isc/base64.h>
#include <isc/buffer.h>
@@ -29,10 +29,10 @@
#include <dns/name.h>
#include <dst/dst.h>
#include <confgen/os.h>
#include "util.h"
#include "keygen.h"
/*%
* Convert algorithm type to string.
@@ -40,20 +40,20 @@
const char *
alg_totext(dns_secalg_t alg) {
switch (alg) {
case DST_ALG_HMACMD5:
return "hmac-md5";
case DST_ALG_HMACSHA1:
return "hmac-sha1";
case DST_ALG_HMACSHA224:
return "hmac-sha224";
case DST_ALG_HMACSHA256:
return "hmac-sha256";
case DST_ALG_HMACSHA384:
return "hmac-sha384";
case DST_ALG_HMACSHA512:
return "hmac-sha512";
default:
return "(unknown)";
case DST_ALG_HMACMD5:
return ("hmac-md5");
case DST_ALG_HMACSHA1:
return ("hmac-sha1");
case DST_ALG_HMACSHA224:
return ("hmac-sha224");
case DST_ALG_HMACSHA256:
return ("hmac-sha256");
case DST_ALG_HMACSHA384:
return ("hmac-sha384");
case DST_ALG_HMACSHA512:
return ("hmac-sha512");
default:
return ("(unknown)");
}
}
@@ -63,22 +63,29 @@ alg_totext(dns_secalg_t alg) {
dns_secalg_t
alg_fromtext(const char *name) {
const char *p = name;
if (strncasecmp(p, "hmac-", 5) == 0)
if (strncasecmp(p, "hmac-", 5) == 0) {
p = &name[5];
}
if (strcasecmp(p, "md5") == 0)
return DST_ALG_HMACMD5;
if (strcasecmp(p, "sha1") == 0)
return DST_ALG_HMACSHA1;
if (strcasecmp(p, "sha224") == 0)
return DST_ALG_HMACSHA224;
if (strcasecmp(p, "sha256") == 0)
return DST_ALG_HMACSHA256;
if (strcasecmp(p, "sha384") == 0)
return DST_ALG_HMACSHA384;
if (strcasecmp(p, "sha512") == 0)
return DST_ALG_HMACSHA512;
return DST_ALG_UNKNOWN;
if (strcasecmp(p, "md5") == 0) {
return (DST_ALG_HMACMD5);
}
if (strcasecmp(p, "sha1") == 0) {
return (DST_ALG_HMACSHA1);
}
if (strcasecmp(p, "sha224") == 0) {
return (DST_ALG_HMACSHA224);
}
if (strcasecmp(p, "sha256") == 0) {
return (DST_ALG_HMACSHA256);
}
if (strcasecmp(p, "sha384") == 0) {
return (DST_ALG_HMACSHA384);
}
if (strcasecmp(p, "sha512") == 0) {
return (DST_ALG_HMACSHA512);
}
return (DST_ALG_UNKNOWN);
}
/*%
@@ -87,20 +94,20 @@ alg_fromtext(const char *name) {
int
alg_bits(dns_secalg_t alg) {
switch (alg) {
case DST_ALG_HMACMD5:
return 128;
case DST_ALG_HMACSHA1:
return 160;
case DST_ALG_HMACSHA224:
return 224;
case DST_ALG_HMACSHA256:
return 256;
case DST_ALG_HMACSHA384:
return 384;
case DST_ALG_HMACSHA512:
return 512;
default:
return 0;
case DST_ALG_HMACMD5:
return (128);
case DST_ALG_HMACSHA1:
return (160);
case DST_ALG_HMACSHA224:
return (224);
case DST_ALG_HMACSHA256:
return (256);
case DST_ALG_HMACSHA384:
return (384);
case DST_ALG_HMACSHA512:
return (512);
default:
return (0);
}
}
@@ -117,30 +124,31 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
dst_key_t *key = NULL;
switch (alg) {
case DST_ALG_HMACMD5:
case DST_ALG_HMACSHA1:
case DST_ALG_HMACSHA224:
case DST_ALG_HMACSHA256:
if (keysize < 1 || keysize > 512)
case DST_ALG_HMACMD5:
case DST_ALG_HMACSHA1:
case DST_ALG_HMACSHA224:
case DST_ALG_HMACSHA256:
if (keysize < 1 || keysize > 512) {
fatal("keysize %d out of range (must be 1-512)\n",
keysize);
}
break;
case DST_ALG_HMACSHA384:
case DST_ALG_HMACSHA512:
if (keysize < 1 || keysize > 1024)
case DST_ALG_HMACSHA384:
case DST_ALG_HMACSHA512:
if (keysize < 1 || keysize > 1024) {
fatal("keysize %d out of range (must be 1-1024)\n",
keysize);
}
break;
default:
default:
fatal("unsupported algorithm %d\n", alg);
}
DO("initialize dst library", dst_lib_init(mctx, NULL));
DO("generate key", dst_key_generate(dns_rootname, alg,
keysize, 0, 0, DNS_KEYPROTO_ANY,
dns_rdataclass_in, mctx, &key,
NULL));
DO("generate key",
dst_key_generate(dns_rootname, alg, keysize, 0, 0, DNS_KEYPROTO_ANY,
dns_rdataclass_in, mctx, &key, NULL));
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
@@ -148,11 +156,12 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
isc_buffer_usedregion(&key_rawbuffer, &key_rawregion);
DO("bsse64 encode secret", isc_base64_totext(&key_rawregion, -1, "",
key_txtbuffer));
DO("bsse64 encode secret",
isc_base64_totext(&key_rawregion, -1, "", key_txtbuffer));
if (key != NULL)
if (key != NULL) {
dst_key_free(&key);
}
dst_lib_destroy();
}
@@ -163,9 +172,8 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
* the name 'keyname' and the secret in the buffer 'secret'.
*/
void
write_key_file(const char *keyfile, const char *user,
const char *keyname, isc_buffer_t *secret,
dns_secalg_t alg) {
write_key_file(const char *keyfile, const char *user, const char *keyname,
isc_buffer_t *secret, dns_secalg_t alg) {
isc_result_t result;
const char *algname = alg_totext(alg);
FILE *fd = NULL;
@@ -173,19 +181,22 @@ write_key_file(const char *keyfile, const char *user,
DO("create keyfile", isc_file_safecreate(keyfile, &fd));
if (user != NULL) {
if (set_user(fd, user) == -1)
if (set_user(fd, user) == -1) {
fatal("unable to set file owner\n");
}
}
fprintf(fd, "key \"%s\" {\n\talgorithm %s;\n"
fprintf(fd,
"key \"%s\" {\n\talgorithm %s;\n"
"\tsecret \"%.*s\";\n};\n",
keyname, algname,
(int)isc_buffer_usedlength(secret),
keyname, algname, (int)isc_buffer_usedlength(secret),
(char *)isc_buffer_base(secret));
fflush(fd);
if (ferror(fd))
if (ferror(fd)) {
fatal("write to %s failed\n", keyfile);
if (fclose(fd))
}
if (fclose(fd)) {
fatal("fclose(%s) failed\n", keyfile);
}
fprintf(stderr, "wrote key file \"%s\"\n", keyfile);
}

View File

@@ -9,26 +9,33 @@
* information regarding copyright ownership.
*/
#ifndef RNDC_KEYGEN_H
#define RNDC_KEYGEN_H 1
/*! \file */
#include <isc/buffer.h>
#include <isc/lang.h>
#include <isc/mem.h>
#include <dns/secalg.h>
ISC_LANG_BEGINDECLS
void generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
isc_buffer_t *key_txtbuffer);
void
generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
isc_buffer_t *key_txtbuffer);
void write_key_file(const char *keyfile, const char *user,
const char *keyname, isc_buffer_t *secret,
dns_secalg_t alg);
void
write_key_file(const char *keyfile, const char *user, const char *keyname,
isc_buffer_t *secret, dns_secalg_t alg);
const char *alg_totext(dns_secalg_t alg);
dns_secalg_t alg_fromtext(const char *name);
int alg_bits(dns_secalg_t alg);
const char *
alg_totext(dns_secalg_t alg);
dns_secalg_t
alg_fromtext(const char *name);
int
alg_bits(dns_secalg_t alg);
ISC_LANG_ENDDECLS

View File

@@ -1,210 +0,0 @@
.\" Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: rndc-confgen
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2013-03-14
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "RNDC\-CONFGEN" "8" "2013\-03\-14" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
rndc-confgen \- rndc key generation tool
.SH "SYNOPSIS"
.HP \w'\fBrndc\-confgen\fR\ 'u
\fBrndc\-confgen\fR [\fB\-a\fR] [\fB\-A\ \fR\fB\fIalgorithm\fR\fR] [\fB\-b\ \fR\fB\fIkeysize\fR\fR] [\fB\-c\ \fR\fB\fIkeyfile\fR\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkeyname\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-s\ \fR\fB\fIaddress\fR\fR] [\fB\-t\ \fR\fB\fIchrootdir\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR]
.SH "DESCRIPTION"
.PP
\fBrndc\-confgen\fR
generates configuration files for
\fBrndc\fR\&. It can be used as a convenient alternative to writing the
rndc\&.conf
file and the corresponding
\fBcontrols\fR
and
\fBkey\fR
statements in
named\&.conf
by hand\&. Alternatively, it can be run with the
\fB\-a\fR
option to set up a
rndc\&.key
file and avoid the need for a
rndc\&.conf
file and a
\fBcontrols\fR
statement altogether\&.
.SH "OPTIONS"
.PP
\-a
.RS 4
Do automatic
\fBrndc\fR
configuration\&. This creates a file
rndc\&.key
in
/etc
(or whatever
\fIsysconfdir\fR
was specified as when
BIND
was built) that is read by both
\fBrndc\fR
and
\fBnamed\fR
on startup\&. The
rndc\&.key
file defines a default command channel and authentication key allowing
\fBrndc\fR
to communicate with
\fBnamed\fR
on the local host with no further configuration\&.
.sp
Running
\fBrndc\-confgen \-a\fR
allows BIND 9 and
\fBrndc\fR
to be used as drop\-in replacements for BIND 8 and
\fBndc\fR, with no changes to the existing BIND 8
named\&.conf
file\&.
.sp
If a more elaborate configuration than that generated by
\fBrndc\-confgen \-a\fR
is required, for example if rndc is to be used remotely, you should run
\fBrndc\-confgen\fR
without the
\fB\-a\fR
option and set up a
rndc\&.conf
and
named\&.conf
as directed\&.
.RE
.PP
\-A \fIalgorithm\fR
.RS 4
Specifies the algorithm to use for the TSIG key\&. Available choices are: hmac\-md5, hmac\-sha1, hmac\-sha224, hmac\-sha256, hmac\-sha384 and hmac\-sha512\&. The default is hmac\-sha256\&.
.RE
.PP
\-b \fIkeysize\fR
.RS 4
Specifies the size of the authentication key in bits\&. Must be between 1 and 512 bits; the default is the hash size\&.
.RE
.PP
\-c \fIkeyfile\fR
.RS 4
Used with the
\fB\-a\fR
option to specify an alternate location for
rndc\&.key\&.
.RE
.PP
\-h
.RS 4
Prints a short summary of the options and arguments to
\fBrndc\-confgen\fR\&.
.RE
.PP
\-k \fIkeyname\fR
.RS 4
Specifies the key name of the rndc authentication key\&. This must be a valid domain name\&. The default is
\fBrndc\-key\fR\&.
.RE
.PP
\-p \fIport\fR
.RS 4
Specifies the command channel port where
\fBnamed\fR
listens for connections from
\fBrndc\fR\&. The default is 953\&.
.RE
.PP
\-s \fIaddress\fR
.RS 4
Specifies the IP address where
\fBnamed\fR
listens for command channel connections from
\fBrndc\fR\&. The default is the loopback address 127\&.0\&.0\&.1\&.
.RE
.PP
\-t \fIchrootdir\fR
.RS 4
Used with the
\fB\-a\fR
option to specify a directory where
\fBnamed\fR
will run chrooted\&. An additional copy of the
rndc\&.key
will be written relative to this directory so that it will be found by the chrooted
\fBnamed\fR\&.
.RE
.PP
\-u \fIuser\fR
.RS 4
Used with the
\fB\-a\fR
option to set the owner of the
rndc\&.key
file generated\&. If
\fB\-t\fR
is also specified only the file in the chroot area has its owner changed\&.
.RE
.SH "EXAMPLES"
.PP
To allow
\fBrndc\fR
to be used with no manual configuration, run
.PP
\fBrndc\-confgen \-a\fR
.PP
To print a sample
rndc\&.conf
file and corresponding
\fBcontrols\fR
and
\fBkey\fR
statements to be manually inserted into
named\&.conf, run
.PP
\fBrndc\-confgen\fR
.SH "SEE ALSO"
.PP
\fBrndc\fR(8),
\fBrndc.conf\fR(5),
\fBnamed\fR(8),
BIND 9 Administrator Reference Manual\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2001, 2003-2005, 2007, 2009, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -43,14 +43,15 @@
#include <dns/name.h>
#include <dst/dst.h>
#include <confgen/os.h>
#include "util.h"
#include "keygen.h"
#include "util.h"
#define DEFAULT_KEYNAME "rndc-key"
#define DEFAULT_SERVER "127.0.0.1"
#define DEFAULT_PORT 953
#define DEFAULT_KEYNAME "rndc-key"
#define DEFAULT_SERVER "127.0.0.1"
#define DEFAULT_PORT 953
static char program[256];
const char *progname;
@@ -64,7 +65,6 @@ usage(int status) ISC_PLATFORM_NORETURN_POST;
static void
usage(int status) {
fprintf(stderr, "\
Usage:\n\
%s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] \
@@ -78,9 +78,9 @@ Usage:\n\
-s addr: the address to which rndc should connect\n\
-t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\
-u user: set the keyfile owner to \"user\" (requires -a)\n",
progname, keydef);
progname, keydef);
exit (status);
exit(status);
}
int
@@ -108,8 +108,9 @@ main(int argc, char **argv) {
keydef = keyfile = RNDC_KEYFILE;
result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
memmove(program, "rndc-confgen", 13);
}
progname = program;
keyname = DEFAULT_KEYNAME;
@@ -129,13 +130,15 @@ main(int argc, char **argv) {
case 'A':
algname = isc_commandline_argument;
alg = alg_fromtext(algname);
if (alg == DST_ALG_UNKNOWN)
if (alg == DST_ALG_UNKNOWN) {
fatal("Unsupported algorithm '%s'", algname);
}
break;
case 'b':
keysize = strtol(isc_commandline_argument, &p, 10);
if (*p != '\0' || keysize < 0)
if (*p != '\0' || keysize < 0) {
fatal("-b requires a non-negative number");
}
break;
case 'c':
keyfile = isc_commandline_argument;
@@ -143,7 +146,7 @@ main(int argc, char **argv) {
case 'h':
usage(0);
case 'k':
case 'y': /* Compatible with rndc -y. */
case 'y': /* Compatible with rndc -y. */
keyname = isc_commandline_argument;
break;
case 'M':
@@ -155,9 +158,10 @@ main(int argc, char **argv) {
break;
case 'p':
port = strtol(isc_commandline_argument, &p, 10);
if (*p != '\0' || port < 0 || port > 65535)
if (*p != '\0' || port < 0 || port > 65535) {
fatal("port '%s' out of range",
isc_commandline_argument);
}
break;
case 'r':
fatal("The -r option has been deprecated.");
@@ -166,7 +170,9 @@ main(int argc, char **argv) {
serveraddr = isc_commandline_argument;
if (inet_pton(AF_INET, serveraddr, &addr4_dummy) != 1 &&
inet_pton(AF_INET6, serveraddr, &addr6_dummy) != 1)
{
fatal("-s should be an IPv4 or IPv6 address");
}
break;
case 't':
chrootdir = isc_commandline_argument;
@@ -182,12 +188,13 @@ main(int argc, char **argv) {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(1);
} else
} else {
usage(0);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
}
}
@@ -196,17 +203,19 @@ main(int argc, char **argv) {
argv += isc_commandline_index;
POST(argv);
if (argc > 0)
if (argc > 0) {
usage(1);
if (alg == DST_ALG_HMACMD5) {
fprintf(stderr,
"warning: use of hmac-md5 for RNDC keys "
"is deprecated; hmac-sha256 is now recommended.\n");
}
if (keysize < 0)
if (alg == DST_ALG_HMACMD5) {
fprintf(stderr, "warning: use of hmac-md5 for RNDC keys "
"is deprecated; hmac-sha256 is now "
"recommended.\n");
}
if (keysize < 0) {
keysize = alg_bits(alg);
}
algname = alg_totext(alg);
isc_mem_create(&mctx);
@@ -256,16 +265,16 @@ options {\n\
# End of named.conf\n",
keyname, algname,
(int)isc_buffer_usedlength(&key_txtbuffer),
(char *)isc_buffer_base(&key_txtbuffer),
keyname, serveraddr, port,
keyname, algname,
(char *)isc_buffer_base(&key_txtbuffer), keyname,
serveraddr, port, keyname, algname,
(int)isc_buffer_usedlength(&key_txtbuffer),
(char *)isc_buffer_base(&key_txtbuffer),
serveraddr, port, serveraddr, keyname);
(char *)isc_buffer_base(&key_txtbuffer), serveraddr,
port, serveraddr, keyname);
}
if (show_final_mem)
if (show_final_mem) {
isc_mem_stats(mctx, stderr);
}
isc_mem_destroy(&mctx);

View File

@@ -1,271 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.rndc-confgen">
<info>
<date>2013-03-14</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle><application>rndc-confgen</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>rndc-confgen</application></refname>
<refpurpose>rndc key generation tool</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2001</year>
<year>2003</year>
<year>2004</year>
<year>2005</year>
<year>2007</year>
<year>2009</year>
<year>2013</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2017</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>rndc-confgen</command>
<arg choice="opt" rep="norepeat"><option>-a</option></arg>
<arg choice="opt" rep="norepeat"><option>-A <replaceable class="parameter">algorithm</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">keysize</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">keyfile</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-k <replaceable class="parameter">keyname</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">port</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">address</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">chrootdir</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-u <replaceable class="parameter">user</replaceable></option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>rndc-confgen</command>
generates configuration files
for <command>rndc</command>. It can be used as a
convenient alternative to writing the
<filename>rndc.conf</filename> file
and the corresponding <command>controls</command>
and <command>key</command>
statements in <filename>named.conf</filename> by hand.
Alternatively, it can be run with the <command>-a</command>
option to set up a <filename>rndc.key</filename> file and
avoid the need for a <filename>rndc.conf</filename> file
and a <command>controls</command> statement altogether.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-a</term>
<listitem>
<para>
Do automatic <command>rndc</command> configuration.
This creates a file <filename>rndc.key</filename>
in <filename>/etc</filename> (or whatever
<varname>sysconfdir</varname>
was specified as when <acronym>BIND</acronym> was
built)
that is read by both <command>rndc</command>
and <command>named</command> on startup. The
<filename>rndc.key</filename> file defines a default
command channel and authentication key allowing
<command>rndc</command> to communicate with
<command>named</command> on the local host
with no further configuration.
</para>
<para>
Running <command>rndc-confgen -a</command> allows
BIND 9 and <command>rndc</command> to be used as
drop-in
replacements for BIND 8 and <command>ndc</command>,
with no changes to the existing BIND 8
<filename>named.conf</filename> file.
</para>
<para>
If a more elaborate configuration than that
generated by <command>rndc-confgen -a</command>
is required, for example if rndc is to be used remotely,
you should run <command>rndc-confgen</command> without
the
<command>-a</command> option and set up a
<filename>rndc.conf</filename> and
<filename>named.conf</filename>
as directed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-A <replaceable class="parameter">algorithm</replaceable></term>
<listitem>
<para>
Specifies the algorithm to use for the TSIG key. Available
choices are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,
hmac-sha384 and hmac-sha512. The default is hmac-sha256.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-b <replaceable class="parameter">keysize</replaceable></term>
<listitem>
<para>
Specifies the size of the authentication key in bits.
Must be between 1 and 512 bits; the default is the
hash size.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c <replaceable class="parameter">keyfile</replaceable></term>
<listitem>
<para>
Used with the <command>-a</command> option to specify
an alternate location for <filename>rndc.key</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Prints a short summary of the options and arguments to
<command>rndc-confgen</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-k <replaceable class="parameter">keyname</replaceable></term>
<listitem>
<para>
Specifies the key name of the rndc authentication key.
This must be a valid domain name.
The default is <constant>rndc-key</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the command channel port where <command>named</command>
listens for connections from <command>rndc</command>.
The default is 953.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s <replaceable class="parameter">address</replaceable></term>
<listitem>
<para>
Specifies the IP address where <command>named</command>
listens for command channel connections from
<command>rndc</command>. The default is the loopback
address 127.0.0.1.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">chrootdir</replaceable></term>
<listitem>
<para>
Used with the <command>-a</command> option to specify
a directory where <command>named</command> will run
chrooted. An additional copy of the <filename>rndc.key</filename>
will be written relative to this directory so that
it will be found by the chrooted <command>named</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u <replaceable class="parameter">user</replaceable></term>
<listitem>
<para>
Used with the <command>-a</command> option to set the
owner
of the <filename>rndc.key</filename> file generated.
If
<command>-t</command> is also specified only the file
in
the chroot area has its owner changed.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>EXAMPLES</title></info>
<para>
To allow <command>rndc</command> to be used with
no manual configuration, run
</para>
<para><userinput>rndc-confgen -a</userinput>
</para>
<para>
To print a sample <filename>rndc.conf</filename> file and
corresponding <command>controls</command> and <command>key</command>
statements to be manually inserted into <filename>named.conf</filename>,
run
</para>
<para><userinput>rndc-confgen</userinput>
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>rndc</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>rndc.conf</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>.
</para>
</refsection>
</refentry>

View File

@@ -1,226 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>rndc-confgen</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.rndc-confgen"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
<span class="application">rndc-confgen</span>
&#8212; rndc key generation tool
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">rndc-confgen</code>
[<code class="option">-a</code>]
[<code class="option">-A <em class="replaceable"><code>algorithm</code></em></code>]
[<code class="option">-b <em class="replaceable"><code>keysize</code></em></code>]
[<code class="option">-c <em class="replaceable"><code>keyfile</code></em></code>]
[<code class="option">-h</code>]
[<code class="option">-k <em class="replaceable"><code>keyname</code></em></code>]
[<code class="option">-p <em class="replaceable"><code>port</code></em></code>]
[<code class="option">-s <em class="replaceable"><code>address</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>chrootdir</code></em></code>]
[<code class="option">-u <em class="replaceable"><code>user</code></em></code>]
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p><span class="command"><strong>rndc-confgen</strong></span>
generates configuration files
for <span class="command"><strong>rndc</strong></span>. It can be used as a
convenient alternative to writing the
<code class="filename">rndc.conf</code> file
and the corresponding <span class="command"><strong>controls</strong></span>
and <span class="command"><strong>key</strong></span>
statements in <code class="filename">named.conf</code> by hand.
Alternatively, it can be run with the <span class="command"><strong>-a</strong></span>
option to set up a <code class="filename">rndc.key</code> file and
avoid the need for a <code class="filename">rndc.conf</code> file
and a <span class="command"><strong>controls</strong></span> statement altogether.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-a</span></dt>
<dd>
<p>
Do automatic <span class="command"><strong>rndc</strong></span> configuration.
This creates a file <code class="filename">rndc.key</code>
in <code class="filename">/etc</code> (or whatever
<code class="varname">sysconfdir</code>
was specified as when <acronym class="acronym">BIND</acronym> was
built)
that is read by both <span class="command"><strong>rndc</strong></span>
and <span class="command"><strong>named</strong></span> on startup. The
<code class="filename">rndc.key</code> file defines a default
command channel and authentication key allowing
<span class="command"><strong>rndc</strong></span> to communicate with
<span class="command"><strong>named</strong></span> on the local host
with no further configuration.
</p>
<p>
Running <span class="command"><strong>rndc-confgen -a</strong></span> allows
BIND 9 and <span class="command"><strong>rndc</strong></span> to be used as
drop-in
replacements for BIND 8 and <span class="command"><strong>ndc</strong></span>,
with no changes to the existing BIND 8
<code class="filename">named.conf</code> file.
</p>
<p>
If a more elaborate configuration than that
generated by <span class="command"><strong>rndc-confgen -a</strong></span>
is required, for example if rndc is to be used remotely,
you should run <span class="command"><strong>rndc-confgen</strong></span> without
the
<span class="command"><strong>-a</strong></span> option and set up a
<code class="filename">rndc.conf</code> and
<code class="filename">named.conf</code>
as directed.
</p>
</dd>
<dt><span class="term">-A <em class="replaceable"><code>algorithm</code></em></span></dt>
<dd>
<p>
Specifies the algorithm to use for the TSIG key. Available
choices are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,
hmac-sha384 and hmac-sha512. The default is hmac-sha256.
</p>
</dd>
<dt><span class="term">-b <em class="replaceable"><code>keysize</code></em></span></dt>
<dd>
<p>
Specifies the size of the authentication key in bits.
Must be between 1 and 512 bits; the default is the
hash size.
</p>
</dd>
<dt><span class="term">-c <em class="replaceable"><code>keyfile</code></em></span></dt>
<dd>
<p>
Used with the <span class="command"><strong>-a</strong></span> option to specify
an alternate location for <code class="filename">rndc.key</code>.
</p>
</dd>
<dt><span class="term">-h</span></dt>
<dd>
<p>
Prints a short summary of the options and arguments to
<span class="command"><strong>rndc-confgen</strong></span>.
</p>
</dd>
<dt><span class="term">-k <em class="replaceable"><code>keyname</code></em></span></dt>
<dd>
<p>
Specifies the key name of the rndc authentication key.
This must be a valid domain name.
The default is <code class="constant">rndc-key</code>.
</p>
</dd>
<dt><span class="term">-p <em class="replaceable"><code>port</code></em></span></dt>
<dd>
<p>
Specifies the command channel port where <span class="command"><strong>named</strong></span>
listens for connections from <span class="command"><strong>rndc</strong></span>.
The default is 953.
</p>
</dd>
<dt><span class="term">-s <em class="replaceable"><code>address</code></em></span></dt>
<dd>
<p>
Specifies the IP address where <span class="command"><strong>named</strong></span>
listens for command channel connections from
<span class="command"><strong>rndc</strong></span>. The default is the loopback
address 127.0.0.1.
</p>
</dd>
<dt><span class="term">-t <em class="replaceable"><code>chrootdir</code></em></span></dt>
<dd>
<p>
Used with the <span class="command"><strong>-a</strong></span> option to specify
a directory where <span class="command"><strong>named</strong></span> will run
chrooted. An additional copy of the <code class="filename">rndc.key</code>
will be written relative to this directory so that
it will be found by the chrooted <span class="command"><strong>named</strong></span>.
</p>
</dd>
<dt><span class="term">-u <em class="replaceable"><code>user</code></em></span></dt>
<dd>
<p>
Used with the <span class="command"><strong>-a</strong></span> option to set the
owner
of the <code class="filename">rndc.key</code> file generated.
If
<span class="command"><strong>-t</strong></span> is also specified only the file
in
the chroot area has its owner changed.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>EXAMPLES</h2>
<p>
To allow <span class="command"><strong>rndc</strong></span> to be used with
no manual configuration, run
</p>
<p><strong class="userinput"><code>rndc-confgen -a</code></strong>
</p>
<p>
To print a sample <code class="filename">rndc.conf</code> file and
corresponding <span class="command"><strong>controls</strong></span> and <span class="command"><strong>key</strong></span>
statements to be manually inserted into <code class="filename">named.conf</code>,
run
</p>
<p><strong class="userinput"><code>rndc-confgen</code></strong>
</p>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">rndc</span>(8)
</span>,
<span class="citerefentry">
<span class="refentrytitle">rndc.conf</span>(5)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>.
</p>
</div>
</div></body>
</html>

View File

@@ -0,0 +1,120 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_rndc-confgen:
rndc-confgen - rndc key generation tool
---------------------------------------
Synopsis
~~~~~~~~
:program:`rndc-confgen` [**-a**] [**-A** algorithm] [**-b** keysize] [**-c** keyfile] [**-h**] [**-k** keyname] [**-p** port] [**-s** address] [**-t** chrootdir] [**-u** user]
Description
~~~~~~~~~~~
``rndc-confgen`` generates configuration files for ``rndc``. It can be
used as a convenient alternative to writing the ``rndc.conf`` file and
the corresponding ``controls`` and ``key`` statements in ``named.conf``
by hand. Alternatively, it can be run with the ``-a`` option to set up a
``rndc.key`` file and avoid the need for a ``rndc.conf`` file and a
``controls`` statement altogether.
Arguments
~~~~~~~~~
**-a**
Do automatic ``rndc`` configuration. This creates a file ``rndc.key``
in ``/etc`` (or whatever ``sysconfdir`` was specified as when BIND
was built) that is read by both ``rndc`` and ``named`` on startup.
The ``rndc.key`` file defines a default command channel and
authentication key allowing ``rndc`` to communicate with ``named`` on
the local host with no further configuration.
Running ``rndc-confgen -a`` allows BIND 9 and ``rndc`` to be used as
drop-in replacements for BIND 8 and ``ndc``, with no changes to the
existing BIND 8 ``named.conf`` file.
If a more elaborate configuration than that generated by
``rndc-confgen -a`` is required, for example if rndc is to be used
remotely, you should run ``rndc-confgen`` without the ``-a`` option
and set up a ``rndc.conf`` and ``named.conf`` as directed.
**-A** algorithm
Specifies the algorithm to use for the TSIG key. Available choices
are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384 and
hmac-sha512. The default is hmac-sha256.
**-b** keysize
Specifies the size of the authentication key in bits. Must be between
1 and 512 bits; the default is the hash size.
**-c** keyfile
Used with the ``-a`` option to specify an alternate location for
``rndc.key``.
**-h**
Prints a short summary of the options and arguments to
``rndc-confgen``.
**-k** keyname
Specifies the key name of the rndc authentication key. This must be a
valid domain name. The default is ``rndc-key``.
**-p** port
Specifies the command channel port where ``named`` listens for
connections from ``rndc``. The default is 953.
**-s** address
Specifies the IP address where ``named`` listens for command channel
connections from ``rndc``. The default is the loopback address
127.0.0.1.
**-t** chrootdir
Used with the ``-a`` option to specify a directory where ``named``
will run chrooted. An additional copy of the ``rndc.key`` will be
written relative to this directory so that it will be found by the
chrooted ``named``.
**-u** user
Used with the ``-a`` option to set the owner of the ``rndc.key`` file
generated. If ``-t`` is also specified only the file in the chroot
area has its owner changed.
Examples
~~~~~~~~
To allow ``rndc`` to be used with no manual configuration, run
``rndc-confgen -a``
To print a sample ``rndc.conf`` file and corresponding ``controls`` and
``key`` statements to be manually inserted into ``named.conf``, run
``rndc-confgen``
See Also
~~~~~~~~
:manpage:`rndc(8)`, :manpage:`rndc.conf(5)`, :manpage:`named(8)`, BIND 9 Administrator Reference Manual.

View File

@@ -9,18 +9,17 @@
* information regarding copyright ownership.
*/
/*! \file */
#include <confgen/os.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <confgen/os.h>
int
set_user(FILE *fd, const char *user) {

View File

@@ -9,18 +9,16 @@
* information regarding copyright ownership.
*/
/*! \file */
#include "util.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <isc/print.h>
#include "util.h"
extern bool verbose;
extern const char *progname;

View File

@@ -9,27 +9,25 @@
* information regarding copyright ownership.
*/
#ifndef RNDC_UTIL_H
#define RNDC_UTIL_H 1
/*! \file */
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/platform.h>
#include <isc/formatcheck.h>
#define NS_CONTROL_PORT 953
#define NS_CONTROL_PORT 953
#undef DO
#define DO(name, function) \
do { \
result = function; \
if (result != ISC_R_SUCCESS) \
#define DO(name, function) \
do { \
result = function; \
if (result != ISC_R_SUCCESS) \
fatal("%s: %s", name, isc_result_totext(result)); \
else \
notify("%s", name); \
else \
notify("%s", name); \
} while (0)
ISC_LANG_BEGINDECLS
@@ -39,7 +37,7 @@ notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_PLATFORM_NORETURN_PRE void
fatal(const char *format, ...)
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
ISC_LANG_ENDDECLS

View File

@@ -44,17 +44,20 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>.\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>.\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -74,7 +77,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -44,19 +44,22 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>ddns-confgen</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>ddns-confgen</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -85,7 +88,8 @@ copy /Y ddns-confgen.ilk tsig-keygen.ilk
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -9,15 +9,15 @@
* information regarding copyright ownership.
*/
#include <confgen/os.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <confgen/os.h>
int
set_user(FILE *fd, const char *user) {

View File

@@ -44,19 +44,22 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>rndc-confgen</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
<TargetName>rndc-confgen</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -79,7 +82,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -24,9 +24,9 @@ CDEFINES = -DVERSION=\"${VERSION}\" \
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
IRSLIBS = ../../lib/irs/libirs.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
@@ -47,12 +47,6 @@ OBJS = delv.@O@
SRCS = delv.c
MANPAGES = delv.1
HTMLPAGES = delv.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@
delv@EXEEXT@: delv.@O@ ${DEPLIBS}
@@ -62,21 +56,13 @@ delv@EXEEXT@: delv.@O@ ${DEPLIBS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir}
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1
install:: delv@EXEEXT@ installdirs
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \
delv@EXEEXT@ ${DESTDIR}${bindir}
${INSTALL_DATA} ${srcdir}/delv.1 ${DESTDIR}${mandir}/man1
uninstall::
rm -f ${DESTDIR}${mandir}/man1/delv.1
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${bindir}/delv@EXEEXT@
doc man:: ${MANOBJS}
docclean manclean maintainer-clean::
rm -f ${MANOBJS}
clean distclean maintainer-clean::
rm -f ${TARGETS}

View File

@@ -1,437 +0,0 @@
.\" Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: delv
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-04-23
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "DELV" "1" "2014\-04\-23" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
delv \- DNS lookup and validation utility
.SH "SYNOPSIS"
.HP \w'\fBdelv\fR\ 'u
\fBdelv\fR [@server] [[\fB\-4\fR] | [\fB\-6\fR]] [\fB\-a\ \fR\fB\fIanchor\-file\fR\fR] [\fB\-b\ \fR\fB\fIaddress\fR\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-d\ \fR\fB\fIlevel\fR\fR] [\fB\-i\fR] [\fB\-m\fR] [\fB\-p\ \fR\fB\fIport#\fR\fR] [\fB\-q\ \fR\fB\fIname\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-x\ \fR\fB\fIaddr\fR\fR] [name] [type] [class] [queryopt...]
.HP \w'\fBdelv\fR\ 'u
\fBdelv\fR [\fB\-h\fR]
.HP \w'\fBdelv\fR\ 'u
\fBdelv\fR [\fB\-v\fR]
.HP \w'\fBdelv\fR\ 'u
\fBdelv\fR [queryopt...] [query...]
.SH "DESCRIPTION"
.PP
\fBdelv\fR
is a tool for sending DNS queries and validating the results, using the same internal resolver and validator logic as
\fBnamed\fR\&.
.PP
\fBdelv\fR
will send to a specified name server all queries needed to fetch and validate the requested data; this includes the original requested query, subsequent queries to follow CNAME or DNAME chains, and queries for DNSKEY and DS records to establish a chain of trust for DNSSEC validation\&. It does not perform iterative resolution, but simulates the behavior of a name server configured for DNSSEC validating and forwarding\&.
.PP
By default, responses are validated using built\-in DNSSEC trust anchor for the root zone ("\&.")\&. Records returned by
\fBdelv\fR
are either fully validated or were not signed\&. If validation fails, an explanation of the failure is included in the output; the validation process can be traced in detail\&. Because
\fBdelv\fR
does not rely on an external server to carry out validation, it can be used to check the validity of DNS responses in environments where local name servers may not be trustworthy\&.
.PP
Unless it is told to query a specific name server,
\fBdelv\fR
will try each of the servers listed in
/etc/resolv\&.conf\&. If no usable server addresses are found,
\fBdelv\fR
will send queries to the localhost addresses (127\&.0\&.0\&.1 for IPv4, ::1 for IPv6)\&.
.PP
When no command line arguments or options are given,
\fBdelv\fR
will perform an NS query for "\&." (the root zone)\&.
.SH "SIMPLE USAGE"
.PP
A typical invocation of
\fBdelv\fR
looks like:
.sp
.if n \{\
.RS 4
.\}
.nf
delv @server name type
.fi
.if n \{\
.RE
.\}
.sp
where:
.PP
\fBserver\fR
.RS 4
is the name or IP address of the name server to query\&. This can be an IPv4 address in dotted\-decimal notation or an IPv6 address in colon\-delimited notation\&. When the supplied
\fIserver\fR
argument is a hostname,
\fBdelv\fR
resolves that name before querying that name server (note, however, that this initial lookup is
\fInot\fR
validated by DNSSEC)\&.
.sp
If no
\fIserver\fR
argument is provided,
\fBdelv\fR
consults
/etc/resolv\&.conf; if an address is found there, it queries the name server at that address\&. If either of the
\fB\-4\fR
or
\fB\-6\fR
options are in use, then only addresses for the corresponding transport will be tried\&. If no usable addresses are found,
\fBdelv\fR
will send queries to the localhost addresses (127\&.0\&.0\&.1 for IPv4, ::1 for IPv6)\&.
.RE
.PP
\fBname\fR
.RS 4
is the domain name to be looked up\&.
.RE
.PP
\fBtype\fR
.RS 4
indicates what type of query is required \(em ANY, A, MX, etc\&.
\fItype\fR
can be any valid query type\&. If no
\fItype\fR
argument is supplied,
\fBdelv\fR
will perform a lookup for an A record\&.
.RE
.SH "OPTIONS"
.PP
\-a \fIanchor\-file\fR
.RS 4
Specifies a file from which to read DNSSEC trust anchors\&. The default is
/etc/bind\&.keys, which is included with
BIND
9 and contains one or more trust anchors for the root zone ("\&.")\&.
.sp
Keys that do not match the root zone name are ignored\&. An alternate key name can be specified using the
\fB+root=NAME\fR
options\&.
.sp
Note: When reading the trust anchor file,
\fBdelv\fR
treats
\fBtrust\-anchors\fR\fBinitial\-key\fR
and
\fBstatic\-key\fR
entries identically\&. That is, even if a key is configured with
\fBinitial\-key\fR, indicating that it is meant to be used only as an initializing key for RFC 5011 key maintenance, it is still treated by
\fBdelv\fR
as if it had been configured as a
\fBstatic\-key\fR\&.
\fBdelv\fR
does not consult the managed keys database maintained by
\fBnamed\fR\&. This means that if either of the keys in
/etc/bind\&.keys
is revoked and rolled over, it will be necessary to update
/etc/bind\&.keys
to use DNSSEC validation in
\fBdelv\fR\&.
.RE
.PP
\-b \fIaddress\fR
.RS 4
Sets the source IP address of the query to
\fIaddress\fR\&. This must be a valid address on one of the host\*(Aqs network interfaces or "0\&.0\&.0\&.0" or "::"\&. An optional source port may be specified by appending "#<port>"
.RE
.PP
\-c \fIclass\fR
.RS 4
Sets the query class for the requested data\&. Currently, only class "IN" is supported in
\fBdelv\fR
and any other value is ignored\&.
.RE
.PP
\-d \fIlevel\fR
.RS 4
Set the systemwide debug level to
\fBlevel\fR\&. The allowed range is from 0 to 99\&. The default is 0 (no debugging)\&. Debugging traces from
\fBdelv\fR
become more verbose as the debug level increases\&. See the
\fB+mtrace\fR,
\fB+rtrace\fR, and
\fB+vtrace\fR
options below for additional debugging details\&.
.RE
.PP
\-h
.RS 4
Display the
\fBdelv\fR
help usage output and exit\&.
.RE
.PP
\-i
.RS 4
Insecure mode\&. This disables internal DNSSEC validation\&. (Note, however, this does not set the CD bit on upstream queries\&. If the server being queried is performing DNSSEC validation, then it will not return invalid data; this can cause
\fBdelv\fR
to time out\&. When it is necessary to examine invalid data to debug a DNSSEC problem, use
\fBdig +cd\fR\&.)
.RE
.PP
\-m
.RS 4
Enables memory usage debugging\&.
.RE
.PP
\-p \fIport#\fR
.RS 4
Specifies a destination port to use for queries instead of the standard DNS port number 53\&. This option would be used with a name server that has been configured to listen for queries on a non\-standard port number\&.
.RE
.PP
\-q \fIname\fR
.RS 4
Sets the query name to
\fIname\fR\&. While the query name can be specified without using the
\fB\-q\fR, it is sometimes necessary to disambiguate names from types or classes (for example, when looking up the name "ns", which could be misinterpreted as the type NS, or "ch", which could be misinterpreted as class CH)\&.
.RE
.PP
\-t \fItype\fR
.RS 4
Sets the query type to
\fItype\fR, which can be any valid query type supported in BIND 9 except for zone transfer types AXFR and IXFR\&. As with
\fB\-q\fR, this is useful to distinguish query name type or class when they are ambiguous\&. it is sometimes necessary to disambiguate names from types\&.
.sp
The default query type is "A", unless the
\fB\-x\fR
option is supplied to indicate a reverse lookup, in which case it is "PTR"\&.
.RE
.PP
\-v
.RS 4
Print the
\fBdelv\fR
version and exit\&.
.RE
.PP
\-x \fIaddr\fR
.RS 4
Performs a reverse lookup, mapping an addresses to a name\&.
\fIaddr\fR
is an IPv4 address in dotted\-decimal notation, or a colon\-delimited IPv6 address\&. When
\fB\-x\fR
is used, there is no need to provide the
\fIname\fR
or
\fItype\fR
arguments\&.
\fBdelv\fR
automatically performs a lookup for a name like
11\&.12\&.13\&.10\&.in\-addr\&.arpa
and sets the query type to PTR\&. IPv6 addresses are looked up using nibble format under the IP6\&.ARPA domain\&.
.RE
.PP
\-4
.RS 4
Forces
\fBdelv\fR
to only use IPv4\&.
.RE
.PP
\-6
.RS 4
Forces
\fBdelv\fR
to only use IPv6\&.
.RE
.SH "QUERY OPTIONS"
.PP
\fBdelv\fR
provides a number of query options which affect the way results are displayed, and in some cases the way lookups are performed\&.
.PP
Each query option is identified by a keyword preceded by a plus sign (+)\&. Some keywords set or reset an option\&. These may be preceded by the string
no
to negate the meaning of that keyword\&. Other keywords assign values to options like the timeout interval\&. They have the form
\fB+keyword=value\fR\&. The query options are:
.PP
\fB+[no]cdflag\fR
.RS 4
Controls whether to set the CD (checking disabled) bit in queries sent by
\fBdelv\fR\&. This may be useful when troubleshooting DNSSEC problems from behind a validating resolver\&. A validating resolver will block invalid responses, making it difficult to retrieve them for analysis\&. Setting the CD flag on queries will cause the resolver to return invalid responses, which
\fBdelv\fR
can then validate internally and report the errors in detail\&.
.RE
.PP
\fB+[no]class\fR
.RS 4
Controls whether to display the CLASS when printing a record\&. The default is to display the CLASS\&.
.RE
.PP
\fB+[no]ttl\fR
.RS 4
Controls whether to display the TTL when printing a record\&. The default is to display the TTL\&.
.RE
.PP
\fB+[no]rtrace\fR
.RS 4
Toggle resolver fetch logging\&. This reports the name and type of each query sent by
\fBdelv\fR
in the process of carrying out the resolution and validation process: this includes including the original query and all subsequent queries to follow CNAMEs and to establish a chain of trust for DNSSEC validation\&.
.sp
This is equivalent to setting the debug level to 1 in the "resolver" logging category\&. Setting the systemwide debug level to 1 using the
\fB\-d\fR
option will product the same output (but will affect other logging categories as well)\&.
.RE
.PP
\fB+[no]mtrace\fR
.RS 4
Toggle message logging\&. This produces a detailed dump of the responses received by
\fBdelv\fR
in the process of carrying out the resolution and validation process\&.
.sp
This is equivalent to setting the debug level to 10 for the "packets" module of the "resolver" logging category\&. Setting the systemwide debug level to 10 using the
\fB\-d\fR
option will produce the same output (but will affect other logging categories as well)\&.
.RE
.PP
\fB+[no]vtrace\fR
.RS 4
Toggle validation logging\&. This shows the internal process of the validator as it determines whether an answer is validly signed, unsigned, or invalid\&.
.sp
This is equivalent to setting the debug level to 3 for the "validator" module of the "dnssec" logging category\&. Setting the systemwide debug level to 3 using the
\fB\-d\fR
option will produce the same output (but will affect other logging categories as well)\&.
.RE
.PP
\fB+[no]short\fR
.RS 4
Provide a terse answer\&. The default is to print the answer in a verbose form\&.
.RE
.PP
\fB+[no]comments\fR
.RS 4
Toggle the display of comment lines in the output\&. The default is to print comments\&.
.RE
.PP
\fB+[no]rrcomments\fR
.RS 4
Toggle the display of per\-record comments in the output (for example, human\-readable key information about DNSKEY records)\&. The default is to print per\-record comments\&.
.RE
.PP
\fB+[no]crypto\fR
.RS 4
Toggle the display of cryptographic fields in DNSSEC records\&. The contents of these field are unnecessary to debug most DNSSEC validation failures and removing them makes it easier to see the common failures\&. The default is to display the fields\&. When omitted they are replaced by the string "[omitted]" or in the DNSKEY case the key id is displayed as the replacement, e\&.g\&. "[ key id = value ]"\&.
.RE
.PP
\fB+[no]trust\fR
.RS 4
Controls whether to display the trust level when printing a record\&. The default is to display the trust level\&.
.RE
.PP
\fB+[no]split[=W]\fR
.RS 4
Split long hex\- or base64\-formatted fields in resource records into chunks of
\fIW\fR
characters (where
\fIW\fR
is rounded up to the nearest multiple of 4)\&.
\fI+nosplit\fR
or
\fI+split=0\fR
causes fields not to be split at all\&. The default is 56 characters, or 44 characters when multiline mode is active\&.
.RE
.PP
\fB+[no]all\fR
.RS 4
Set or clear the display options
\fB+[no]comments\fR,
\fB+[no]rrcomments\fR, and
\fB+[no]trust\fR
as a group\&.
.RE
.PP
\fB+[no]multiline\fR
.RS 4
Print long records (such as RRSIG, DNSKEY, and SOA records) in a verbose multi\-line format with human\-readable comments\&. The default is to print each record on a single line, to facilitate machine parsing of the
\fBdelv\fR
output\&.
.RE
.PP
\fB+[no]dnssec\fR
.RS 4
Indicates whether to display RRSIG records in the
\fBdelv\fR
output\&. The default is to do so\&. Note that (unlike in
\fBdig\fR) this does
\fInot\fR
control whether to request DNSSEC records or whether to validate them\&. DNSSEC records are always requested, and validation will always occur unless suppressed by the use of
\fB\-i\fR
or
\fB+noroot\fR\&.
.RE
.PP
\fB+[no]root[=ROOT]\fR
.RS 4
Indicates whether to perform conventional DNSSEC validation, and if so, specifies the name of a trust anchor\&. The default is to validate using a trust anchor of "\&." (the root zone), for which there is a built\-in key\&. If specifying a different trust anchor, then
\fB\-a\fR
must be used to specify a file containing the key\&.
.RE
.PP
\fB+[no]tcp\fR
.RS 4
Controls whether to use TCP when sending queries\&. The default is to use UDP unless a truncated response has been received\&.
.RE
.PP
\fB+[no]unknownformat\fR
.RS 4
Print all RDATA in unknown RR type presentation format (RFC 3597)\&. The default is to print RDATA for known types in the type\*(Aqs presentation format\&.
.RE
.PP
\fB+[no]yaml\fR
.RS 4
Print response data in YAML format\&.
.RE
.SH "FILES"
.PP
/etc/bind\&.keys
.PP
/etc/resolv\&.conf
.SH "SEE ALSO"
.PP
\fBdig\fR(1),
\fBnamed\fR(8),
RFC4034,
RFC4035,
RFC4431,
RFC5074,
RFC5155\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2014-2020 Internet Systems Consortium, Inc. ("ISC")
.br

File diff suppressed because it is too large Load Diff

View File

@@ -1,699 +0,0 @@
<!DOCTYPE book [
<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.delv">
<info>
<date>2014-04-23</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle>delv</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname>delv</refname>
<refpurpose>DNS lookup and validation utility</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2017</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>delv</command>
<arg choice="opt" rep="norepeat">@server</arg>
<group choice="opt" rep="norepeat">
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
</group>
<arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">anchor-file</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">address</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-d <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-i</option></arg>
<arg choice="opt" rep="norepeat"><option>-m</option></arg>
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">port#</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-q <replaceable class="parameter">name</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-x <replaceable class="parameter">addr</replaceable></option></arg>
<arg choice="opt" rep="norepeat">name</arg>
<arg choice="opt" rep="norepeat">type</arg>
<arg choice="opt" rep="norepeat">class</arg>
<arg choice="opt" rep="repeat">queryopt</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>delv</command>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>delv</command>
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>delv</command>
<arg choice="opt" rep="repeat">queryopt</arg>
<arg choice="opt" rep="repeat">query</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>delv</command>
is a tool for sending
DNS queries and validating the results, using the same internal
resolver and validator logic as <command>named</command>.
</para>
<para>
<command>delv</command> will send to a specified name server all
queries needed to fetch and validate the requested data; this
includes the original requested query, subsequent queries to follow
CNAME or DNAME chains, and queries for DNSKEY and DS records
to establish a chain of trust for DNSSEC validation.
It does not perform iterative resolution, but simulates the
behavior of a name server configured for DNSSEC validating and
forwarding.
</para>
<para>
By default, responses are validated using built-in DNSSEC trust
anchor for the root zone ("."). Records returned by
<command>delv</command> are either fully validated or
were not signed. If validation fails, an explanation of
the failure is included in the output; the validation process
can be traced in detail. Because <command>delv</command> does
not rely on an external server to carry out validation, it can
be used to check the validity of DNS responses in environments
where local name servers may not be trustworthy.
</para>
<para>
Unless it is told to query a specific name server,
<command>delv</command> will try each of the servers listed in
<filename>/etc/resolv.conf</filename>. If no usable server
addresses are found, <command>delv</command> will send
queries to the localhost addresses (127.0.0.1 for IPv4, ::1
for IPv6).
</para>
<para>
When no command line arguments or options are given,
<command>delv</command> will perform an NS query for "."
(the root zone).
</para>
</refsection>
<refsection><info><title>SIMPLE USAGE</title></info>
<para>
A typical invocation of <command>delv</command> looks like:
<programlisting> delv @server name type </programlisting>
where:
<variablelist>
<varlistentry>
<term><constant>server</constant></term>
<listitem>
<para>
is the name or IP address of the name server to query. This
can be an IPv4 address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
<parameter>server</parameter> argument is a hostname,
<command>delv</command> resolves that name before
querying that name server (note, however, that this
initial lookup is <emphasis>not</emphasis> validated
by DNSSEC).
</para>
<para>
If no <parameter>server</parameter> argument is
provided, <command>delv</command> consults
<filename>/etc/resolv.conf</filename>; if an
address is found there, it queries the name server at
that address. If either of the <option>-4</option> or
<option>-6</option> options are in use, then
only addresses for the corresponding transport
will be tried. If no usable addresses are found,
<command>delv</command> will send queries to
the localhost addresses (127.0.0.1 for IPv4,
::1 for IPv6).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>name</constant></term>
<listitem>
<para>
is the domain name to be looked up.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>type</constant></term>
<listitem>
<para>
indicates what type of query is required &mdash;
ANY, A, MX, etc.
<parameter>type</parameter> can be any valid query
type. If no
<parameter>type</parameter> argument is supplied,
<command>delv</command> will perform a lookup for an
A record.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-a <replaceable class="parameter">anchor-file</replaceable></term>
<listitem>
<para>
Specifies a file from which to read DNSSEC trust anchors.
The default is <filename>/etc/bind.keys</filename>, which
is included with <acronym>BIND</acronym> 9 and contains
one or more trust anchors for the root zone (".").
</para>
<para>
Keys that do not match the root zone name are ignored.
An alternate key name can be specified using the
<option>+root=NAME</option> options.
</para>
<para>
Note: When reading the trust anchor file,
<command>delv</command> treats <option>trust-anchors</option>
<option>initial-key</option> and <option>static-key</option>
entries identically. That is, even if a key is configured
with <command>initial-key</command>, indicating that it is
meant to be used only as an initializing key for RFC 5011
key maintenance, it is still treated by <command>delv</command>
as if it had been configured as a <command>static-key</command>.
<command>delv</command> does not consult the managed keys
database maintained by <command>named</command>. This means
that if either of the keys in
<filename>/etc/bind.keys</filename> is revoked
and rolled over, it will be necessary to update
<filename>/etc/bind.keys</filename> to use DNSSEC
validation in <command>delv</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-b <replaceable class="parameter">address</replaceable></term>
<listitem>
<para>
Sets the source IP address of the query to
<parameter>address</parameter>. This must be a valid address
on one of the host's network interfaces or "0.0.0.0" or "::".
An optional source port may be specified by appending
"#&lt;port&gt;"
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c <replaceable class="parameter">class</replaceable></term>
<listitem>
<para>
Sets the query class for the requested data. Currently,
only class "IN" is supported in <command>delv</command>
and any other value is ignored.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d <replaceable class="parameter">level</replaceable></term>
<listitem>
<para>
Set the systemwide debug level to <option>level</option>.
The allowed range is from 0 to 99.
The default is 0 (no debugging).
Debugging traces from <command>delv</command> become
more verbose as the debug level increases.
See the <option>+mtrace</option>, <option>+rtrace</option>,
and <option>+vtrace</option> options below for additional
debugging details.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Display the <command>delv</command> help usage output and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-i</term>
<listitem>
<para>
Insecure mode. This disables internal DNSSEC validation.
(Note, however, this does not set the CD bit on upstream
queries. If the server being queried is performing DNSSEC
validation, then it will not return invalid data; this
can cause <command>delv</command> to time out. When it
is necessary to examine invalid data to debug a DNSSEC
problem, use <command>dig +cd</command>.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-m</term>
<listitem>
<para>
Enables memory usage debugging.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port#</replaceable></term>
<listitem>
<para>
Specifies a destination port to use for queries instead of
the standard DNS port number 53. This option would be used
with a name server that has been configured to listen
for queries on a non-standard port number.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-q <replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
Sets the query name to <parameter>name</parameter>.
While the query name can be specified without using the
<option>-q</option>, it is sometimes necessary to disambiguate
names from types or classes (for example, when looking up the
name "ns", which could be misinterpreted as the type NS,
or "ch", which could be misinterpreted as class CH).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">type</replaceable></term>
<listitem>
<para>
Sets the query type to <parameter>type</parameter>, which
can be any valid query type supported in BIND 9 except
for zone transfer types AXFR and IXFR. As with
<option>-q</option>, this is useful to distinguish
query name type or class when they are ambiguous.
it is sometimes necessary to disambiguate names from types.
</para>
<para>
The default query type is "A", unless the <option>-x</option>
option is supplied to indicate a reverse lookup, in which case
it is "PTR".
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v</term>
<listitem>
<para>
Print the <command>delv</command> version and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-x <replaceable class="parameter">addr</replaceable></term>
<listitem>
<para>
Performs a reverse lookup, mapping an addresses to
a name. <parameter>addr</parameter> is an IPv4 address in
dotted-decimal notation, or a colon-delimited IPv6 address.
When <option>-x</option> is used, there is no need to provide
the <parameter>name</parameter> or <parameter>type</parameter>
arguments. <command>delv</command> automatically performs a
lookup for a name like <literal>11.12.13.10.in-addr.arpa</literal>
and sets the query type to PTR. IPv6 addresses are looked up
using nibble format under the IP6.ARPA domain.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-4</term>
<listitem>
<para>
Forces <command>delv</command> to only use IPv4.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-6</term>
<listitem>
<para>
Forces <command>delv</command> to only use IPv6.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>QUERY OPTIONS</title></info>
<para><command>delv</command>
provides a number of query options which affect the way results are
displayed, and in some cases the way lookups are performed.
</para>
<para>
Each query option is identified by a keyword preceded by a plus sign
(<literal>+</literal>). Some keywords set or reset an
option. These may be preceded by the string
<literal>no</literal> to negate the meaning of that keyword.
Other keywords assign values to options like the timeout interval.
They have the form <option>+keyword=value</option>.
The query options are:
<variablelist>
<varlistentry>
<term><option>+[no]cdflag</option></term>
<listitem>
<para>
Controls whether to set the CD (checking disabled) bit in
queries sent by <command>delv</command>. This may be useful
when troubleshooting DNSSEC problems from behind a validating
resolver. A validating resolver will block invalid responses,
making it difficult to retrieve them for analysis. Setting
the CD flag on queries will cause the resolver to return
invalid responses, which <command>delv</command> can then
validate internally and report the errors in detail.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]class</option></term>
<listitem>
<para>
Controls whether to display the CLASS when printing
a record. The default is to display the CLASS.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]ttl</option></term>
<listitem>
<para>
Controls whether to display the TTL when printing
a record. The default is to display the TTL.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]rtrace</option></term>
<listitem>
<para>
Toggle resolver fetch logging. This reports the
name and type of each query sent by <command>delv</command>
in the process of carrying out the resolution and validation
process: this includes including the original query and
all subsequent queries to follow CNAMEs and to establish a
chain of trust for DNSSEC validation.
</para>
<para>
This is equivalent to setting the debug level to 1 in
the "resolver" logging category. Setting the systemwide
debug level to 1 using the <option>-d</option> option will
product the same output (but will affect other logging
categories as well).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]mtrace</option></term>
<listitem>
<para>
Toggle message logging. This produces a detailed dump of
the responses received by <command>delv</command> in the
process of carrying out the resolution and validation process.
</para>
<para>
This is equivalent to setting the debug level to 10
for the "packets" module of the "resolver" logging
category. Setting the systemwide debug level to 10 using
the <option>-d</option> option will produce the same output
(but will affect other logging categories as well).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]vtrace</option></term>
<listitem>
<para>
Toggle validation logging. This shows the internal
process of the validator as it determines whether an
answer is validly signed, unsigned, or invalid.
</para>
<para>
This is equivalent to setting the debug level to 3
for the "validator" module of the "dnssec" logging
category. Setting the systemwide debug level to 3 using
the <option>-d</option> option will produce the same output
(but will affect other logging categories as well).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]short</option></term>
<listitem>
<para>
Provide a terse answer. The default is to print the answer in a
verbose form.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]comments</option></term>
<listitem>
<para>
Toggle the display of comment lines in the output. The default
is to print comments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]rrcomments</option></term>
<listitem>
<para>
Toggle the display of per-record comments in the output (for
example, human-readable key information about DNSKEY records).
The default is to print per-record comments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]crypto</option></term>
<listitem>
<para>
Toggle the display of cryptographic fields in DNSSEC records.
The contents of these field are unnecessary to debug most DNSSEC
validation failures and removing them makes it easier to see
the common failures. The default is to display the fields.
When omitted they are replaced by the string "[omitted]" or
in the DNSKEY case the key id is displayed as the replacement,
e.g. "[ key id = value ]".
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]trust</option></term>
<listitem>
<para>
Controls whether to display the trust level when printing
a record. The default is to display the trust level.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]split[=W]</option></term>
<listitem>
<para>
Split long hex- or base64-formatted fields in resource
records into chunks of <parameter>W</parameter> characters
(where <parameter>W</parameter> is rounded up to the nearest
multiple of 4).
<parameter>+nosplit</parameter> or
<parameter>+split=0</parameter> causes fields not to be
split at all. The default is 56 characters, or 44 characters
when multiline mode is active.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]all</option></term>
<listitem>
<para>
Set or clear the display options
<option>+[no]comments</option>,
<option>+[no]rrcomments</option>, and
<option>+[no]trust</option> as a group.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]multiline</option></term>
<listitem>
<para>
Print long records (such as RRSIG, DNSKEY, and SOA records)
in a verbose multi-line format with human-readable comments.
The default is to print each record on a single line, to
facilitate machine parsing of the <command>delv</command>
output.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]dnssec</option></term>
<listitem>
<para>
Indicates whether to display RRSIG records in the
<command>delv</command> output. The default is to
do so. Note that (unlike in <command>dig</command>)
this does <emphasis>not</emphasis> control whether to
request DNSSEC records or whether to validate them.
DNSSEC records are always requested, and validation
will always occur unless suppressed by the use of
<option>-i</option> or <option>+noroot</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]root[=ROOT]</option></term>
<listitem>
<para>
Indicates whether to perform conventional
DNSSEC validation, and if so, specifies the
name of a trust anchor. The default is to validate using
a trust anchor of "." (the root zone), for which there is
a built-in key. If specifying a different trust anchor,
then <option>-a</option> must be used to specify a file
containing the key.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]tcp</option></term>
<listitem>
<para>
Controls whether to use TCP when sending queries.
The default is to use UDP unless a truncated
response has been received.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]unknownformat</option></term>
<listitem>
<para>
Print all RDATA in unknown RR type presentation format
(RFC 3597). The default is to print RDATA for known types
in the type's presentation format.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]yaml</option></term>
<listitem>
<para>
Print response data in YAML format.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsection>
<refsection><info><title>FILES</title></info>
<para><filename>/etc/bind.keys</filename></para>
<para><filename>/etc/resolv.conf</filename></para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>dig</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>RFC4034</citetitle>,
<citetitle>RFC4035</citetitle>,
<citetitle>RFC4431</citetitle>,
<citetitle>RFC5074</citetitle>,
<citetitle>RFC5155</citetitle>.
</para>
</refsection>
</refentry>

View File

@@ -1,588 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>delv</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.delv"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
delv
&#8212; DNS lookup and validation utility
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">delv</code>
[@server]
[
[<code class="option">-4</code>]
| [<code class="option">-6</code>]
]
[<code class="option">-a <em class="replaceable"><code>anchor-file</code></em></code>]
[<code class="option">-b <em class="replaceable"><code>address</code></em></code>]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-d <em class="replaceable"><code>level</code></em></code>]
[<code class="option">-i</code>]
[<code class="option">-m</code>]
[<code class="option">-p <em class="replaceable"><code>port#</code></em></code>]
[<code class="option">-q <em class="replaceable"><code>name</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>type</code></em></code>]
[<code class="option">-x <em class="replaceable"><code>addr</code></em></code>]
[name]
[type]
[class]
[queryopt...]
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">delv</code>
[<code class="option">-h</code>]
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">delv</code>
[<code class="option">-v</code>]
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">delv</code>
[queryopt...]
[query...]
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p><span class="command"><strong>delv</strong></span>
is a tool for sending
DNS queries and validating the results, using the same internal
resolver and validator logic as <span class="command"><strong>named</strong></span>.
</p>
<p>
<span class="command"><strong>delv</strong></span> will send to a specified name server all
queries needed to fetch and validate the requested data; this
includes the original requested query, subsequent queries to follow
CNAME or DNAME chains, and queries for DNSKEY and DS records
to establish a chain of trust for DNSSEC validation.
It does not perform iterative resolution, but simulates the
behavior of a name server configured for DNSSEC validating and
forwarding.
</p>
<p>
By default, responses are validated using built-in DNSSEC trust
anchor for the root zone ("."). Records returned by
<span class="command"><strong>delv</strong></span> are either fully validated or
were not signed. If validation fails, an explanation of
the failure is included in the output; the validation process
can be traced in detail. Because <span class="command"><strong>delv</strong></span> does
not rely on an external server to carry out validation, it can
be used to check the validity of DNS responses in environments
where local name servers may not be trustworthy.
</p>
<p>
Unless it is told to query a specific name server,
<span class="command"><strong>delv</strong></span> will try each of the servers listed in
<code class="filename">/etc/resolv.conf</code>. If no usable server
addresses are found, <span class="command"><strong>delv</strong></span> will send
queries to the localhost addresses (127.0.0.1 for IPv4, ::1
for IPv6).
</p>
<p>
When no command line arguments or options are given,
<span class="command"><strong>delv</strong></span> will perform an NS query for "."
(the root zone).
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>SIMPLE USAGE</h2>
<p>
A typical invocation of <span class="command"><strong>delv</strong></span> looks like:
</p>
<pre class="programlisting"> delv @server name type </pre>
<p>
where:
</p>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term"><code class="constant">server</code></span></dt>
<dd>
<p>
is the name or IP address of the name server to query. This
can be an IPv4 address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
<em class="parameter"><code>server</code></em> argument is a hostname,
<span class="command"><strong>delv</strong></span> resolves that name before
querying that name server (note, however, that this
initial lookup is <span class="emphasis"><em>not</em></span> validated
by DNSSEC).
</p>
<p>
If no <em class="parameter"><code>server</code></em> argument is
provided, <span class="command"><strong>delv</strong></span> consults
<code class="filename">/etc/resolv.conf</code>; if an
address is found there, it queries the name server at
that address. If either of the <code class="option">-4</code> or
<code class="option">-6</code> options are in use, then
only addresses for the corresponding transport
will be tried. If no usable addresses are found,
<span class="command"><strong>delv</strong></span> will send queries to
the localhost addresses (127.0.0.1 for IPv4,
::1 for IPv6).
</p>
</dd>
<dt><span class="term"><code class="constant">name</code></span></dt>
<dd>
<p>
is the domain name to be looked up.
</p>
</dd>
<dt><span class="term"><code class="constant">type</code></span></dt>
<dd>
<p>
indicates what type of query is required &#8212;
ANY, A, MX, etc.
<em class="parameter"><code>type</code></em> can be any valid query
type. If no
<em class="parameter"><code>type</code></em> argument is supplied,
<span class="command"><strong>delv</strong></span> will perform a lookup for an
A record.
</p>
</dd>
</dl></div>
<p>
</p>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-a <em class="replaceable"><code>anchor-file</code></em></span></dt>
<dd>
<p>
Specifies a file from which to read DNSSEC trust anchors.
The default is <code class="filename">/etc/bind.keys</code>, which
is included with <acronym class="acronym">BIND</acronym> 9 and contains
one or more trust anchors for the root zone (".").
</p>
<p>
Keys that do not match the root zone name are ignored.
An alternate key name can be specified using the
<code class="option">+root=NAME</code> options.
</p>
<p>
Note: When reading the trust anchor file,
<span class="command"><strong>delv</strong></span> treats <code class="option">trust-anchors</code>
<code class="option">initial-key</code> and <code class="option">static-key</code>
entries identically. That is, even if a key is configured
with <span class="command"><strong>initial-key</strong></span>, indicating that it is
meant to be used only as an initializing key for RFC 5011
key maintenance, it is still treated by <span class="command"><strong>delv</strong></span>
as if it had been configured as a <span class="command"><strong>static-key</strong></span>.
<span class="command"><strong>delv</strong></span> does not consult the managed keys
database maintained by <span class="command"><strong>named</strong></span>. This means
that if either of the keys in
<code class="filename">/etc/bind.keys</code> is revoked
and rolled over, it will be necessary to update
<code class="filename">/etc/bind.keys</code> to use DNSSEC
validation in <span class="command"><strong>delv</strong></span>.
</p>
</dd>
<dt><span class="term">-b <em class="replaceable"><code>address</code></em></span></dt>
<dd>
<p>
Sets the source IP address of the query to
<em class="parameter"><code>address</code></em>. This must be a valid address
on one of the host's network interfaces or "0.0.0.0" or "::".
An optional source port may be specified by appending
"#&lt;port&gt;"
</p>
</dd>
<dt><span class="term">-c <em class="replaceable"><code>class</code></em></span></dt>
<dd>
<p>
Sets the query class for the requested data. Currently,
only class "IN" is supported in <span class="command"><strong>delv</strong></span>
and any other value is ignored.
</p>
</dd>
<dt><span class="term">-d <em class="replaceable"><code>level</code></em></span></dt>
<dd>
<p>
Set the systemwide debug level to <code class="option">level</code>.
The allowed range is from 0 to 99.
The default is 0 (no debugging).
Debugging traces from <span class="command"><strong>delv</strong></span> become
more verbose as the debug level increases.
See the <code class="option">+mtrace</code>, <code class="option">+rtrace</code>,
and <code class="option">+vtrace</code> options below for additional
debugging details.
</p>
</dd>
<dt><span class="term">-h</span></dt>
<dd>
<p>
Display the <span class="command"><strong>delv</strong></span> help usage output and exit.
</p>
</dd>
<dt><span class="term">-i</span></dt>
<dd>
<p>
Insecure mode. This disables internal DNSSEC validation.
(Note, however, this does not set the CD bit on upstream
queries. If the server being queried is performing DNSSEC
validation, then it will not return invalid data; this
can cause <span class="command"><strong>delv</strong></span> to time out. When it
is necessary to examine invalid data to debug a DNSSEC
problem, use <span class="command"><strong>dig +cd</strong></span>.)
</p>
</dd>
<dt><span class="term">-m</span></dt>
<dd>
<p>
Enables memory usage debugging.
</p>
</dd>
<dt><span class="term">-p <em class="replaceable"><code>port#</code></em></span></dt>
<dd>
<p>
Specifies a destination port to use for queries instead of
the standard DNS port number 53. This option would be used
with a name server that has been configured to listen
for queries on a non-standard port number.
</p>
</dd>
<dt><span class="term">-q <em class="replaceable"><code>name</code></em></span></dt>
<dd>
<p>
Sets the query name to <em class="parameter"><code>name</code></em>.
While the query name can be specified without using the
<code class="option">-q</code>, it is sometimes necessary to disambiguate
names from types or classes (for example, when looking up the
name "ns", which could be misinterpreted as the type NS,
or "ch", which could be misinterpreted as class CH).
</p>
</dd>
<dt><span class="term">-t <em class="replaceable"><code>type</code></em></span></dt>
<dd>
<p>
Sets the query type to <em class="parameter"><code>type</code></em>, which
can be any valid query type supported in BIND 9 except
for zone transfer types AXFR and IXFR. As with
<code class="option">-q</code>, this is useful to distinguish
query name type or class when they are ambiguous.
it is sometimes necessary to disambiguate names from types.
</p>
<p>
The default query type is "A", unless the <code class="option">-x</code>
option is supplied to indicate a reverse lookup, in which case
it is "PTR".
</p>
</dd>
<dt><span class="term">-v</span></dt>
<dd>
<p>
Print the <span class="command"><strong>delv</strong></span> version and exit.
</p>
</dd>
<dt><span class="term">-x <em class="replaceable"><code>addr</code></em></span></dt>
<dd>
<p>
Performs a reverse lookup, mapping an addresses to
a name. <em class="parameter"><code>addr</code></em> is an IPv4 address in
dotted-decimal notation, or a colon-delimited IPv6 address.
When <code class="option">-x</code> is used, there is no need to provide
the <em class="parameter"><code>name</code></em> or <em class="parameter"><code>type</code></em>
arguments. <span class="command"><strong>delv</strong></span> automatically performs a
lookup for a name like <code class="literal">11.12.13.10.in-addr.arpa</code>
and sets the query type to PTR. IPv6 addresses are looked up
using nibble format under the IP6.ARPA domain.
</p>
</dd>
<dt><span class="term">-4</span></dt>
<dd>
<p>
Forces <span class="command"><strong>delv</strong></span> to only use IPv4.
</p>
</dd>
<dt><span class="term">-6</span></dt>
<dd>
<p>
Forces <span class="command"><strong>delv</strong></span> to only use IPv6.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>QUERY OPTIONS</h2>
<p><span class="command"><strong>delv</strong></span>
provides a number of query options which affect the way results are
displayed, and in some cases the way lookups are performed.
</p>
<p>
Each query option is identified by a keyword preceded by a plus sign
(<code class="literal">+</code>). Some keywords set or reset an
option. These may be preceded by the string
<code class="literal">no</code> to negate the meaning of that keyword.
Other keywords assign values to options like the timeout interval.
They have the form <code class="option">+keyword=value</code>.
The query options are:
</p>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term"><code class="option">+[no]cdflag</code></span></dt>
<dd>
<p>
Controls whether to set the CD (checking disabled) bit in
queries sent by <span class="command"><strong>delv</strong></span>. This may be useful
when troubleshooting DNSSEC problems from behind a validating
resolver. A validating resolver will block invalid responses,
making it difficult to retrieve them for analysis. Setting
the CD flag on queries will cause the resolver to return
invalid responses, which <span class="command"><strong>delv</strong></span> can then
validate internally and report the errors in detail.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]class</code></span></dt>
<dd>
<p>
Controls whether to display the CLASS when printing
a record. The default is to display the CLASS.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]ttl</code></span></dt>
<dd>
<p>
Controls whether to display the TTL when printing
a record. The default is to display the TTL.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]rtrace</code></span></dt>
<dd>
<p>
Toggle resolver fetch logging. This reports the
name and type of each query sent by <span class="command"><strong>delv</strong></span>
in the process of carrying out the resolution and validation
process: this includes including the original query and
all subsequent queries to follow CNAMEs and to establish a
chain of trust for DNSSEC validation.
</p>
<p>
This is equivalent to setting the debug level to 1 in
the "resolver" logging category. Setting the systemwide
debug level to 1 using the <code class="option">-d</code> option will
product the same output (but will affect other logging
categories as well).
</p>
</dd>
<dt><span class="term"><code class="option">+[no]mtrace</code></span></dt>
<dd>
<p>
Toggle message logging. This produces a detailed dump of
the responses received by <span class="command"><strong>delv</strong></span> in the
process of carrying out the resolution and validation process.
</p>
<p>
This is equivalent to setting the debug level to 10
for the "packets" module of the "resolver" logging
category. Setting the systemwide debug level to 10 using
the <code class="option">-d</code> option will produce the same output
(but will affect other logging categories as well).
</p>
</dd>
<dt><span class="term"><code class="option">+[no]vtrace</code></span></dt>
<dd>
<p>
Toggle validation logging. This shows the internal
process of the validator as it determines whether an
answer is validly signed, unsigned, or invalid.
</p>
<p>
This is equivalent to setting the debug level to 3
for the "validator" module of the "dnssec" logging
category. Setting the systemwide debug level to 3 using
the <code class="option">-d</code> option will produce the same output
(but will affect other logging categories as well).
</p>
</dd>
<dt><span class="term"><code class="option">+[no]short</code></span></dt>
<dd>
<p>
Provide a terse answer. The default is to print the answer in a
verbose form.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]comments</code></span></dt>
<dd>
<p>
Toggle the display of comment lines in the output. The default
is to print comments.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]rrcomments</code></span></dt>
<dd>
<p>
Toggle the display of per-record comments in the output (for
example, human-readable key information about DNSKEY records).
The default is to print per-record comments.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]crypto</code></span></dt>
<dd>
<p>
Toggle the display of cryptographic fields in DNSSEC records.
The contents of these field are unnecessary to debug most DNSSEC
validation failures and removing them makes it easier to see
the common failures. The default is to display the fields.
When omitted they are replaced by the string "[omitted]" or
in the DNSKEY case the key id is displayed as the replacement,
e.g. "[ key id = value ]".
</p>
</dd>
<dt><span class="term"><code class="option">+[no]trust</code></span></dt>
<dd>
<p>
Controls whether to display the trust level when printing
a record. The default is to display the trust level.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]split[=W]</code></span></dt>
<dd>
<p>
Split long hex- or base64-formatted fields in resource
records into chunks of <em class="parameter"><code>W</code></em> characters
(where <em class="parameter"><code>W</code></em> is rounded up to the nearest
multiple of 4).
<em class="parameter"><code>+nosplit</code></em> or
<em class="parameter"><code>+split=0</code></em> causes fields not to be
split at all. The default is 56 characters, or 44 characters
when multiline mode is active.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]all</code></span></dt>
<dd>
<p>
Set or clear the display options
<code class="option">+[no]comments</code>,
<code class="option">+[no]rrcomments</code>, and
<code class="option">+[no]trust</code> as a group.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]multiline</code></span></dt>
<dd>
<p>
Print long records (such as RRSIG, DNSKEY, and SOA records)
in a verbose multi-line format with human-readable comments.
The default is to print each record on a single line, to
facilitate machine parsing of the <span class="command"><strong>delv</strong></span>
output.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]dnssec</code></span></dt>
<dd>
<p>
Indicates whether to display RRSIG records in the
<span class="command"><strong>delv</strong></span> output. The default is to
do so. Note that (unlike in <span class="command"><strong>dig</strong></span>)
this does <span class="emphasis"><em>not</em></span> control whether to
request DNSSEC records or whether to validate them.
DNSSEC records are always requested, and validation
will always occur unless suppressed by the use of
<code class="option">-i</code> or <code class="option">+noroot</code>.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]root[=ROOT]</code></span></dt>
<dd>
<p>
Indicates whether to perform conventional
DNSSEC validation, and if so, specifies the
name of a trust anchor. The default is to validate using
a trust anchor of "." (the root zone), for which there is
a built-in key. If specifying a different trust anchor,
then <code class="option">-a</code> must be used to specify a file
containing the key.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]tcp</code></span></dt>
<dd>
<p>
Controls whether to use TCP when sending queries.
The default is to use UDP unless a truncated
response has been received.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]unknownformat</code></span></dt>
<dd>
<p>
Print all RDATA in unknown RR type presentation format
(RFC 3597). The default is to print RDATA for known types
in the type's presentation format.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]yaml</code></span></dt>
<dd>
<p>
Print response data in YAML format.
</p>
</dd>
</dl></div>
<p>
</p>
</div>
<div class="refsection">
<a name="id-1.11"></a><h2>FILES</h2>
<p><code class="filename">/etc/bind.keys</code></p>
<p><code class="filename">/etc/resolv.conf</code></p>
</div>
<div class="refsection">
<a name="id-1.12"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">dig</span>(1)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>,
<em class="citetitle">RFC4034</em>,
<em class="citetitle">RFC4035</em>,
<em class="citetitle">RFC4431</em>,
<em class="citetitle">RFC5074</em>,
<em class="citetitle">RFC5155</em>.
</p>
</div>
</div></body>
</html>

336
bin/delv/delv.rst Normal file
View File

@@ -0,0 +1,336 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_delv:
delv - DNS lookup and validation utility
----------------------------------------
Synopsis
~~~~~~~~
:program:`delv` [@server] [ [**-4**] | [**-6**] ] [**-a** anchor-file] [**-b** address] [**-c** class] [**-d** level] [**-i**] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-x** addr] [name] [type] [class] [queryopt...]
:program:`delv` [**-h**]
:program:`delv` [**-v**]
:program:`delv` [queryopt...] [query...]
Description
~~~~~~~~~~~
``delv`` is a tool for sending DNS queries and validating the results,
using the same internal resolver and validator logic as ``named``.
``delv`` will send to a specified name server all queries needed to
fetch and validate the requested data; this includes the original
requested query, subsequent queries to follow CNAME or DNAME chains, and
queries for DNSKEY, and DS records to establish a chain of trust for
DNSSEC validation. It does not perform iterative resolution, but
simulates the behavior of a name server configured for DNSSEC validating
and forwarding.
By default, responses are validated using built-in DNSSEC trust anchor
for the root zone ("."). Records returned by ``delv`` are either fully
validated or were not signed. If validation fails, an explanation of the
failure is included in the output; the validation process can be traced
in detail. Because ``delv`` does not rely on an external server to carry
out validation, it can be used to check the validity of DNS responses in
environments where local name servers may not be trustworthy.
Unless it is told to query a specific name server, ``delv`` will try
each of the servers listed in ``/etc/resolv.conf``. If no usable server
addresses are found, ``delv`` will send queries to the localhost
addresses (127.0.0.1 for IPv4, ::1 for IPv6).
When no command line arguments or options are given, ``delv`` will
perform an NS query for "." (the root zone).
Simple Usage
~~~~~~~~~~~~
A typical invocation of ``delv`` looks like:
::
delv @server name type
where:
``server``
is the name or IP address of the name server to query. This can be an
IPv4 address in dotted-decimal notation or an IPv6 address in
colon-delimited notation. When the supplied ``server`` argument is a
hostname, ``delv`` resolves that name before querying that name
server (note, however, that this initial lookup is *not* validated by
DNSSEC).
If no ``server`` argument is provided, ``delv`` consults
``/etc/resolv.conf``; if an address is found there, it queries the
name server at that address. If either of the ``-4`` or ``-6``
options are in use, then only addresses for the corresponding
transport will be tried. If no usable addresses are found, ``delv``
will send queries to the localhost addresses (127.0.0.1 for IPv4, ::1
for IPv6).
``name``
is the domain name to be looked up.
``type``
indicates what type of query is required MDASH ANY, A, MX, etc.
``type`` can be any valid query type. If no ``type`` argument is
supplied, ``delv`` will perform a lookup for an A record.
Options
~~~~~~~
**-a** anchor-file
Specifies a file from which to read DNSSEC trust anchors. The default
is ``/etc/bind.keys``, which is included with BIND 9 and contains one
or more trust anchors for the root zone (".").
Keys that do not match the root zone name are ignored. An alternate
key name can be specified using the ``+root=NAME`` options.
Note: When reading the trust anchor file, ``delv`` treat ``trust-anchors``
``initial-key`` and ``static-key`` identically. That is, for a managed key,
it is the *initial* key that is trusted; :rfc:`5011` key management is not
supported. ``delv`` will not consult the managed-keys database maintained by
``named``. This means that if either of the keys in ``/etc/bind.keys`` is
revoked and rolled over, it will be necessary to update ``/etc/bind.keys`` to
use DNSSEC validation in ``delv``.
**-b** address
Sets the source IP address of the query to ``address``. This must be
a valid address on one of the host's network interfaces or "0.0.0.0"
or "::". An optional source port may be specified by appending
"#<port>"
**-c** class
Sets the query class for the requested data. Currently, only class
"IN" is supported in ``delv`` and any other value is ignored.
**-d** level
Set the systemwide debug level to ``level``. The allowed range is
from 0 to 99. The default is 0 (no debugging). Debugging traces from
``delv`` become more verbose as the debug level increases. See the
``+mtrace``, ``+rtrace``, and ``+vtrace`` options below for
additional debugging details.
**-h**
Display the ``delv`` help usage output and exit.
**-i**
Insecure mode. This disables internal DNSSEC validation. (Note,
however, this does not set the CD bit on upstream queries. If the
server being queried is performing DNSSEC validation, then it will
not return invalid data; this can cause ``delv`` to time out. When it
is necessary to examine invalid data to debug a DNSSEC problem, use
``dig +cd``.)
**-m**
Enables memory usage debugging.
**-p** port#
Specifies a destination port to use for queries instead of the
standard DNS port number 53. This option would be used with a name
server that has been configured to listen for queries on a
non-standard port number.
**-q** name
Sets the query name to ``name``. While the query name can be
specified without using the ``-q``, it is sometimes necessary to
disambiguate names from types or classes (for example, when looking
up the name "ns", which could be misinterpreted as the type NS, or
"ch", which could be misinterpreted as class CH).
**-t** type
Sets the query type to ``type``, which can be any valid query type
supported in BIND 9 except for zone transfer types AXFR and IXFR. As
with ``-q``, this is useful to distinguish query name type or class
when they are ambiguous. it is sometimes necessary to disambiguate
names from types.
The default query type is "A", unless the ``-x`` option is supplied
to indicate a reverse lookup, in which case it is "PTR".
**-v**
Print the ``delv`` version and exit.
**-x** addr
Performs a reverse lookup, mapping an addresses to a name. ``addr``
is an IPv4 address in dotted-decimal notation, or a colon-delimited
IPv6 address. When ``-x`` is used, there is no need to provide the
``name`` or ``type`` arguments. ``delv`` automatically performs a
lookup for a name like ``11.12.13.10.in-addr.arpa`` and sets the
query type to PTR. IPv6 addresses are looked up using nibble format
under the IP6.ARPA domain.
**-4**
Forces ``delv`` to only use IPv4.
**-6**
Forces ``delv`` to only use IPv6.
Query Options
~~~~~~~~~~~~~
``delv`` provides a number of query options which affect the way results
are displayed, and in some cases the way lookups are performed.
Each query option is identified by a keyword preceded by a plus sign
(``+``). Some keywords set or reset an option. These may be preceded by
the string ``no`` to negate the meaning of that keyword. Other keywords
assign values to options like the timeout interval. They have the form
``+keyword=value``. The query options are:
``+[no]cdflag``
Controls whether to set the CD (checking disabled) bit in queries
sent by ``delv``. This may be useful when troubleshooting DNSSEC
problems from behind a validating resolver. A validating resolver
will block invalid responses, making it difficult to retrieve them
for analysis. Setting the CD flag on queries will cause the resolver
to return invalid responses, which ``delv`` can then validate
internally and report the errors in detail.
``+[no]class``
Controls whether to display the CLASS when printing a record. The
default is to display the CLASS.
``+[no]ttl``
Controls whether to display the TTL when printing a record. The
default is to display the TTL.
``+[no]rtrace``
Toggle resolver fetch logging. This reports the name and type of each
query sent by ``delv`` in the process of carrying out the resolution
and validation process: this includes including the original query
and all subsequent queries to follow CNAMEs and to establish a chain
of trust for DNSSEC validation.
This is equivalent to setting the debug level to 1 in the "resolver"
logging category. Setting the systemwide debug level to 1 using the
``-d`` option will product the same output (but will affect other
logging categories as well).
``+[no]mtrace``
Toggle message logging. This produces a detailed dump of the
responses received by ``delv`` in the process of carrying out the
resolution and validation process.
This is equivalent to setting the debug level to 10 for the "packets"
module of the "resolver" logging category. Setting the systemwide
debug level to 10 using the ``-d`` option will produce the same
output (but will affect other logging categories as well).
``+[no]vtrace``
Toggle validation logging. This shows the internal process of the
validator as it determines whether an answer is validly signed,
unsigned, or invalid.
This is equivalent to setting the debug level to 3 for the
"validator" module of the "dnssec" logging category. Setting the
systemwide debug level to 3 using the ``-d`` option will produce the
same output (but will affect other logging categories as well).
``+[no]short``
Provide a terse answer. The default is to print the answer in a
verbose form.
``+[no]comments``
Toggle the display of comment lines in the output. The default is to
print comments.
``+[no]rrcomments``
Toggle the display of per-record comments in the output (for example,
human-readable key information about DNSKEY records). The default is
to print per-record comments.
``+[no]crypto``
Toggle the display of cryptographic fields in DNSSEC records. The
contents of these field are unnecessary to debug most DNSSEC
validation failures and removing them makes it easier to see the
common failures. The default is to display the fields. When omitted
they are replaced by the string "[omitted]" or in the DNSKEY case the
key id is displayed as the replacement, e.g. "[ key id = value ]".
``+[no]trust``
Controls whether to display the trust level when printing a record.
The default is to display the trust level.
``+[no]split[=W]``
Split long hex- or base64-formatted fields in resource records into
chunks of ``W`` characters (where ``W`` is rounded up to the nearest
multiple of 4). ``+nosplit`` or ``+split=0`` causes fields not to be
split at all. The default is 56 characters, or 44 characters when
multiline mode is active.
``+[no]all``
Set or clear the display options ``+[no]comments``,
``+[no]rrcomments``, and ``+[no]trust`` as a group.
``+[no]multiline``
Print long records (such as RRSIG, DNSKEY, and SOA records) in a
verbose multi-line format with human-readable comments. The default
is to print each record on a single line, to facilitate machine
parsing of the ``delv`` output.
``+[no]dnssec``
Indicates whether to display RRSIG records in the ``delv`` output.
The default is to do so. Note that (unlike in ``dig``) this does
*not* control whether to request DNSSEC records or whether to
validate them. DNSSEC records are always requested, and validation
will always occur unless suppressed by the use of ``-i`` or
``+noroot``.
``+[no]root[=ROOT]``
Indicates whether to perform conventional DNSSEC validation, and if so,
specifies the name of a trust anchor. The default is to validate using a
trust anchor of "." (the root zone), for which there is a built-in key. If
specifying a different trust anchor, then ``-a`` must be used to specify a
file containing the key.
``+[no]tcp``
Controls whether to use TCP when sending queries. The default is to
use UDP unless a truncated response has been received.
``+[no]unknownformat``
Print all RDATA in unknown RR type presentation format (:rfc:`3597`).
The default is to print RDATA for known types in the type's
presentation format.
``+[no]yaml``
Print response data in YAML format.
Files
~~~~~
``/etc/bind.keys``
``/etc/resolv.conf``
See Also
~~~~~~~~
:manpage:`dig(1)`, :manpage:`named(8)`, :rfc:`4034`, :rfc:`4035`, :rfc:`4431`, :rfc:`5074`, :rfc:`5155`.

View File

@@ -44,17 +44,20 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -77,7 +80,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -26,10 +26,10 @@ CDEFINES = -DVERSION=\"${VERSION}\"
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
IRSLIBS = ../../lib/irs/libirs.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
@@ -57,12 +57,6 @@ UOBJS =
SRCS = dig.c dighost.c host.c nslookup.c
MANPAGES = dig.1 host.1 nslookup.1
HTMLPAGES = dig.html host.html nslookup.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@
LDFLAGS = @LDFLAGS@ @LIBIDN2_LDFLAGS@
@@ -82,17 +76,11 @@ nslookup@EXEEXT@: nslookup.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
export LIBS0="${DNSLIBS} ${IRSLIBS}"; \
${FINALBUILDCMD}
doc man:: ${MANOBJS}
docclean manclean maintainer-clean::
rm -f ${MANOBJS}
clean distclean maintainer-clean::
rm -f ${TARGETS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir}
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1
install:: dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@ installdirs
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \
@@ -101,14 +89,8 @@ install:: dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@ installdirs
host@EXEEXT@ ${DESTDIR}${bindir}
${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} \
nslookup@EXEEXT@ ${DESTDIR}${bindir}
for m in ${MANPAGES}; do \
${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man1 || exit 1; \
done
uninstall::
for m in ${MANPAGES}; do \
rm -f ${DESTDIR}${mandir}/man1/$$m || exit 1; \
done
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${bindir}/nslookup@EXEEXT@
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${bindir}/host@EXEEXT@
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${bindir}/dig@EXEEXT@

View File

@@ -1,853 +0,0 @@
.\" Copyright (C) 2000-2011, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: dig
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-02-19
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "DIG" "1" "2014\-02\-19" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dig \- DNS lookup utility
.SH "SYNOPSIS"
.HP \w'\fBdig\fR\ 'u
\fBdig\fR [@server] [\fB\-b\ \fR\fB\fIaddress\fR\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-f\ \fR\fB\fIfilename\fR\fR] [\fB\-k\ \fR\fB\fIfilename\fR\fR] [\fB\-m\fR] [\fB\-p\ \fR\fB\fIport#\fR\fR] [\fB\-q\ \fR\fB\fIname\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-v\fR] [\fB\-x\ \fR\fB\fIaddr\fR\fR] [\fB\-y\ \fR\fB\fI[hmac:]\fR\fIname:key\fR\fR] [[\fB\-4\fR] | [\fB\-6\fR]] [name] [type] [class] [queryopt...]
.HP \w'\fBdig\fR\ 'u
\fBdig\fR [\fB\-h\fR]
.HP \w'\fBdig\fR\ 'u
\fBdig\fR [global\-queryopt...] [query...]
.SH "DESCRIPTION"
.PP
\fBdig\fR
is a flexible tool for interrogating DNS name servers\&. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried\&. Most DNS administrators use
\fBdig\fR
to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output\&. Other lookup tools tend to have less functionality than
\fBdig\fR\&.
.PP
Although
\fBdig\fR
is normally used with command\-line arguments, it also has a batch mode of operation for reading lookup requests from a file\&. A brief summary of its command\-line arguments and options is printed when the
\fB\-h\fR
option is given\&. Unlike earlier versions, the BIND 9 implementation of
\fBdig\fR
allows multiple lookups to be issued from the command line\&.
.PP
Unless it is told to query a specific name server,
\fBdig\fR
will try each of the servers listed in
/etc/resolv\&.conf\&. If no usable server addresses are found,
\fBdig\fR
will send the query to the local host\&.
.PP
When no command line arguments or options are given,
\fBdig\fR
will perform an NS query for "\&." (the root)\&.
.PP
It is possible to set per\-user defaults for
\fBdig\fR
via
${HOME}/\&.digrc\&. This file is read and any options in it are applied before the command line arguments\&. The
\fB\-r\fR
option disables this feature, for scripts that need predictable behaviour\&.
.PP
The IN and CH class names overlap with the IN and CH top level domain names\&. Either use the
\fB\-t\fR
and
\fB\-c\fR
options to specify the type and class, use the
\fB\-q\fR
the specify the domain name, or use "IN\&." and "CH\&." when looking up these top level domains\&.
.SH "SIMPLE USAGE"
.PP
A typical invocation of
\fBdig\fR
looks like:
.sp
.if n \{\
.RS 4
.\}
.nf
dig @server name type
.fi
.if n \{\
.RE
.\}
.sp
where:
.PP
\fBserver\fR
.RS 4
is the name or IP address of the name server to query\&. This can be an IPv4 address in dotted\-decimal notation or an IPv6 address in colon\-delimited notation\&. When the supplied
\fIserver\fR
argument is a hostname,
\fBdig\fR
resolves that name before querying that name server\&.
.sp
If no
\fIserver\fR
argument is provided,
\fBdig\fR
consults
/etc/resolv\&.conf; if an address is found there, it queries the name server at that address\&. If either of the
\fB\-4\fR
or
\fB\-6\fR
options are in use, then only addresses for the corresponding transport will be tried\&. If no usable addresses are found,
\fBdig\fR
will send the query to the local host\&. The reply from the name server that responds is displayed\&.
.RE
.PP
\fBname\fR
.RS 4
is the name of the resource record that is to be looked up\&.
.RE
.PP
\fBtype\fR
.RS 4
indicates what type of query is required \(em ANY, A, MX, SIG, etc\&.
\fItype\fR
can be any valid query type\&. If no
\fItype\fR
argument is supplied,
\fBdig\fR
will perform a lookup for an A record\&.
.RE
.SH "OPTIONS"
.PP
\-4
.RS 4
Use IPv4 only\&.
.RE
.PP
\-6
.RS 4
Use IPv6 only\&.
.RE
.PP
\-b \fIaddress\fR\fI[#port]\fR
.RS 4
Set the source IP address of the query\&. The
\fIaddress\fR
must be a valid address on one of the host\*(Aqs network interfaces, or "0\&.0\&.0\&.0" or "::"\&. An optional port may be specified by appending "#<port>"
.RE
.PP
\-c \fIclass\fR
.RS 4
Set the query class\&. The default
\fIclass\fR
is IN; other classes are HS for Hesiod records or CH for Chaosnet records\&.
.RE
.PP
\-f \fIfile\fR
.RS 4
Batch mode:
\fBdig\fR
reads a list of lookup requests to process from the given
\fIfile\fR\&. Each line in the file should be organized in the same way they would be presented as queries to
\fBdig\fR
using the command\-line interface\&.
.RE
.PP
\-k \fIkeyfile\fR
.RS 4
Sign queries using TSIG using a key read from the given file\&. Key files can be generated using
\fBtsig-keygen\fR(8)\&. When using TSIG authentication with
\fBdig\fR, the name server that is queried needs to know the key and algorithm that is being used\&. In BIND, this is done by providing appropriate
\fBkey\fR
and
\fBserver\fR
statements in
named\&.conf\&.
.RE
.PP
\-m
.RS 4
Enable memory usage debugging\&.
.RE
.PP
\-p \fIport\fR
.RS 4
Send the query to a non\-standard port on the server, instead of the default port 53\&. This option would be used to test a name server that has been configured to listen for queries on a non\-standard port number\&.
.RE
.PP
\-q \fIname\fR
.RS 4
The domain name to query\&. This is useful to distinguish the
\fIname\fR
from other arguments\&.
.RE
.PP
\-r
.RS 4
Do not read options from
${HOME}/\&.digrc\&. This is useful for scripts that need predictable behaviour\&.
.RE
.PP
\-t \fItype\fR
.RS 4
The resource record type to query\&. It can be any valid query type\&. If it is a resource record type supported in BIND 9, it can be given by the type mnemonic (such as "NS" or "AAAA")\&. The default query type is "A", unless the
\fB\-x\fR
option is supplied to indicate a reverse lookup\&. A zone transfer can be requested by specifying a type of AXFR\&. When an incremental zone transfer (IXFR) is required, set the
\fItype\fR
to
ixfr=N\&. The incremental zone transfer will contain the changes made to the zone since the serial number in the zone\*(Aqs SOA record was
\fIN\fR\&.
.sp
All resource record types can be expressed as "TYPEnn", where "nn" is the number of the type\&. If the resource record type is not supported in BIND 9, the result will be displayed as described in RFC 3597\&.
.RE
.PP
\-u
.RS 4
Print query times in microseconds instead of milliseconds\&.
.RE
.PP
\-v
.RS 4
Print the version number and exit\&.
.RE
.PP
\-x \fIaddr\fR
.RS 4
Simplified reverse lookups, for mapping addresses to names\&. The
\fIaddr\fR
is an IPv4 address in dotted\-decimal notation, or a colon\-delimited IPv6 address\&. When the
\fB\-x\fR
is used, there is no need to provide the
\fIname\fR,
\fIclass\fR
and
\fItype\fR
arguments\&.
\fBdig\fR
automatically performs a lookup for a name like
94\&.2\&.0\&.192\&.in\-addr\&.arpa
and sets the query type and class to PTR and IN respectively\&. IPv6 addresses are looked up using nibble format under the IP6\&.ARPA domain\&.
.RE
.PP
\-y \fI[hmac:]\fR\fIkeyname:secret\fR
.RS 4
Sign queries using TSIG with the given authentication key\&.
\fIkeyname\fR
is the name of the key, and
\fIsecret\fR
is the base64 encoded shared secret\&.
\fIhmac\fR
is the name of the key algorithm; valid choices are
hmac\-md5,
hmac\-sha1,
hmac\-sha224,
hmac\-sha256,
hmac\-sha384, or
hmac\-sha512\&. If
\fIhmac\fR
is not specified, the default is
hmac\-md5
or if MD5 was disabled
hmac\-sha256\&.
.sp
NOTE: You should use the
\fB\-k\fR
option and avoid the
\fB\-y\fR
option, because with
\fB\-y\fR
the shared secret is supplied as a command line argument in clear text\&. This may be visible in the output from
\fBps\fR(1)
or in a history file maintained by the user\*(Aqs shell\&.
.RE
.SH "QUERY OPTIONS"
.PP
\fBdig\fR
provides a number of query options which affect the way in which lookups are made and the results displayed\&. Some of these set or reset flag bits in the query header, some determine which sections of the answer get printed, and others determine the timeout and retry strategies\&.
.PP
Each query option is identified by a keyword preceded by a plus sign (+)\&. Some keywords set or reset an option\&. These may be preceded by the string
no
to negate the meaning of that keyword\&. Other keywords assign values to options like the timeout interval\&. They have the form
\fB+keyword=value\fR\&. Keywords may be abbreviated, provided the abbreviation is unambiguous; for example,
+cd
is equivalent to
+cdflag\&. The query options are:
.PP
\fB+[no]aaflag\fR
.RS 4
A synonym for
\fI+[no]aaonly\fR\&.
.RE
.PP
\fB+[no]aaonly\fR
.RS 4
Sets the "aa" flag in the query\&.
.RE
.PP
\fB+[no]additional\fR
.RS 4
Display [do not display] the additional section of a reply\&. The default is to display it\&.
.RE
.PP
\fB+[no]adflag\fR
.RS 4
Set [do not set] the AD (authentic data) bit in the query\&. This requests the server to return whether all of the answer and authority sections have all been validated as secure according to the security policy of the server\&. AD=1 indicates that all records have been validated as secure and the answer is not from a OPT\-OUT range\&. AD=0 indicate that some part of the answer was insecure or not validated\&. This bit is set by default\&.
.RE
.PP
\fB+[no]all\fR
.RS 4
Set or clear all display flags\&.
.RE
.PP
\fB+[no]answer\fR
.RS 4
Display [do not display] the answer section of a reply\&. The default is to display it\&.
.RE
.PP
\fB+[no]authority\fR
.RS 4
Display [do not display] the authority section of a reply\&. The default is to display it\&.
.RE
.PP
\fB+[no]badcookie\fR
.RS 4
Retry lookup with the new server cookie if a BADCOOKIE response is received\&.
.RE
.PP
\fB+[no]besteffort\fR
.RS 4
Attempt to display the contents of messages which are malformed\&. The default is to not display malformed answers\&.
.RE
.PP
\fB+bufsize=B\fR
.RS 4
Set the UDP message buffer size advertised using EDNS0 to
\fIB\fR
bytes\&. The maximum and minimum sizes of this buffer are 65535 and 0 respectively\&. Values outside this range are rounded up or down appropriately\&. Values other than zero will cause a EDNS query to be sent\&.
.RE
.PP
\fB+[no]cdflag\fR
.RS 4
Set [do not set] the CD (checking disabled) bit in the query\&. This requests the server to not perform DNSSEC validation of responses\&.
.RE
.PP
\fB+[no]class\fR
.RS 4
Display [do not display] the CLASS when printing the record\&.
.RE
.PP
\fB+[no]cmd\fR
.RS 4
Toggles the printing of the initial comment in the output, identifying the version of
\fBdig\fR
and the query options that have been applied\&. This option always has global effect; it cannot be set globally and then overridden on a per\-lookup basis\&. The default is to print this comment\&.
.RE
.PP
\fB+[no]comments\fR
.RS 4
Toggles the display of some comment lines in the output, containing information about the packet header and OPT pseudosection, and the names of the response section\&. The default is to print these comments\&.
.sp
Other types of comments in the output are not affected by this option, but can be controlled using other command line switches\&. These include
\fB+[no]cmd\fR,
\fB+[no]question\fR,
\fB+[no]stats\fR, and
\fB+[no]rrcomments\fR\&.
.RE
.PP
\fB+[no]cookie\fR\fB[=####]\fR
.RS 4
Send a COOKIE EDNS option, with optional value\&. Replaying a COOKIE from a previous response will allow the server to identify a previous client\&. The default is
\fB+cookie\fR\&.
.sp
\fB+cookie\fR
is also set when +trace is set to better emulate the default queries from a nameserver\&.
.RE
.PP
\fB+[no]crypto\fR
.RS 4
Toggle the display of cryptographic fields in DNSSEC records\&. The contents of these field are unnecessary to debug most DNSSEC validation failures and removing them makes it easier to see the common failures\&. The default is to display the fields\&. When omitted they are replaced by the string "[omitted]" or in the DNSKEY case the key id is displayed as the replacement, e\&.g\&. "[ key id = value ]"\&.
.RE
.PP
\fB+[no]defname\fR
.RS 4
Deprecated, treated as a synonym for
\fI+[no]search\fR
.RE
.PP
\fB+[no]dnssec\fR
.RS 4
Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO) in the OPT record in the additional section of the query\&.
.RE
.PP
\fB+domain=somename\fR
.RS 4
Set the search list to contain the single domain
\fIsomename\fR, as if specified in a
\fBdomain\fR
directive in
/etc/resolv\&.conf, and enable search list processing as if the
\fI+search\fR
option were given\&.
.RE
.PP
\fB+dscp=value\fR
.RS 4
Set the DSCP code point to be used when sending the query\&. Valid DSCP code points are in the range [0\&.\&.63]\&. By default no code point is explicitly set\&.
.RE
.PP
\fB+[no]edns[=#]\fR
.RS 4
Specify the EDNS version to query with\&. Valid values are 0 to 255\&. Setting the EDNS version will cause a EDNS query to be sent\&.
\fB+noedns\fR
clears the remembered EDNS version\&. EDNS is set to 0 by default\&.
.RE
.PP
\fB+[no]ednsflags[=#]\fR
.RS 4
Set the must\-be\-zero EDNS flags bits (Z bits) to the specified value\&. Decimal, hex and octal encodings are accepted\&. Setting a named flag (e\&.g\&. DO) will silently be ignored\&. By default, no Z bits are set\&.
.RE
.PP
\fB+[no]ednsnegotiation\fR
.RS 4
Enable / disable EDNS version negotiation\&. By default EDNS version negotiation is enabled\&.
.RE
.PP
\fB+[no]ednsopt[=code[:value]]\fR
.RS 4
Specify EDNS option with code point
\fBcode\fR
and optionally payload of
\fBvalue\fR
as a hexadecimal string\&.
\fBcode\fR
can be either an EDNS option name (for example,
NSID
or
ECS), or an arbitrary numeric value\&.
\fB+noednsopt\fR
clears the EDNS options to be sent\&.
.RE
.PP
\fB+[no]expire\fR
.RS 4
Send an EDNS Expire option\&.
.RE
.PP
\fB+[no]expandaaaa\fR
.RS 4
When printing AAAA record print all zero nibbles rather than the default RFC 5952 preferred presentation format\&.
.RE
.PP
\fB+[no]fail\fR
.RS 4
Do not try the next server if you receive a SERVFAIL\&. The default is to not try the next server which is the reverse of normal stub resolver behavior\&.
.RE
.PP
\fB+[no]header\-only\fR
.RS 4
Send a query with a DNS header without a question section\&. The default is to add a question section\&. The query type and query name are ignored when this is set\&.
.RE
.PP
\fB+[no]identify\fR
.RS 4
Show [or do not show] the IP address and port number that supplied the answer when the
\fI+short\fR
option is enabled\&. If short form answers are requested, the default is not to show the source address and port number of the server that provided the answer\&.
.RE
.PP
\fB+[no]idnin\fR
.RS 4
Process [do not process] IDN domain names on input\&. This requires IDN SUPPORT to have been enabled at compile time\&.
.sp
The default is to process IDN input when standard output is a tty\&. The IDN processing on input is disabled when dig output is redirected to files, pipes, and other non\-tty file descriptors\&.
.RE
.PP
\fB+[no]idnout\fR
.RS 4
Convert [do not convert] puny code on output\&. This requires IDN SUPPORT to have been enabled at compile time\&.
.sp
The default is to process puny code on output when standard output is a tty\&. The puny code processing on output is disabled when dig output is redirected to files, pipes, and other non\-tty file descriptors\&.
.RE
.PP
\fB+[no]ignore\fR
.RS 4
Ignore truncation in UDP responses instead of retrying with TCP\&. By default, TCP retries are performed\&.
.RE
.PP
\fB+[no]keepalive\fR
.RS 4
Send [or do not send] an EDNS Keepalive option\&.
.RE
.PP
\fB+[no]keepopen\fR
.RS 4
Keep the TCP socket open between queries and reuse it rather than creating a new TCP socket for each lookup\&. The default is
\fB+nokeepopen\fR\&.
.RE
.PP
\fB+[no]mapped\fR
.RS 4
Allow mapped IPv4 over IPv6 addresses to be used\&. The default is
\fB+mapped\fR\&.
.RE
.PP
\fB+[no]multiline\fR
.RS 4
Print records like the SOA records in a verbose multi\-line format with human\-readable comments\&. The default is to print each record on a single line, to facilitate machine parsing of the
\fBdig\fR
output\&.
.RE
.PP
\fB+ndots=D\fR
.RS 4
Set the number of dots that have to appear in
\fIname\fR
to
\fID\fR
for it to be considered absolute\&. The default value is that defined using the ndots statement in
/etc/resolv\&.conf, or 1 if no ndots statement is present\&. Names with fewer dots are interpreted as relative names and will be searched for in the domains listed in the
\fBsearch\fR
or
\fBdomain\fR
directive in
/etc/resolv\&.conf
if
\fB+search\fR
is set\&.
.RE
.PP
\fB+[no]nsid\fR
.RS 4
Include an EDNS name server ID request when sending a query\&.
.RE
.PP
\fB+[no]nssearch\fR
.RS 4
When this option is set,
\fBdig\fR
attempts to find the authoritative name servers for the zone containing the name being looked up and display the SOA record that each name server has for the zone\&. Addresses of servers that that did not respond are also printed\&.
.RE
.PP
\fB+[no]onesoa\fR
.RS 4
Print only one (starting) SOA record when performing an AXFR\&. The default is to print both the starting and ending SOA records\&.
.RE
.PP
\fB+[no]opcode=value\fR
.RS 4
Set [restore] the DNS message opcode to the specified value\&. The default value is QUERY (0)\&.
.RE
.PP
\fB+padding=value\fR
.RS 4
Pad the size of the query packet using the EDNS Padding option to blocks of
\fIvalue\fR
bytes\&. For example,
\fB+padding=32\fR
would cause a 48\-byte query to be padded to 64 bytes\&. The default block size is 0, which disables padding\&. The maximum is 512\&. Values are ordinarily expected to be powers of two, such as 128; however, this is not mandatory\&. Responses to padded queries may also be padded, but only if the query uses TCP or DNS COOKIE\&.
.RE
.PP
\fB+[no]qr\fR
.RS 4
Toggles the display of the query message as it is sent\&. By default, the query is not printed\&.
.RE
.PP
\fB+[no]question\fR
.RS 4
Toggles the display of the question section of a query when an answer is returned\&. The default is to print the question section as a comment\&.
.RE
.PP
\fB+[no]raflag\fR
.RS 4
Set [do not set] the RA (Recursion Available) bit in the query\&. The default is +noraflag\&. This bit should be ignored by the server for QUERY\&.
.RE
.PP
\fB+[no]rdflag\fR
.RS 4
A synonym for
\fI+[no]recurse\fR\&.
.RE
.PP
\fB+[no]recurse\fR
.RS 4
Toggle the setting of the RD (recursion desired) bit in the query\&. This bit is set by default, which means
\fBdig\fR
normally sends recursive queries\&. Recursion is automatically disabled when using the
\fI+nssearch\fR
option, and when using
\fI+trace\fR
except for an initial recursive query to get the list of root servers\&.
.RE
.PP
\fB+retry=T\fR
.RS 4
Sets the number of times to retry UDP queries to server to
\fIT\fR
instead of the default, 2\&. Unlike
\fI+tries\fR, this does not include the initial query\&.
.RE
.PP
\fB+[no]rrcomments\fR
.RS 4
Toggle the display of per\-record comments in the output (for example, human\-readable key information about DNSKEY records)\&. The default is not to print record comments unless multiline mode is active\&.
.RE
.PP
\fB+[no]search\fR
.RS 4
Use [do not use] the search list defined by the searchlist or domain directive in
resolv\&.conf
(if any)\&. The search list is not used by default\&.
.sp
\*(Aqndots\*(Aq from
resolv\&.conf
(default 1) which may be overridden by
\fI+ndots\fR
determines if the name will be treated as relative or not and hence whether a search is eventually performed or not\&.
.RE
.PP
\fB+[no]short\fR
.RS 4
Provide a terse answer\&. The default is to print the answer in a verbose form\&. This option always has global effect; it cannot be set globally and then overridden on a per\-lookup basis\&.
.RE
.PP
\fB+[no]showsearch\fR
.RS 4
Perform [do not perform] a search showing intermediate results\&.
.RE
.PP
\fB+[no]sigchase\fR
.RS 4
This feature is now obsolete and has been removed; use
\fBdelv\fR
instead\&.
.RE
.PP
\fB+split=W\fR
.RS 4
Split long hex\- or base64\-formatted fields in resource records into chunks of
\fIW\fR
characters (where
\fIW\fR
is rounded up to the nearest multiple of 4)\&.
\fI+nosplit\fR
or
\fI+split=0\fR
causes fields not to be split at all\&. The default is 56 characters, or 44 characters when multiline mode is active\&.
.RE
.PP
\fB+[no]stats\fR
.RS 4
Toggles the printing of statistics: when the query was made, the size of the reply and so on\&. The default behavior is to print the query statistics as a comment after each lookup\&.
.RE
.PP
\fB+[no]subnet=addr[/prefix\-length]\fR
.RS 4
Send (don\*(Aqt send) an EDNS Client Subnet option with the specified IP address or network prefix\&.
.sp
\fBdig +subnet=0\&.0\&.0\&.0/0\fR, or simply
\fBdig +subnet=0\fR
for short, sends an EDNS CLIENT\-SUBNET option with an empty address and a source prefix\-length of zero, which signals a resolver that the client\*(Aqs address information must
\fInot\fR
be used when resolving this query\&.
.RE
.PP
\fB+[no]tcflag\fR
.RS 4
Set [do not set] the TC (TrunCation) bit in the query\&. The default is +notcflag\&. This bit should be ignored by the server for QUERY\&.
.RE
.PP
\fB+[no]tcp\fR
.RS 4
Use [do not use] TCP when querying name servers\&. The default behavior is to use UDP unless a type
any
or
ixfr=N
query is requested, in which case the default is TCP\&. AXFR queries always use TCP\&.
.RE
.PP
\fB+timeout=T\fR
.RS 4
Sets the timeout for a query to
\fIT\fR
seconds\&. The default timeout is 5 seconds\&. An attempt to set
\fIT\fR
to less than 1 will result in a query timeout of 1 second being applied\&.
.RE
.PP
\fB+[no]topdown\fR
.RS 4
This feature is related to
\fBdig +sigchase\fR, which is obsolete and has been removed\&. Use
\fBdelv\fR
instead\&.
.RE
.PP
\fB+[no]trace\fR
.RS 4
Toggle tracing of the delegation path from the root name servers for the name being looked up\&. Tracing is disabled by default\&. When tracing is enabled,
\fBdig\fR
makes iterative queries to resolve the name being looked up\&. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup\&.
.sp
If @server is also specified, it affects only the initial query for the root zone name servers\&.
.sp
\fB+dnssec\fR
is also set when +trace is set to better emulate the default queries from a nameserver\&.
.RE
.PP
\fB+tries=T\fR
.RS 4
Sets the number of times to try UDP queries to server to
\fIT\fR
instead of the default, 3\&. If
\fIT\fR
is less than or equal to zero, the number of tries is silently rounded up to 1\&.
.RE
.PP
\fB+trusted\-key=####\fR
.RS 4
Formerly specified trusted keys for use with
\fBdig +sigchase\fR\&. This feature is now obsolete and has been removed; use
\fBdelv\fR
instead\&.
.RE
.PP
\fB+[no]ttlid\fR
.RS 4
Display [do not display] the TTL when printing the record\&.
.RE
.PP
\fB+[no]ttlunits\fR
.RS 4
Display [do not display] the TTL in friendly human\-readable time units of "s", "m", "h", "d", and "w", representing seconds, minutes, hours, days and weeks\&. Implies +ttlid\&.
.RE
.PP
\fB+[no]unexpected\fR
.RS 4
Accept [do not accept] answers from unexpected sources\&. By default,
\fBdig\fR
won\*(Aqt accept a reply from a source other than the one to which it sent the query\&.
.RE
.PP
\fB+[no]unknownformat\fR
.RS 4
Print all RDATA in unknown RR type presentation format (RFC 3597)\&. The default is to print RDATA for known types in the type\*(Aqs presentation format\&.
.RE
.PP
\fB+[no]vc\fR
.RS 4
Use [do not use] TCP when querying name servers\&. This alternate syntax to
\fI+[no]tcp\fR
is provided for backwards compatibility\&. The "vc" stands for "virtual circuit"\&.
.RE
.PP
\fB+[no]yaml\fR
.RS 4
Print the responses (and, if
\fB+qr\fR
is in use, also the outgoing queries) in a detailed YAML format\&.
.RE
.PP
\fB+[no]zflag\fR
.RS 4
Set [do not set] the last unassigned DNS header flag in a DNS query\&. This flag is off by default\&.
.RE
.SH "MULTIPLE QUERIES"
.PP
The BIND 9 implementation of
\fBdig \fR
supports specifying multiple queries on the command line (in addition to supporting the
\fB\-f\fR
batch file option)\&. Each of those queries can be supplied with its own set of flags, options and query options\&.
.PP
In this case, each
\fIquery\fR
argument represent an individual query in the command\-line syntax described above\&. Each consists of any of the standard options and flags, the name to be looked up, an optional query type and class and any query options that should be applied to that query\&.
.PP
A global set of query options, which should be applied to all queries, can also be supplied\&. These global query options must precede the first tuple of name, class, type, options, flags, and query options supplied on the command line\&. Any global query options (except
\fB+[no]cmd\fR
and
\fB+[no]short\fR
options) can be overridden by a query\-specific set of query options\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
dig +qr www\&.isc\&.org any \-x 127\&.0\&.0\&.1 isc\&.org ns +noqr
.fi
.if n \{\
.RE
.\}
.sp
shows how
\fBdig\fR
could be used from the command line to make three lookups: an ANY query for
www\&.isc\&.org, a reverse lookup of 127\&.0\&.0\&.1 and a query for the NS records of
isc\&.org\&. A global query option of
\fI+qr\fR
is applied, so that
\fBdig\fR
shows the initial query it made for each lookup\&. The final query has a local query option of
\fI+noqr\fR
which means that
\fBdig\fR
will not print the initial query when it looks up the NS records for
isc\&.org\&.
.SH "IDN SUPPORT"
.PP
If
\fBdig\fR
has been built with IDN (internationalized domain name) support, it can accept and display non\-ASCII domain names\&.
\fBdig\fR
appropriately converts character encoding of domain name before sending a request to DNS server or displaying a reply from the server\&. If you\*(Aqd like to turn off the IDN support for some reason, use parameters
\fI+noidnin\fR
and
\fI+noidnout\fR
or define the
\fBIDN_DISABLE\fR
environment variable\&.
.SH "FILES"
.PP
/etc/resolv\&.conf
.PP
${HOME}/\&.digrc
.SH "SEE ALSO"
.PP
\fBdelv\fR(1),
\fBhost\fR(1),
\fBnamed\fR(8),
\fBdnssec-keygen\fR(8),
RFC 1035\&.
.SH "BUGS"
.PP
There are probably too many query options\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2000-2011, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
.br

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

634
bin/dig/dig.rst Normal file
View File

@@ -0,0 +1,634 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_dig:
dig - DNS lookup utility
----------------------------------
Synopsis
~~~~~~~~
:program:`dig` [@server] [**-b** address] [**-c** class] [**-f** filename] [**-k** filename] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-v**] [**-x** addr] [**-y** [hmac:]name:key] [ [**-4**] | [**-6**] ] [name] [type] [class] [queryopt...]
:program:`dig` [**-h**]
:program:`dig` [global-queryopt...] [query...]
Description
~~~~~~~~~~~
``dig`` is a flexible tool for interrogating DNS name servers. It
performs DNS lookups and displays the answers that are returned from the
name server(s) that were queried. Most DNS administrators use ``dig`` to
troubleshoot DNS problems because of its flexibility, ease of use and
clarity of output. Other lookup tools tend to have less functionality
than ``dig``.
Although ``dig`` is normally used with command-line arguments, it also
has a batch mode of operation for reading lookup requests from a file. A
brief summary of its command-line arguments and options is printed when
the ``-h`` option is given. Unlike earlier versions, the BIND 9
implementation of ``dig`` allows multiple lookups to be issued from the
command line.
Unless it is told to query a specific name server, ``dig`` will try each
of the servers listed in ``/etc/resolv.conf``. If no usable server
addresses are found, ``dig`` will send the query to the local host.
When no command line arguments or options are given, ``dig`` will
perform an NS query for "." (the root).
It is possible to set per-user defaults for ``dig`` via
``${HOME}/.digrc``. This file is read and any options in it are applied
before the command line arguments. The ``-r`` option disables this
feature, for scripts that need predictable behaviour.
The IN and CH class names overlap with the IN and CH top level domain
names. Either use the ``-t`` and ``-c`` options to specify the type and
class, use the ``-q`` the specify the domain name, or use "IN." and
"CH." when looking up these top level domains.
Simple Usage
~~~~~~~~~~~~
A typical invocation of ``dig`` looks like:
::
dig @server name type
where:
``server``
is the name or IP address of the name server to query. This can be an
IPv4 address in dotted-decimal notation or an IPv6 address in
colon-delimited notation. When the supplied ``server`` argument is a
hostname, ``dig`` resolves that name before querying that name
server.
If no ``server`` argument is provided, ``dig`` consults
``/etc/resolv.conf``; if an address is found there, it queries the
name server at that address. If either of the ``-4`` or ``-6``
options are in use, then only addresses for the corresponding
transport will be tried. If no usable addresses are found, ``dig``
will send the query to the local host. The reply from the name server
that responds is displayed.
``name``
is the name of the resource record that is to be looked up.
``type``
indicates what type of query is required MDASH ANY, A, MX, SIG, etc.
``type`` can be any valid query type. If no ``type`` argument is
supplied, ``dig`` will perform a lookup for an A record.
Options
~~~~~~~
**-4**
Use IPv4 only.
**-6**
Use IPv6 only.
**-b** address[#port]
Set the source IP address of the query. The ``address`` must be a
valid address on one of the host's network interfaces, or "0.0.0.0"
or "::". An optional port may be specified by appending "#<port>"
**-c** class
Set the query class. The default ``class`` is IN; other classes are
HS for Hesiod records or CH for Chaosnet records.
**-f** file
Batch mode: ``dig`` reads a list of lookup requests to process from
the given ``file``. Each line in the file should be organized in the
same way they would be presented as queries to ``dig`` using the
command-line interface.
**-k** keyfile
Sign queries using TSIG using a key read from the given file. Key
files can be generated using tsig-keygen8. When using TSIG
authentication with ``dig``, the name server that is queried needs to
know the key and algorithm that is being used. In BIND, this is done
by providing appropriate ``key`` and ``server`` statements in
``named.conf``.
**-m**
Enable memory usage debugging.
**-p** port
Send the query to a non-standard port on the server, instead of the
default port 53. This option would be used to test a name server that
has been configured to listen for queries on a non-standard port
number.
**-q** name
The domain name to query. This is useful to distinguish the ``name``
from other arguments.
**-r**
Do not read options from ``${HOME}/.digrc``. This is useful for
scripts that need predictable behaviour.
**-t** type
The resource record type to query. It can be any valid query type. If
it is a resource record type supported in BIND 9, it can be given by
the type mnemonic (such as "NS" or "AAAA"). The default query type is
"A", unless the ``-x`` option is supplied to indicate a reverse
lookup. A zone transfer can be requested by specifying a type of
AXFR. When an incremental zone transfer (IXFR) is required, set the
``type`` to ``ixfr=N``. The incremental zone transfer will contain
the changes made to the zone since the serial number in the zone's
SOA record was ``N``.
All resource record types can be expressed as "TYPEnn", where "nn" is
the number of the type. If the resource record type is not supported
in BIND 9, the result will be displayed as described in :rfc:`3597`.
**-u**
Print query times in microseconds instead of milliseconds.
**-v**
Print the version number and exit.
**-x** addr
Simplified reverse lookups, for mapping addresses to names. The
``addr`` is an IPv4 address in dotted-decimal notation, or a
colon-delimited IPv6 address. When the ``-x`` is used, there is no
need to provide the ``name``, ``class`` and ``type`` arguments.
``dig`` automatically performs a lookup for a name like
``94.2.0.192.in-addr.arpa`` and sets the query type and class to PTR
and IN respectively. IPv6 addresses are looked up using nibble format
under the IP6.ARPA domain.
**-y** [hmac:]keyname:secret
Sign queries using TSIG with the given authentication key.
``keyname`` is the name of the key, and ``secret`` is the base64
encoded shared secret. ``hmac`` is the name of the key algorithm;
valid choices are ``hmac-md5``, ``hmac-sha1``, ``hmac-sha224``,
``hmac-sha256``, ``hmac-sha384``, or ``hmac-sha512``. If ``hmac`` is
not specified, the default is ``hmac-md5`` or if MD5 was disabled
``hmac-sha256``.
.. note:: You should use the ``-k`` option and avoid the ``-y`` option,
because with ``-y`` the shared secret is supplied as a command line
argument in clear text. This may be visible in the output from ps1 or
in a history file maintained by the user's shell.
Query Options
~~~~~~~~~~~~~
``dig`` provides a number of query options which affect the way in which
lookups are made and the results displayed. Some of these set or reset
flag bits in the query header, some determine which sections of the
answer get printed, and others determine the timeout and retry
strategies.
Each query option is identified by a keyword preceded by a plus sign
(``+``). Some keywords set or reset an option. These may be preceded by
the string ``no`` to negate the meaning of that keyword. Other keywords
assign values to options like the timeout interval. They have the form
``+keyword=value``. Keywords may be abbreviated, provided the
abbreviation is unambiguous; for example, ``+cd`` is equivalent to
``+cdflag``. The query options are:
``+[no]aaflag``
A synonym for ``+[no]aaonly``.
``+[no]aaonly``
Sets the "aa" flag in the query.
``+[no]additional``
Display [do not display] the additional section of a reply. The
default is to display it.
``+[no]adflag``
Set [do not set] the AD (authentic data) bit in the query. This
requests the server to return whether all of the answer and authority
sections have all been validated as secure according to the security
policy of the server. AD=1 indicates that all records have been
validated as secure and the answer is not from a OPT-OUT range. AD=0
indicate that some part of the answer was insecure or not validated.
This bit is set by default.
``+[no]all``
Set or clear all display flags.
``+[no]answer``
Display [do not display] the answer section of a reply. The default
is to display it.
``+[no]authority``
Display [do not display] the authority section of a reply. The
default is to display it.
``+[no]badcookie``
Retry lookup with the new server cookie if a BADCOOKIE response is
received.
``+[no]besteffort``
Attempt to display the contents of messages which are malformed. The
default is to not display malformed answers.
``+bufsize=B``
Set the UDP message buffer size advertised using EDNS0 to ``B``
bytes. The maximum and minimum sizes of this buffer are 65535 and 0
respectively. Values outside this range are rounded up or down
appropriately. Values other than zero will cause a EDNS query to be
sent.
``+[no]cdflag``
Set [do not set] the CD (checking disabled) bit in the query. This
requests the server to not perform DNSSEC validation of responses.
``+[no]class``
Display [do not display] the CLASS when printing the record.
``+[no]cmd``
Toggles the printing of the initial comment in the output, identifying the
version of ``dig`` and the query options that have been applied. This option
always has global effect; it cannot be set globally and then overridden on a
per-lookup basis. The default is to print this comment.
``+[no]comments``
Toggles the display of some comment lines in the output, containing
information about the packet header and OPT pseudosection, and the names of
the response section. The default is to print these comments.
Other types of comments in the output are not affected by this option, but
can be controlled using other command line switches. These include
``+[no]cmd``, ``+[no]question``, ``+[no]stats``, and ``+[no]rrcomments``.
``+[no]cookie=####``
Send a COOKIE EDNS option, with optional value. Replaying a COOKIE
from a previous response will allow the server to identify a previous
client. The default is ``+cookie``.
``+cookie`` is also set when +trace is set to better emulate the
default queries from a nameserver.
``+[no]crypto``
Toggle the display of cryptographic fields in DNSSEC records. The
contents of these field are unnecessary to debug most DNSSEC
validation failures and removing them makes it easier to see the
common failures. The default is to display the fields. When omitted
they are replaced by the string "[omitted]" or in the DNSKEY case the
key id is displayed as the replacement, e.g. "[ key id = value ]".
``+[no]defname``
Deprecated, treated as a synonym for ``+[no]search``
``+[no]dnssec``
Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO) in
the OPT record in the additional section of the query.
``+domain=somename``
Set the search list to contain the single domain ``somename``, as if
specified in a ``domain`` directive in ``/etc/resolv.conf``, and
enable search list processing as if the ``+search`` option were
given.
``+dscp=value``
Set the DSCP code point to be used when sending the query. Valid DSCP
code points are in the range [0..63]. By default no code point is
explicitly set.
``+[no]edns[=#]``
Specify the EDNS version to query with. Valid values are 0 to 255.
Setting the EDNS version will cause a EDNS query to be sent.
``+noedns`` clears the remembered EDNS version. EDNS is set to 0 by
default.
``+[no]ednsflags[=#]``
Set the must-be-zero EDNS flags bits (Z bits) to the specified value.
Decimal, hex and octal encodings are accepted. Setting a named flag
(e.g. DO) will silently be ignored. By default, no Z bits are set.
``+[no]ednsnegotiation``
Enable / disable EDNS version negotiation. By default EDNS version
negotiation is enabled.
``+[no]ednsopt[=code[:value]]``
Specify EDNS option with code point ``code`` and optionally payload
of ``value`` as a hexadecimal string. ``code`` can be either an EDNS
option name (for example, ``NSID`` or ``ECS``), or an arbitrary
numeric value. ``+noednsopt`` clears the EDNS options to be sent.
``+[no]expire``
Send an EDNS Expire option.
``+[no]fail``
Do not try the next server if you receive a SERVFAIL. The default is
to not try the next server which is the reverse of normal stub
resolver behavior.
``+[no]header-only``
Send a query with a DNS header without a question section. The
default is to add a question section. The query type and query name
are ignored when this is set.
``+[no]identify``
Show [or do not show] the IP address and port number that supplied
the answer when the ``+short`` option is enabled. If short form
answers are requested, the default is not to show the source address
and port number of the server that provided the answer.
``+[no]idnin``
Process [do not process] IDN domain names on input. This requires IDN
SUPPORT to have been enabled at compile time.
The default is to process IDN input when standard output is a tty.
The IDN processing on input is disabled when dig output is redirected
to files, pipes, and other non-tty file descriptors.
``+[no]idnout``
Convert [do not convert] puny code on output. This requires IDN
SUPPORT to have been enabled at compile time.
The default is to process puny code on output when standard output is
a tty. The puny code processing on output is disabled when dig output
is redirected to files, pipes, and other non-tty file descriptors.
``+[no]ignore``
Ignore truncation in UDP responses instead of retrying with TCP. By
default, TCP retries are performed.
``+[no]keepalive``
Send [or do not send] an EDNS Keepalive option.
``+[no]keepopen``
Keep the TCP socket open between queries and reuse it rather than
creating a new TCP socket for each lookup. The default is
``+nokeepopen``.
``+[no]mapped``
Allow mapped IPv4 over IPv6 addresses to be used. The default is
``+mapped``.
``+[no]multiline``
Print records like the SOA records in a verbose multi-line format
with human-readable comments. The default is to print each record on
a single line, to facilitate machine parsing of the ``dig`` output.
``+ndots=D``
Set the number of dots that have to appear in ``name`` to ``D`` for
it to be considered absolute. The default value is that defined using
the ndots statement in ``/etc/resolv.conf``, or 1 if no ndots
statement is present. Names with fewer dots are interpreted as
relative names and will be searched for in the domains listed in the
``search`` or ``domain`` directive in ``/etc/resolv.conf`` if
``+search`` is set.
``+[no]nsid``
Include an EDNS name server ID request when sending a query.
``+[no]nssearch``
When this option is set, ``dig`` attempts to find the authoritative
name servers for the zone containing the name being looked up and
display the SOA record that each name server has for the zone.
Addresses of servers that that did not respond are also printed.
``+[no]onesoa``
Print only one (starting) SOA record when performing an AXFR. The
default is to print both the starting and ending SOA records.
``+[no]opcode=value``
Set [restore] the DNS message opcode to the specified value. The
default value is QUERY (0).
``+padding=value``
Pad the size of the query packet using the EDNS Padding option to
blocks of ``value`` bytes. For example, ``+padding=32`` would cause a
48-byte query to be padded to 64 bytes. The default block size is 0,
which disables padding. The maximum is 512. Values are ordinarily
expected to be powers of two, such as 128; however, this is not
mandatory. Responses to padded queries may also be padded, but only
if the query uses TCP or DNS COOKIE.
``+[no]qr``
Toggles the display of the query message as it is sent. By default, the query
is not printed.
``+[no]question``
Toggles the display of the question section of a query when an answer is
returned. The default is to print the question section as a comment.
``+[no]raflag``
Set [do not set] the RA (Recursion Available) bit in the query. The
default is +noraflag. This bit should be ignored by the server for
QUERY.
``+[no]rdflag``
A synonym for ``+[no]recurse``.
``+[no]recurse``
Toggle the setting of the RD (recursion desired) bit in the query.
This bit is set by default, which means ``dig`` normally sends
recursive queries. Recursion is automatically disabled when the
``+nssearch`` or ``+trace`` query options are used.
``+retry=T``
Sets the number of times to retry UDP queries to server to ``T``
instead of the default, 2. Unlike ``+tries``, this does not include
the initial query.
``+[no]rrcomments``
Toggle the display of per-record comments in the output (for example,
human-readable key information about DNSKEY records). The default is
not to print record comments unless multiline mode is active.
``+[no]search``
Use [do not use] the search list defined by the searchlist or domain
directive in ``resolv.conf`` (if any). The search list is not used by
default.
'ndots' from ``resolv.conf`` (default 1) which may be overridden by
``+ndots`` determines if the name will be treated as relative or not
and hence whether a search is eventually performed or not.
``+[no]short``
Provide a terse answer. The default is to print the answer in a verbose
form. This option always has global effect; it cannot be set globally and
then overridden on a per-lookup basis.
``+[no]showsearch``
Perform [do not perform] a search showing intermediate results.
``+[no]sigchase``
This feature is now obsolete and has been removed; use ``delv``
instead.
``+split=W``
Split long hex- or base64-formatted fields in resource records into
chunks of ``W`` characters (where ``W`` is rounded up to the nearest
multiple of 4). ``+nosplit`` or ``+split=0`` causes fields not to be
split at all. The default is 56 characters, or 44 characters when
multiline mode is active.
``+[no]stats``
Toggles the printing of statistics: when the query was made, the size of the
reply and so on. The default behavior is to print the query statistics as a
comment after each lookup.
``+[no]subnet=addr[/prefix-length]``
Send (don't send) an EDNS Client Subnet option with the specified IP
address or network prefix.
``dig +subnet=0.0.0.0/0``, or simply ``dig +subnet=0`` for short,
sends an EDNS CLIENT-SUBNET option with an empty address and a source
prefix-length of zero, which signals a resolver that the client's
address information must *not* be used when resolving this query.
``+[no]tcflag``
Set [do not set] the TC (TrunCation) bit in the query. The default is
+notcflag. This bit should be ignored by the server for QUERY.
``+[no]tcp``
Use [do not use] TCP when querying name servers. The default behavior
is to use UDP unless a type ``any`` or ``ixfr=N`` query is requested,
in which case the default is TCP. AXFR queries always use TCP.
``+timeout=T``
Sets the timeout for a query to ``T`` seconds. The default timeout is
5 seconds. An attempt to set ``T`` to less than 1 will result in a
query timeout of 1 second being applied.
``+[no]topdown``
This feature is related to ``dig +sigchase``, which is obsolete and
has been removed. Use ``delv`` instead.
``+[no]trace``
Toggle tracing of the delegation path from the root name servers for
the name being looked up. Tracing is disabled by default. When
tracing is enabled, ``dig`` makes iterative queries to resolve the
name being looked up. It will follow referrals from the root servers,
showing the answer from each server that was used to resolve the
lookup.
If @server is also specified, it affects only the initial query for
the root zone name servers.
``+dnssec`` is also set when +trace is set to better emulate the
default queries from a nameserver.
``+tries=T``
Sets the number of times to try UDP queries to server to ``T``
instead of the default, 3. If ``T`` is less than or equal to zero,
the number of tries is silently rounded up to 1.
``+trusted-key=####``
Formerly specified trusted keys for use with ``dig +sigchase``. This
feature is now obsolete and has been removed; use ``delv`` instead.
``+[no]ttlid``
Display [do not display] the TTL when printing the record.
``+[no]ttlunits``
Display [do not display] the TTL in friendly human-readable time
units of "s", "m", "h", "d", and "w", representing seconds, minutes,
hours, days and weeks. Implies +ttlid.
``+[no]unexpected``
Accept [do not accept] answers from unexpected sources. By default, ``dig``
won't accept a reply from a source other than the one to which it sent the
query.
``+[no]unknownformat``
Print all RDATA in unknown RR type presentation format (:rfc:`3597`).
The default is to print RDATA for known types in the type's
presentation format.
``+[no]vc``
Use [do not use] TCP when querying name servers. This alternate
syntax to ``+[no]tcp`` is provided for backwards compatibility. The
"vc" stands for "virtual circuit".
``+[no]yaml``
Print the responses (and, if <option>+qr</option> is in use, also the
outgoing queries) in a detailed YAML format.
``+[no]zflag``
Set [do not set] the last unassigned DNS header flag in a DNS query.
This flag is off by default.
Multiple Queries
~~~~~~~~~~~~~~~~
The BIND 9 implementation of ``dig`` supports specifying multiple
queries on the command line (in addition to supporting the ``-f`` batch
file option). Each of those queries can be supplied with its own set of
flags, options and query options.
In this case, each ``query`` argument represent an individual query in
the command-line syntax described above. Each consists of any of the
standard options and flags, the name to be looked up, an optional query
type and class and any query options that should be applied to that
query.
A global set of query options, which should be applied to all queries,
can also be supplied. These global query options must precede the first
tuple of name, class, type, options, flags, and query options supplied
on the command line. Any global query options (except ``+[no]cmd`` and
``+[no]short`` options) can be overridden by a query-specific set of
query options. For example:
::
dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
shows how ``dig`` could be used from the command line to make three
lookups: an ANY query for ``www.isc.org``, a reverse lookup of 127.0.0.1
and a query for the NS records of ``isc.org``. A global query option of
``+qr`` is applied, so that ``dig`` shows the initial query it made for
each lookup. The final query has a local query option of ``+noqr`` which
means that ``dig`` will not print the initial query when it looks up the
NS records for ``isc.org``.
IDN Support
~~~~~~~~~~~
If ``dig`` has been built with IDN (internationalized domain name)
support, it can accept and display non-ASCII domain names. ``dig``
appropriately converts character encoding of domain name before sending
a request to DNS server or displaying a reply from the server. If you'd
like to turn off the IDN support for some reason, use parameters
``+noidnin`` and ``+noidnout`` or define the IDN_DISABLE environment
variable.
Files
~~~~~
``/etc/resolv.conf``
``${HOME}/.digrc``
See Also
~~~~~~~~
:manpage:`delv(1)`, :manpage:`host(1)`, :manpage:`named(8)`, :manpage:`dnssec-keygen(8)`, :rfc:`1035`.
Bugs
~~~~
There are probably too many query options.

File diff suppressed because it is too large Load Diff

View File

@@ -1,273 +0,0 @@
.\" Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: host
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2009-01-20
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "HOST" "1" "2009\-01\-20" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
host \- DNS lookup utility
.SH "SYNOPSIS"
.HP \w'\fBhost\fR\ 'u
\fBhost\fR [\fB\-aACdlnrsTUwv\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-N\ \fR\fB\fIndots\fR\fR] [\fB\-R\ \fR\fB\fInumber\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-W\ \fR\fB\fIwait\fR\fR] [\fB\-m\ \fR\fB\fIflag\fR\fR] [[\fB\-4\fR] | [\fB\-6\fR]] [\fB\-v\fR] [\fB\-V\fR] {name} [server]
.SH "DESCRIPTION"
.PP
\fBhost\fR
is a simple utility for performing DNS lookups\&. It is normally used to convert names to IP addresses and vice versa\&. When no arguments or options are given,
\fBhost\fR
prints a short summary of its command line arguments and options\&.
.PP
\fIname\fR
is the domain name that is to be looked up\&. It can also be a dotted\-decimal IPv4 address or a colon\-delimited IPv6 address, in which case
\fBhost\fR
will by default perform a reverse lookup for that address\&.
\fIserver\fR
is an optional argument which is either the name or IP address of the name server that
\fBhost\fR
should query instead of the server or servers listed in
/etc/resolv\&.conf\&.
.SH "OPTIONS"
.PP
\-4
.RS 4
Use IPv4 only for query transport\&. See also the
\fB\-6\fR
option\&.
.RE
.PP
\-6
.RS 4
Use IPv6 only for query transport\&. See also the
\fB\-4\fR
option\&.
.RE
.PP
\-a
.RS 4
"All"\&. The
\fB\-a\fR
option is normally equivalent to
\fB\-v \-t \fR\fBANY\fR\&. It also affects the behaviour of the
\fB\-l\fR
list zone option\&.
.RE
.PP
\-A
.RS 4
"Almost all"\&. The
\fB\-A\fR
option is equivalent to
\fB\-a\fR
except RRSIG, NSEC, and NSEC3 records are omitted from the output\&.
.RE
.PP
\-c \fIclass\fR
.RS 4
Query class: This can be used to lookup HS (Hesiod) or CH (Chaosnet) class resource records\&. The default class is IN (Internet)\&.
.RE
.PP
\-C
.RS 4
Check consistency:
\fBhost\fR
will query the SOA records for zone
\fIname\fR
from all the listed authoritative name servers for that zone\&. The list of name servers is defined by the NS records that are found for the zone\&.
.RE
.PP
\-d
.RS 4
Print debugging traces\&. Equivalent to the
\fB\-v\fR
verbose option\&.
.RE
.PP
\-l
.RS 4
List zone: The
\fBhost\fR
command performs a zone transfer of zone
\fIname\fR
and prints out the NS, PTR and address records (A/AAAA)\&.
.sp
Together, the
\fB\-l \-a\fR
options print all records in the zone\&.
.RE
.PP
\-N \fIndots\fR
.RS 4
The number of dots that have to be in
\fIname\fR
for it to be considered absolute\&. The default value is that defined using the ndots statement in
/etc/resolv\&.conf, or 1 if no ndots statement is present\&. Names with fewer dots are interpreted as relative names and will be searched for in the domains listed in the
\fBsearch\fR
or
\fBdomain\fR
directive in
/etc/resolv\&.conf\&.
.RE
.PP
\-r
.RS 4
Non\-recursive query: Setting this option clears the RD (recursion desired) bit in the query\&. This should mean that the name server receiving the query will not attempt to resolve
\fIname\fR\&. The
\fB\-r\fR
option enables
\fBhost\fR
to mimic the behavior of a name server by making non\-recursive queries and expecting to receive answers to those queries that can be referrals to other name servers\&.
.RE
.PP
\-R \fInumber\fR
.RS 4
Number of retries for UDP queries: If
\fInumber\fR
is negative or zero, the number of retries will default to 1\&. The default value is 1, or the value of the
\fIattempts\fR
option in
/etc/resolv\&.conf, if set\&.
.RE
.PP
\-s
.RS 4
Do
\fInot\fR
send the query to the next nameserver if any server responds with a SERVFAIL response, which is the reverse of normal stub resolver behavior\&.
.RE
.PP
\-t \fItype\fR
.RS 4
Query type: The
\fItype\fR
argument can be any recognized query type: CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc\&.
.sp
When no query type is specified,
\fBhost\fR
automatically selects an appropriate query type\&. By default, it looks for A, AAAA, and MX records\&. If the
\fB\-C\fR
option is given, queries will be made for SOA records\&. If
\fIname\fR
is a dotted\-decimal IPv4 address or colon\-delimited IPv6 address,
\fBhost\fR
will query for PTR records\&.
.sp
If a query type of IXFR is chosen the starting serial number can be specified by appending an equal followed by the starting serial number (like
\fB\-t \fR\fBIXFR=12345678\fR)\&.
.RE
.PP
\-T, \-U
.RS 4
TCP/UDP: By default,
\fBhost\fR
uses UDP when making queries\&. The
\fB\-T\fR
option makes it use a TCP connection when querying the name server\&. TCP will be automatically selected for queries that require it, such as zone transfer (AXFR) requests\&. Type ANY queries default to TCP but can be forced to UDP initially using
\fB\-U\fR\&.
.RE
.PP
\-m \fIflag\fR
.RS 4
Memory usage debugging: the flag can be
\fIrecord\fR,
\fIusage\fR, or
\fItrace\fR\&. You can specify the
\fB\-m\fR
option more than once to set multiple flags\&.
.RE
.PP
\-v
.RS 4
Verbose output\&. Equivalent to the
\fB\-d\fR
debug option\&. Verbose output can also be enabled by setting the
\fIdebug\fR
option in
/etc/resolv\&.conf\&.
.RE
.PP
\-V
.RS 4
Print the version number and exit\&.
.RE
.PP
\-w
.RS 4
Wait forever: The query timeout is set to the maximum possible\&. See also the
\fB\-W\fR
option\&.
.RE
.PP
\-W \fIwait\fR
.RS 4
Timeout: Wait for up to
\fIwait\fR
seconds for a reply\&. If
\fIwait\fR
is less than one, the wait interval is set to one second\&.
.sp
By default,
\fBhost\fR
will wait for 5 seconds for UDP responses and 10 seconds for TCP connections\&. These defaults can be overridden by the
\fItimeout\fR
option in
/etc/resolv\&.conf\&.
.sp
See also the
\fB\-w\fR
option\&.
.RE
.SH "IDN SUPPORT"
.PP
If
\fBhost\fR
has been built with IDN (internationalized domain name) support, it can accept and display non\-ASCII domain names\&.
\fBhost\fR
appropriately converts character encoding of domain name before sending a request to DNS server or displaying a reply from the server\&. If you\*(Aqd like to turn off the IDN support for some reason, define the
\fBIDN_DISABLE\fR
environment variable\&. The IDN support is disabled if the variable is set when
\fBhost\fR
runs\&.
.SH "FILES"
.PP
/etc/resolv\&.conf
.SH "SEE ALSO"
.PP
\fBdig\fR(1),
\fBnamed\fR(8)\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2000-2002, 2004, 2005, 2007-2009, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -12,21 +12,21 @@
/*! \file */
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#endif /* ifdef HAVE_LOCALE_H */
#include <isc/app.h>
#include <isc/commandline.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <dns/fixedname.h>
@@ -35,8 +35,8 @@
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatatype.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dig/dig.h>
@@ -49,83 +49,56 @@ static dns_rdatatype_t list_type = dns_rdatatype_a;
static bool printed_server = false;
static bool ipv4only = false, ipv6only = false;
static const char *opcodetext[] = {
"QUERY",
"IQUERY",
"STATUS",
"RESERVED3",
"NOTIFY",
"UPDATE",
"RESERVED6",
"RESERVED7",
"RESERVED8",
"RESERVED9",
"RESERVED10",
"RESERVED11",
"RESERVED12",
"RESERVED13",
"RESERVED14",
"RESERVED15"
};
static const char *opcodetext[] = { "QUERY", "IQUERY", "STATUS",
"RESERVED3", "NOTIFY", "UPDATE",
"RESERVED6", "RESERVED7", "RESERVED8",
"RESERVED9", "RESERVED10", "RESERVED11",
"RESERVED12", "RESERVED13", "RESERVED14",
"RESERVED15" };
static const char *rcodetext[] = {
"NOERROR",
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"REFUSED",
"YXDOMAIN",
"YXRRSET",
"NXRRSET",
"NOTAUTH",
"NOTZONE",
"RESERVED11",
"RESERVED12",
"RESERVED13",
"RESERVED14",
"RESERVED15",
"BADVERS"
};
static const char *rcodetext[] = { "NOERROR", "FORMERR", "SERVFAIL",
"NXDOMAIN", "NOTIMP", "REFUSED",
"YXDOMAIN", "YXRRSET", "NXRRSET",
"NOTAUTH", "NOTZONE", "RESERVED11",
"RESERVED12", "RESERVED13", "RESERVED14",
"RESERVED15", "BADVERS" };
struct rtype {
unsigned int type;
const char *text;
};
struct rtype rtypes[] = {
{ 1, "has address" },
{ 2, "name server" },
{ 5, "is an alias for" },
{ 11, "has well known services" },
{ 12, "domain name pointer" },
{ 13, "host information" },
{ 15, "mail is handled by" },
{ 16, "descriptive text" },
{ 19, "x25 address" },
{ 20, "ISDN address" },
{ 24, "has signature" },
{ 25, "has key" },
{ 28, "has IPv6 address" },
{ 29, "location" },
{ 0, NULL }
};
struct rtype rtypes[] = { { 1, "has address" },
{ 2, "name server" },
{ 5, "is an alias for" },
{ 11, "has well known services" },
{ 12, "domain name pointer" },
{ 13, "host information" },
{ 15, "mail is handled by" },
{ 16, "descriptive text" },
{ 19, "x25 address" },
{ 20, "ISDN address" },
{ 24, "has signature" },
{ 25, "has key" },
{ 28, "has IPv6 address" },
{ 29, "location" },
{ 0, NULL } };
static char *
rcode_totext(dns_rcode_t rcode)
{
rcode_totext(dns_rcode_t rcode) {
static char buf[sizeof("?65535")];
union {
const char *consttext;
char *deconsttext;
} totext;
if (rcode >= (sizeof(rcodetext)/sizeof(rcodetext[0]))) {
if (rcode >= (sizeof(rcodetext) / sizeof(rcodetext[0]))) {
snprintf(buf, sizeof(buf), "?%u", rcode);
totext.deconsttext = buf;
} else
} else {
totext.consttext = rcodetext[rcode];
return totext.deconsttext;
}
return (totext.deconsttext);
}
ISC_PLATFORM_NORETURN_PRE static void
@@ -133,35 +106,38 @@ show_usage(void) ISC_PLATFORM_NORETURN_POST;
static void
show_usage(void) {
fputs(
"Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W time]\n"
" [-R number] [-m flag] hostname [server]\n"
" -a is equivalent to -v -t ANY\n"
" -A is like -a but omits RRSIG, NSEC, NSEC3\n"
" -c specifies query class for non-IN data\n"
" -C compares SOA records on authoritative nameservers\n"
" -d is equivalent to -v\n"
" -l lists all hosts in a domain, using AXFR\n"
" -m set memory debugging flag (trace|record|usage)\n"
" -N changes the number of dots allowed before root lookup is done\n"
" -r disables recursive processing\n"
" -R specifies number of retries for UDP packets\n"
" -s a SERVFAIL response should stop query\n"
" -t specifies the query type\n"
" -T enables TCP/IP mode\n"
" -U enables UDP mode\n"
" -v enables verbose output\n"
" -V print version number and exit\n"
" -w specifies to wait forever for a reply\n"
" -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n", stderr);
fputs("Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W "
"time]\n"
" [-R number] [-m flag] [-p port] hostname [server]\n"
" -a is equivalent to -v -t ANY\n"
" -A is like -a but omits RRSIG, NSEC, NSEC3\n"
" -c specifies query class for non-IN data\n"
" -C compares SOA records on authoritative nameservers\n"
" -d is equivalent to -v\n"
" -l lists all hosts in a domain, using AXFR\n"
" -m set memory debugging flag (trace|record|usage)\n"
" -N changes the number of dots allowed before root lookup "
"is done\n"
" -p specifies the port on the server to query\n"
" -r disables recursive processing\n"
" -R specifies number of retries for UDP packets\n"
" -s a SERVFAIL response should stop query\n"
" -t specifies the query type\n"
" -T enables TCP/IP mode\n"
" -U enables UDP mode\n"
" -v enables verbose output\n"
" -V print version number and exit\n"
" -w specifies to wait forever for a reply\n"
" -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n",
stderr);
exit(1);
}
static void
host_shutdown(void) {
(void) isc_app_shutdown();
(void)isc_app_shutdown();
}
static void
@@ -173,9 +149,9 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
char fromtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(from, fromtext, sizeof(fromtext));
TIME_NOW(&now);
diff = (int) isc_time_microdiff(&now, &query->time_sent);
printf("Received %u bytes from %s in %d ms\n",
bytes, fromtext, diff/1000);
diff = (int)isc_time_microdiff(&now, &query->time_sent);
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
diff / 1000);
}
}
@@ -183,14 +159,14 @@ static void
trying(char *frm, dig_lookup_t *lookup) {
UNUSED(lookup);
if (!short_form)
if (!short_form) {
printf("Trying \"%s\"\n", frm);
}
}
static void
say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
dig_query_t *query)
{
dig_query_t *query) {
isc_buffer_t *b = NULL;
char namestr[DNS_NAME_FORMATSIZE];
isc_region_t r;
@@ -198,7 +174,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
unsigned int bufsize = BUFSIZ;
dns_name_format(name, namestr, sizeof(namestr));
retry:
retry:
isc_buffer_allocate(mctx, &b, bufsize);
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_NOSPACE) {
@@ -209,11 +185,9 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
check_result(result, "dns_rdata_totext");
isc_buffer_usedregion(b, &r);
if (query->lookup->identify_previous_line) {
printf("Nameserver %s:\n\t",
query->servname);
printf("Nameserver %s:\n\t", query->servname);
}
printf("%s %s %.*s", namestr,
msg, (int)r.length, (char *)r.base);
printf("%s %s %.*s", namestr, msg, (int)r.length, (char *)r.base);
if (query->lookup->identify) {
printf(" on server %s", query->servname);
}
@@ -223,9 +197,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
static isc_result_t
printsection(dns_message_t *msg, dns_section_t sectionid,
const char *section_name, bool headers,
dig_query_t *query)
{
const char *section_name, bool headers, dig_query_t *query) {
dns_name_t *name, *print_name;
dns_rdataset_t *rdataset;
dns_rdata_t rdata = DNS_RDATA_INIT;
@@ -237,21 +209,24 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
bool first;
bool no_rdata;
if (sectionid == DNS_SECTION_QUESTION)
if (sectionid == DNS_SECTION_QUESTION) {
no_rdata = true;
else
} else {
no_rdata = false;
}
if (headers)
if (headers) {
printf(";; %s SECTION:\n", section_name);
}
dns_name_init(&empty_name, NULL);
result = dns_message_firstname(msg, sectionid);
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
else if (result != ISC_R_SUCCESS)
} else if (result != ISC_R_SUCCESS) {
return (result);
}
for (;;) {
name = NULL;
@@ -261,9 +236,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
first = true;
print_name = name;
for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) {
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
{
if (query->lookup->rdtype == dns_rdatatype_axfr &&
!((!list_addresses &&
(list_type == dns_rdatatype_any ||
@@ -273,36 +248,39 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
rdataset->type == dns_rdatatype_aaaa ||
rdataset->type == dns_rdatatype_ns ||
rdataset->type == dns_rdatatype_ptr))))
{
continue;
}
if (list_almost_all &&
(rdataset->type == dns_rdatatype_rrsig ||
rdataset->type == dns_rdatatype_nsec ||
rdataset->type == dns_rdatatype_nsec3))
(rdataset->type == dns_rdatatype_rrsig ||
rdataset->type == dns_rdatatype_nsec ||
rdataset->type == dns_rdatatype_nsec3))
{
continue;
}
if (!short_form) {
result = dns_rdataset_totext(rdataset,
print_name,
false,
no_rdata,
&target);
if (result != ISC_R_SUCCESS)
print_name, false,
no_rdata, &target);
if (result != ISC_R_SUCCESS) {
return (result);
}
#ifdef USEINITALWS
if (first) {
print_name = &empty_name;
first = false;
}
#else
#else /* ifdef USEINITALWS */
UNUSED(first); /* Shut up compiler. */
#endif
#endif /* ifdef USEINITALWS */
} else {
loopresult = dns_rdataset_first(rdataset);
while (loopresult == ISC_R_SUCCESS) {
struct rtype *t;
const char *rtt;
char typebuf[DNS_RDATATYPE_FORMATSIZE];
char typebuf2[DNS_RDATATYPE_FORMATSIZE
+ 20];
char typebuf2[DNS_RDATATYPE_FORMATSIZE +
20];
dns_rdataset_current(rdataset, &rdata);
for (t = rtypes; t->text != NULL; t++) {
@@ -319,8 +297,8 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
"has %s record", typebuf);
rtt = typebuf2;
found:
say_message(print_name, rtt,
&rdata, query);
say_message(print_name, rtt, &rdata,
query);
dns_rdata_reset(&rdata);
loopresult =
dns_rdataset_next(rdataset);
@@ -329,18 +307,19 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
}
if (!short_form) {
isc_buffer_usedregion(&target, &r);
if (no_rdata)
printf(";%.*s", (int)r.length,
(char *)r.base);
else
if (no_rdata) {
printf(";%.*s", (int)r.length, (char *)r.base);
} else {
printf("%.*s", (int)r.length, (char *)r.base);
}
}
result = dns_message_nextname(msg, sectionid);
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
break;
else if (result != ISC_R_SUCCESS)
} else if (result != ISC_R_SUCCESS) {
return (result);
}
}
return (ISC_R_SUCCESS);
@@ -348,24 +327,23 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
static isc_result_t
printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
const dns_name_t *owner, const char *set_name,
bool headers)
{
const dns_name_t *owner, const char *set_name, bool headers) {
isc_buffer_t target;
isc_result_t result;
isc_region_t r;
char tbuf[4096];
UNUSED(msg);
if (headers)
if (headers) {
printf(";; %s SECTION:\n", set_name);
}
isc_buffer_init(&target, tbuf, sizeof(tbuf));
result = dns_rdataset_totext(rdataset, owner, false, false,
&target);
if (result != ISC_R_SUCCESS)
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
if (result != ISC_R_SUCCESS) {
return (result);
}
isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base);
@@ -385,8 +363,9 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
dns_rdatatype_cname, 0, NULL,
&rdataset);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return;
}
result = dns_rdataset_first(rdataset);
check_result(result, "dns_rdataset_first");
dns_rdata_reset(&rdata);
@@ -399,9 +378,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
}
static isc_result_t
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
dns_message_t *msg, bool headers)
{
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
bool headers) {
bool did_flag = false;
dns_rdataset_t *opt, *tsig = NULL;
const dns_name_t *tsigname;
@@ -422,8 +400,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
printf("Using domain server:\n");
printf("Name: %s\n", query->userarg);
isc_sockaddr_format(&query->sockaddr, sockstr,
sizeof(sockstr));
isc_sockaddr_format(&query->sockaddr, sockstr, sizeof(sockstr));
printf("Address: %s\n", sockstr);
printf("Aliases: \n\n");
printed_server = true;
@@ -433,17 +410,20 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
char namestr[DNS_NAME_FORMATSIZE];
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
if (query->lookup->identify_previous_line)
if (query->lookup->identify_previous_line) {
printf("Nameserver %s:\n\t%s not found: %d(%s)\n",
query->servname,
(msg->rcode != dns_rcode_nxdomain) ? namestr :
query->lookup->textname, msg->rcode,
rcode_totext(msg->rcode));
else
(msg->rcode != dns_rcode_nxdomain)
? namestr
: query->lookup->textname,
msg->rcode, rcode_totext(msg->rcode));
} else {
printf("Host %s not found: %d(%s)\n",
(msg->rcode != dns_rcode_nxdomain) ? namestr :
query->lookup->textname, msg->rcode,
rcode_totext(msg->rcode));
(msg->rcode != dns_rcode_nxdomain)
? namestr
: query->lookup->textname,
msg->rcode, rcode_totext(msg->rcode));
}
return (ISC_R_SUCCESS);
}
@@ -521,60 +501,70 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
msg->counts[DNS_SECTION_AUTHORITY],
msg->counts[DNS_SECTION_ADDITIONAL]);
opt = dns_message_getopt(msg);
if (opt != NULL)
if (opt != NULL) {
printf(";; EDNS: version: %u, udp=%u\n",
(unsigned int)((opt->ttl & 0x00ff0000) >> 16),
(unsigned int)opt->rdclass);
}
tsigname = NULL;
tsig = dns_message_gettsig(msg, &tsigname);
if (tsig != NULL)
if (tsig != NULL) {
printf(";; PSEUDOSECTIONS: TSIG\n");
}
}
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) &&
!short_form) {
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) && !short_form)
{
printf("\n");
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
true, query);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
if (!short_form)
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
if (!short_form) {
printf("\n");
}
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
!short_form, query);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
!short_form) {
printf("\n");
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
true, query);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
!short_form) {
printf("\n");
result = printsection(msg, DNS_SECTION_ADDITIONAL,
"ADDITIONAL", true, query);
if (result != ISC_R_SUCCESS)
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if ((tsig != NULL) && !short_form) {
printf("\n");
result = printrdata(msg, tsig, tsigname,
"PSEUDOSECTION TSIG", true);
if (result != ISC_R_SUCCESS)
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
true);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (!short_form)
if (!short_form) {
printf("\n");
}
if (short_form && !default_lookups &&
ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER]))
{
char namestr[DNS_NAME_FORMATSIZE];
char typestr[DNS_RDATATYPE_FORMATSIZE];
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
@@ -586,7 +576,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
return (result);
}
static const char * optstring = "46aAc:dilnm:rst:vVwCDN:R:TUW:";
static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
/*% version */
static void
@@ -603,52 +593,77 @@ pre_parse_args(int argc, char **argv) {
case 'm':
memdebugging = true;
if (strcasecmp("trace", isc_commandline_argument) == 0)
{
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
else if (strcasecmp("record",
isc_commandline_argument) == 0)
} else if (strcasecmp("record",
isc_commandline_argument) == 0) {
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
else if (strcasecmp("usage",
isc_commandline_argument) == 0)
} else if (strcasecmp("usage",
isc_commandline_argument) == 0) {
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
}
break;
case '4':
if (ipv6only)
if (ipv6only) {
fatal("only one of -4 and -6 allowed");
}
ipv4only = true;
break;
case '6':
if (ipv4only)
if (ipv4only) {
fatal("only one of -4 and -6 allowed");
}
ipv6only = true;
break;
case 'a': break;
case 'A': break;
case 'c': break;
case 'C': break;
case 'd': break;
case 'a':
break;
case 'A':
break;
case 'c':
break;
case 'C':
break;
case 'd':
break;
case 'D':
if (debugging)
if (debugging) {
debugtiming = true;
}
debugging = true;
break;
case 'i': break;
case 'l': break;
case 'n': break;
case 'N': break;
case 'r': break;
case 'R': break;
case 's': break;
case 't': break;
case 'T': break;
case 'U': break;
case 'v': break;
case 'i':
break;
case 'l':
break;
case 'n':
break;
case 'N':
break;
case 'p':
break;
case 'r':
break;
case 'R':
break;
case 's':
break;
case 't':
break;
case 'T':
break;
case 'U':
break;
case 'v':
break;
case 'V':
version();
exit(0);
break;
case 'w': break;
case 'W': break;
version();
exit(0);
break;
case 'w':
break;
case 'W':
break;
default:
show_usage();
}
@@ -674,6 +689,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
lookup = make_empty_lookup();
lookup->servfail_stops = false;
lookup->besteffort = false;
lookup->comments = false;
short_form = !verbose;
@@ -693,8 +709,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
lookup->recurse = false;
break;
case 't':
if (strncasecmp(isc_commandline_argument,
"ixfr=", 5) == 0) {
if (strncasecmp(isc_commandline_argument, "ixfr=", 5) ==
0) {
rdtype = dns_rdatatype_ixfr;
/* XXXMPA add error checking */
serial = strtoul(isc_commandline_argument + 5,
@@ -703,8 +719,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
} else {
tr.base = isc_commandline_argument;
tr.length = strlen(isc_commandline_argument);
result = dns_rdatatype_fromtext(&rdtype,
(isc_textregion_t *)&tr);
result = dns_rdatatype_fromtext(
&rdtype, (isc_textregion_t *)&tr);
}
if (result != ISC_R_SUCCESS) {
@@ -713,8 +729,9 @@ parse_args(bool is_batchfile, int argc, char **argv) {
isc_commandline_argument);
}
if (!lookup->rdtypeset ||
lookup->rdtype != dns_rdatatype_axfr)
lookup->rdtype != dns_rdatatype_axfr) {
lookup->rdtype = rdtype;
}
lookup->rdtypeset = true;
if (rdtype == dns_rdatatype_axfr) {
/* -l -t any -v */
@@ -726,18 +743,20 @@ parse_args(bool is_batchfile, int argc, char **argv) {
lookup->tcp_mode = true;
list_type = rdtype;
} else if (rdtype == dns_rdatatype_any) {
if (!lookup->tcp_mode_set)
if (!lookup->tcp_mode_set) {
lookup->tcp_mode = true;
} else
}
} else {
list_type = rdtype;
}
list_addresses = false;
default_lookups = false;
break;
case 'c':
tr.base = isc_commandline_argument;
tr.length = strlen(isc_commandline_argument);
result = dns_rdataclass_fromtext(&rdclass,
(isc_textregion_t *)&tr);
result = dns_rdataclass_fromtext(
&rdclass, (isc_textregion_t *)&tr);
if (result != ISC_R_SUCCESS) {
fatalexit = 2;
@@ -751,11 +770,12 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 'A':
list_almost_all = true;
/* FALL THROUGH */
/* FALL THROUGH */
case 'a':
if (!lookup->rdtypeset ||
lookup->rdtype != dns_rdatatype_axfr)
lookup->rdtype != dns_rdatatype_axfr) {
lookup->rdtype = dns_rdatatype_any;
}
list_type = dns_rdatatype_any;
list_addresses = false;
lookup->rdtypeset = true;
@@ -780,13 +800,15 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 'W':
timeout = atoi(isc_commandline_argument);
if (timeout < 1)
if (timeout < 1) {
timeout = 1;
}
break;
case 'R':
tries = atoi(isc_commandline_argument) + 1;
if (tries < 2)
if (tries < 2) {
tries = 2;
}
break;
case 'T':
lookup->tcp_mode = true;
@@ -808,8 +830,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
default_lookups = false;
break;
case 'N':
debug("setting NDOTS to %s",
isc_commandline_argument);
debug("setting NDOTS to %s", isc_commandline_argument);
ndots = atoi(isc_commandline_argument);
break;
case 'D':
@@ -824,26 +845,31 @@ parse_args(bool is_batchfile, int argc, char **argv) {
case 's':
lookup->servfail_stops = true;
break;
case 'p':
port = atoi(isc_commandline_argument);
break;
}
}
lookup->retries = tries;
if (isc_commandline_index >= argc)
if (isc_commandline_index >= argc) {
show_usage();
}
strlcpy(hostname, argv[isc_commandline_index], sizeof(hostname));
if (argc > isc_commandline_index + 1) {
set_nameserver(argv[isc_commandline_index+1]);
debug("server is %s", argv[isc_commandline_index+1]);
set_nameserver(argv[isc_commandline_index + 1]);
debug("server is %s", argv[isc_commandline_index + 1]);
listed_server = true;
} else
} else {
check_ra = true;
}
lookup->pending = false;
if (get_reverse(store, sizeof(store), hostname, true)
== ISC_R_SUCCESS) {
if (get_reverse(store, sizeof(store), hostname, true) == ISC_R_SUCCESS)
{
strlcpy(lookup->textname, store, sizeof(lookup->textname));
lookup->rdtype = dns_rdatatype_ptr;
lookup->rdtypeset = true;
@@ -882,10 +908,11 @@ main(int argc, char **argv) {
setup_libs();
setup_system(ipv4only, ipv6only);
parse_args(false, argc, argv);
if (keyfile[0] != 0)
if (keyfile[0] != 0) {
setup_file_key();
else if (keysecret[0] != 0)
} else if (keysecret[0] != 0) {
setup_text_key();
}
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
check_result(result, "isc_app_onrun");
isc_app_run();

View File

@@ -1,406 +0,0 @@
<!DOCTYPE book [
<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.host">
<info>
<date>2009-01-20</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle>host</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname>host</refname>
<refpurpose>DNS lookup utility</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2000</year>
<year>2001</year>
<year>2002</year>
<year>2004</year>
<year>2005</year>
<year>2007</year>
<year>2008</year>
<year>2009</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2017</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>host</command>
<arg choice="opt" rep="norepeat"><option>-aACdlnrsTUwv</option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-N <replaceable class="parameter">ndots</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-R <replaceable class="parameter">number</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-W <replaceable class="parameter">wait</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-m <replaceable class="parameter">flag</replaceable></option></arg>
<group choice="opt" rep="norepeat">
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
</group>
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
<arg choice="opt" rep="norepeat"><option>-V</option></arg>
<arg choice="req" rep="norepeat">name</arg>
<arg choice="opt" rep="norepeat">server</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>host</command>
is a simple utility for performing DNS lookups.
It is normally used to convert names to IP addresses and vice versa.
When no arguments or options are given,
<command>host</command>
prints a short summary of its command line arguments and options.
</para>
<para><parameter>name</parameter> is the domain name that is to be
looked
up. It can also be a dotted-decimal IPv4 address or a colon-delimited
IPv6 address, in which case <command>host</command> will by
default
perform a reverse lookup for that address.
<parameter>server</parameter> is an optional argument which
is either
the name or IP address of the name server that <command>host</command>
should query instead of the server or servers listed in
<filename>/etc/resolv.conf</filename>.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-4</term>
<listitem>
<para>
Use IPv4 only for query transport.
See also the <option>-6</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-6</term>
<listitem>
<para>
Use IPv6 only for query transport.
See also the <option>-4</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-a</term>
<listitem>
<para>
"All". The <option>-a</option> option is normally equivalent
to <option>-v -t <literal>ANY</literal></option>.
It also affects the behaviour of the <option>-l</option>
list zone option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-A</term>
<listitem>
<para>
"Almost all". The <option>-A</option> option is equivalent
to <option>-a</option> except RRSIG, NSEC, and NSEC3
records are omitted from the output.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c <replaceable class="parameter">class</replaceable></term>
<listitem>
<para>
Query class: This can be used to lookup HS (Hesiod) or CH
(Chaosnet) class resource records. The default class is IN
(Internet).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-C</term>
<listitem>
<para>
Check consistency: <command>host</command> will query the
SOA records for zone <parameter>name</parameter> from all
the listed authoritative name servers for that zone. The
list of name servers is defined by the NS records that are
found for the zone.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d</term>
<listitem>
<para>
Print debugging traces.
Equivalent to the <option>-v</option> verbose option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-l</term>
<listitem>
<para>
List zone:
The <command>host</command> command performs a zone transfer of
zone <parameter>name</parameter> and prints out the NS,
PTR and address records (A/AAAA).
</para>
<para>
Together, the <option>-l -a</option>
options print all records in the zone.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-N <replaceable class="parameter">ndots</replaceable></term>
<listitem>
<para>
The number of dots that have to be
in <parameter>name</parameter> for it to be considered
absolute. The default value is that defined using the
ndots statement in <filename>/etc/resolv.conf</filename>,
or 1 if no ndots statement is present. Names with fewer
dots are interpreted as relative names and will be
searched for in the domains listed in
the <type>search</type> or <type>domain</type> directive
in <filename>/etc/resolv.conf</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-r</term>
<listitem>
<para>
Non-recursive query:
Setting this option clears the RD (recursion desired) bit
in the query. This should mean that the name server
receiving the query will not attempt to
resolve <parameter>name</parameter>.
The <option>-r</option> option
enables <command>host</command> to mimic the behavior of a
name server by making non-recursive queries and expecting
to receive answers to those queries that can be
referrals to other name servers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-R <replaceable class="parameter">number</replaceable></term>
<listitem>
<para>
Number of retries for UDP queries:
If <parameter>number</parameter> is negative or zero, the
number of retries will default to 1. The default value is
1, or the value of the <parameter>attempts</parameter>
option in <filename>/etc/resolv.conf</filename>, if set.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s</term>
<listitem>
<para>
Do <emphasis>not</emphasis> send the query to the next
nameserver if any server responds with a SERVFAIL
response, which is the reverse of normal stub resolver
behavior.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">type</replaceable></term>
<listitem>
<para>
Query type:
The <parameter>type</parameter> argument can be any
recognized query type: CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
</para>
<para>
When no query type is specified, <command>host</command>
automatically selects an appropriate query type. By default, it
looks for A, AAAA, and MX records.
If the <option>-C</option> option is given, queries will
be made for SOA records.
If <parameter>name</parameter> is a dotted-decimal IPv4
address or colon-delimited IPv6
address, <command>host</command> will query for PTR
records.
</para>
<para>
If a query type of IXFR is chosen the starting serial
number can be specified by appending an equal followed by
the starting serial number
(like <option>-t <literal>IXFR=12345678</literal></option>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-T</term>
<term>-U</term>
<listitem>
<para>
TCP/UDP:
By default, <command>host</command> uses UDP when making
queries. The <option>-T</option> option makes it use a TCP
connection when querying the name server. TCP will be
automatically selected for queries that require it, such
as zone transfer (AXFR) requests. Type ANY queries default
to TCP but can be forced to UDP initially using <option>-U</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-m <replaceable class="parameter">flag</replaceable></term>
<listitem>
<para>
Memory usage debugging: the flag can
be <parameter>record</parameter>, <parameter>usage</parameter>,
or <parameter>trace</parameter>. You can specify
the <option>-m</option> option more than once to set
multiple flags.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v</term>
<listitem>
<para>
Verbose output.
Equivalent to the <option>-d</option> debug option.
Verbose output can also be enabled by setting
the <parameter>debug</parameter> option
in <filename>/etc/resolv.conf</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-V</term>
<listitem>
<para>
Print the version number and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-w</term>
<listitem>
<para>
Wait forever: The query timeout is set to the maximum possible.
See also the <option>-W</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-W <replaceable class="parameter">wait</replaceable></term>
<listitem>
<para>
Timeout: Wait for up to <parameter>wait</parameter>
seconds for a reply. If <parameter>wait</parameter> is
less than one, the wait interval is set to one second.
</para>
<para>
By default, <command>host</command> will wait for 5
seconds for UDP responses and 10 seconds for TCP
connections. These defaults can be overridden by
the <parameter>timeout</parameter> option
in <filename>/etc/resolv.conf</filename>.
</para>
<para>
See also the <option>-w</option> option.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>IDN SUPPORT</title></info>
<para>
If <command>host</command> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
<command>host</command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
If you'd like to turn off the IDN support for some reason, define
the <envar>IDN_DISABLE</envar> environment variable.
The IDN support is disabled if the variable is set when
<command>host</command> runs.
</para>
</refsection>
<refsection><info><title>FILES</title></info>
<para><filename>/etc/resolv.conf</filename>
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>dig</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>.
</para>
</refsection>
</refentry>

View File

@@ -1,332 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>host</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.host"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
host
&#8212; DNS lookup utility
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">host</code>
[<code class="option">-aACdlnrsTUwv</code>]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-N <em class="replaceable"><code>ndots</code></em></code>]
[<code class="option">-R <em class="replaceable"><code>number</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>type</code></em></code>]
[<code class="option">-W <em class="replaceable"><code>wait</code></em></code>]
[<code class="option">-m <em class="replaceable"><code>flag</code></em></code>]
[
[<code class="option">-4</code>]
| [<code class="option">-6</code>]
]
[<code class="option">-v</code>]
[<code class="option">-V</code>]
{name}
[server]
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p><span class="command"><strong>host</strong></span>
is a simple utility for performing DNS lookups.
It is normally used to convert names to IP addresses and vice versa.
When no arguments or options are given,
<span class="command"><strong>host</strong></span>
prints a short summary of its command line arguments and options.
</p>
<p><em class="parameter"><code>name</code></em> is the domain name that is to be
looked
up. It can also be a dotted-decimal IPv4 address or a colon-delimited
IPv6 address, in which case <span class="command"><strong>host</strong></span> will by
default
perform a reverse lookup for that address.
<em class="parameter"><code>server</code></em> is an optional argument which
is either
the name or IP address of the name server that <span class="command"><strong>host</strong></span>
should query instead of the server or servers listed in
<code class="filename">/etc/resolv.conf</code>.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-4</span></dt>
<dd>
<p>
Use IPv4 only for query transport.
See also the <code class="option">-6</code> option.
</p>
</dd>
<dt><span class="term">-6</span></dt>
<dd>
<p>
Use IPv6 only for query transport.
See also the <code class="option">-4</code> option.
</p>
</dd>
<dt><span class="term">-a</span></dt>
<dd>
<p>
"All". The <code class="option">-a</code> option is normally equivalent
to <code class="option">-v -t <code class="literal">ANY</code></code>.
It also affects the behaviour of the <code class="option">-l</code>
list zone option.
</p>
</dd>
<dt><span class="term">-A</span></dt>
<dd>
<p>
"Almost all". The <code class="option">-A</code> option is equivalent
to <code class="option">-a</code> except RRSIG, NSEC, and NSEC3
records are omitted from the output.
</p>
</dd>
<dt><span class="term">-c <em class="replaceable"><code>class</code></em></span></dt>
<dd>
<p>
Query class: This can be used to lookup HS (Hesiod) or CH
(Chaosnet) class resource records. The default class is IN
(Internet).
</p>
</dd>
<dt><span class="term">-C</span></dt>
<dd>
<p>
Check consistency: <span class="command"><strong>host</strong></span> will query the
SOA records for zone <em class="parameter"><code>name</code></em> from all
the listed authoritative name servers for that zone. The
list of name servers is defined by the NS records that are
found for the zone.
</p>
</dd>
<dt><span class="term">-d</span></dt>
<dd>
<p>
Print debugging traces.
Equivalent to the <code class="option">-v</code> verbose option.
</p>
</dd>
<dt><span class="term">-l</span></dt>
<dd>
<p>
List zone:
The <span class="command"><strong>host</strong></span> command performs a zone transfer of
zone <em class="parameter"><code>name</code></em> and prints out the NS,
PTR and address records (A/AAAA).
</p>
<p>
Together, the <code class="option">-l -a</code>
options print all records in the zone.
</p>
</dd>
<dt><span class="term">-N <em class="replaceable"><code>ndots</code></em></span></dt>
<dd>
<p>
The number of dots that have to be
in <em class="parameter"><code>name</code></em> for it to be considered
absolute. The default value is that defined using the
ndots statement in <code class="filename">/etc/resolv.conf</code>,
or 1 if no ndots statement is present. Names with fewer
dots are interpreted as relative names and will be
searched for in the domains listed in
the <span class="type">search</span> or <span class="type">domain</span> directive
in <code class="filename">/etc/resolv.conf</code>.
</p>
</dd>
<dt><span class="term">-r</span></dt>
<dd>
<p>
Non-recursive query:
Setting this option clears the RD (recursion desired) bit
in the query. This should mean that the name server
receiving the query will not attempt to
resolve <em class="parameter"><code>name</code></em>.
The <code class="option">-r</code> option
enables <span class="command"><strong>host</strong></span> to mimic the behavior of a
name server by making non-recursive queries and expecting
to receive answers to those queries that can be
referrals to other name servers.
</p>
</dd>
<dt><span class="term">-R <em class="replaceable"><code>number</code></em></span></dt>
<dd>
<p>
Number of retries for UDP queries:
If <em class="parameter"><code>number</code></em> is negative or zero, the
number of retries will default to 1. The default value is
1, or the value of the <em class="parameter"><code>attempts</code></em>
option in <code class="filename">/etc/resolv.conf</code>, if set.
</p>
</dd>
<dt><span class="term">-s</span></dt>
<dd>
<p>
Do <span class="emphasis"><em>not</em></span> send the query to the next
nameserver if any server responds with a SERVFAIL
response, which is the reverse of normal stub resolver
behavior.
</p>
</dd>
<dt><span class="term">-t <em class="replaceable"><code>type</code></em></span></dt>
<dd>
<p>
Query type:
The <em class="parameter"><code>type</code></em> argument can be any
recognized query type: CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
</p>
<p>
When no query type is specified, <span class="command"><strong>host</strong></span>
automatically selects an appropriate query type. By default, it
looks for A, AAAA, and MX records.
If the <code class="option">-C</code> option is given, queries will
be made for SOA records.
If <em class="parameter"><code>name</code></em> is a dotted-decimal IPv4
address or colon-delimited IPv6
address, <span class="command"><strong>host</strong></span> will query for PTR
records.
</p>
<p>
If a query type of IXFR is chosen the starting serial
number can be specified by appending an equal followed by
the starting serial number
(like <code class="option">-t <code class="literal">IXFR=12345678</code></code>).
</p>
</dd>
<dt>
<span class="term">-T, </span><span class="term">-U</span>
</dt>
<dd>
<p>
TCP/UDP:
By default, <span class="command"><strong>host</strong></span> uses UDP when making
queries. The <code class="option">-T</code> option makes it use a TCP
connection when querying the name server. TCP will be
automatically selected for queries that require it, such
as zone transfer (AXFR) requests. Type ANY queries default
to TCP but can be forced to UDP initially using <code class="option">-U</code>.
</p>
</dd>
<dt><span class="term">-m <em class="replaceable"><code>flag</code></em></span></dt>
<dd>
<p>
Memory usage debugging: the flag can
be <em class="parameter"><code>record</code></em>, <em class="parameter"><code>usage</code></em>,
or <em class="parameter"><code>trace</code></em>. You can specify
the <code class="option">-m</code> option more than once to set
multiple flags.
</p>
</dd>
<dt><span class="term">-v</span></dt>
<dd>
<p>
Verbose output.
Equivalent to the <code class="option">-d</code> debug option.
Verbose output can also be enabled by setting
the <em class="parameter"><code>debug</code></em> option
in <code class="filename">/etc/resolv.conf</code>.
</p>
</dd>
<dt><span class="term">-V</span></dt>
<dd>
<p>
Print the version number and exit.
</p>
</dd>
<dt><span class="term">-w</span></dt>
<dd>
<p>
Wait forever: The query timeout is set to the maximum possible.
See also the <code class="option">-W</code> option.
</p>
</dd>
<dt><span class="term">-W <em class="replaceable"><code>wait</code></em></span></dt>
<dd>
<p>
Timeout: Wait for up to <em class="parameter"><code>wait</code></em>
seconds for a reply. If <em class="parameter"><code>wait</code></em> is
less than one, the wait interval is set to one second.
</p>
<p>
By default, <span class="command"><strong>host</strong></span> will wait for 5
seconds for UDP responses and 10 seconds for TCP
connections. These defaults can be overridden by
the <em class="parameter"><code>timeout</code></em> option
in <code class="filename">/etc/resolv.conf</code>.
</p>
<p>
See also the <code class="option">-w</code> option.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>IDN SUPPORT</h2>
<p>
If <span class="command"><strong>host</strong></span> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
<span class="command"><strong>host</strong></span> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
If you'd like to turn off the IDN support for some reason, define
the <code class="envar">IDN_DISABLE</code> environment variable.
The IDN support is disabled if the variable is set when
<span class="command"><strong>host</strong></span> runs.
</p>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>FILES</h2>
<p><code class="filename">/etc/resolv.conf</code>
</p>
</div>
<div class="refsection">
<a name="id-1.11"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">dig</span>(1)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>.
</p>
</div>
</div></body>
</html>

181
bin/dig/host.rst Normal file
View File

@@ -0,0 +1,181 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_host:
host - DNS lookup utility
-------------------------
Synopsis
~~~~~~~~
:program:`host` [**-aACdlnrsTUwv**] [**-c** class] [**-N** ndots] [**-p** port] [**-R** number] [**-t** type] [**-W** wait] [**-m** flag] [ [**-4**] | [**-6**] ] [**-v**] [**-V**] {name} [server]
Description
~~~~~~~~~~~
``host`` is a simple utility for performing DNS lookups. It is normally
used to convert names to IP addresses and vice versa. When no arguments
or options are given, ``host`` prints a short summary of its command
line arguments and options.
``name`` is the domain name that is to be looked up. It can also be a
dotted-decimal IPv4 address or a colon-delimited IPv6 address, in which
case ``host`` will by default perform a reverse lookup for that address.
``server`` is an optional argument which is either the name or IP
address of the name server that ``host`` should query instead of the
server or servers listed in ``/etc/resolv.conf``.
Options
~~~~~~~
**-4**
Use IPv4 only for query transport. See also the ``-6`` option.
**-6**
Use IPv6 only for query transport. See also the ``-4`` option.
**-a**
"All". The ``-a`` option is normally equivalent to ``-v -t ANY``. It
also affects the behaviour of the ``-l`` list zone option.
**-A**
"Almost all". The ``-A`` option is equivalent to ``-a`` except RRSIG,
NSEC, and NSEC3 records are omitted from the output.
**-c** class
Query class: This can be used to lookup HS (Hesiod) or CH (Chaosnet)
class resource records. The default class is IN (Internet).
**-C**
Check consistency: ``host`` will query the SOA records for zone
``name`` from all the listed authoritative name servers for that
zone. The list of name servers is defined by the NS records that are
found for the zone.
**-d**
Print debugging traces. Equivalent to the ``-v`` verbose option.
**-l**
List zone: The ``host`` command performs a zone transfer of zone
``name`` and prints out the NS, PTR and address records (A/AAAA).
Together, the ``-l -a`` options print all records in the zone.
**-N** ndots
The number of dots that have to be in ``name`` for it to be
considered absolute. The default value is that defined using the
ndots statement in ``/etc/resolv.conf``, or 1 if no ndots statement
is present. Names with fewer dots are interpreted as relative names
and will be searched for in the domains listed in the ``search`` or
``domain`` directive in ``/etc/resolv.conf``.
**-p** port
Specify the port on the server to query. The default is 53.
**-r**
Non-recursive query: Setting this option clears the RD (recursion
desired) bit in the query. This should mean that the name server
receiving the query will not attempt to resolve ``name``. The ``-r``
option enables ``host`` to mimic the behavior of a name server by
making non-recursive queries and expecting to receive answers to
those queries that can be referrals to other name servers.
**-R** number
Number of retries for UDP queries: If ``number`` is negative or zero,
the number of retries will default to 1. The default value is 1, or
the value of the ``attempts`` option in ``/etc/resolv.conf``, if set.
**-s**
Do *not* send the query to the next nameserver if any server responds
with a SERVFAIL response, which is the reverse of normal stub
resolver behavior.
**-t** type
Query type: The ``type`` argument can be any recognized query type:
CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
When no query type is specified, ``host`` automatically selects an
appropriate query type. By default, it looks for A, AAAA, and MX
records. If the ``-C`` option is given, queries will be made for SOA
records. If ``name`` is a dotted-decimal IPv4 address or
colon-delimited IPv6 address, ``host`` will query for PTR records.
If a query type of IXFR is chosen the starting serial number can be
specified by appending an equal followed by the starting serial
number (like ``-t IXFR=12345678``).
**-T**; **-U**
TCP/UDP: By default, ``host`` uses UDP when making queries. The
``-T`` option makes it use a TCP connection when querying the name
server. TCP will be automatically selected for queries that require
it, such as zone transfer (AXFR) requests. Type ANY queries default
to TCP but can be forced to UDP initially using ``-U``.
**-m** flag
Memory usage debugging: the flag can be ``record``, ``usage``, or
``trace``. You can specify the ``-m`` option more than once to set
multiple flags.
**-v**
Verbose output. Equivalent to the ``-d`` debug option. Verbose output
can also be enabled by setting the ``debug`` option in
``/etc/resolv.conf``.
**-V**
Print the version number and exit.
**-w**
Wait forever: The query timeout is set to the maximum possible. See
also the ``-W`` option.
**-W** wait
Timeout: Wait for up to ``wait`` seconds for a reply. If ``wait`` is
less than one, the wait interval is set to one second.
By default, ``host`` will wait for 5 seconds for UDP responses and 10
seconds for TCP connections. These defaults can be overridden by the
``timeout`` option in ``/etc/resolv.conf``.
See also the ``-w`` option.
IDN Support
~~~~~~~~~~~
If ``host`` has been built with IDN (internationalized domain name)
support, it can accept and display non-ASCII domain names. ``host``
appropriately converts character encoding of domain name before sending
a request to DNS server or displaying a reply from the server. If you'd
like to turn off the IDN support for some reason, define the IDN_DISABLE
environment variable. The IDN support is disabled if the variable is set
when ``host`` runs.
Files
~~~~~
``/etc/resolv.conf``
See Also
~~~~~~~~
:manpage:`dig(1)`, :manpage:`named(8)`.

View File

@@ -0,0 +1 @@
../../../.clang-format.headers

View File

@@ -17,10 +17,6 @@
#include <inttypes.h>
#include <stdbool.h>
#include <dns/rdatalist.h>
#include <dst/dst.h>
#include <isc/buffer.h>
#include <isc/bufferlist.h>
#include <isc/formatcheck.h>
@@ -32,20 +28,24 @@
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <dns/rdatalist.h>
#include <dst/dst.h>
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
#endif /* ifdef __APPLE__ */
#define MXSERV 20
#define MXNAME (DNS_NAME_MAXTEXT+1)
#define MXRD 32
#define MXNAME (DNS_NAME_MAXTEXT + 1)
#define MXRD 32
/*% Buffer Size */
#define BUFSIZE 512
#define BUFSIZE 512
#define COMMSIZE 0xffff
#ifndef RESOLV_CONF
/*% location of resolve.conf */
#define RESOLV_CONF "/etc/resolv.conf"
#endif
#endif /* ifndef RESOLV_CONF */
/*% output buffer */
#define OUTPUTBUF 32767
/*% Max RR Limit */
@@ -77,155 +77,111 @@
ISC_LANG_BEGINDECLS
typedef struct dig_lookup dig_lookup_t;
typedef struct dig_query dig_query_t;
typedef struct dig_query dig_query_t;
typedef struct dig_server dig_server_t;
typedef ISC_LIST(dig_server_t) dig_serverlist_t;
typedef struct dig_searchlist dig_searchlist_t;
#define DIG_QUERY_MAGIC ISC_MAGIC('D','i','g','q')
#define DIG_VALID_QUERY(x) ISC_MAGIC_VALID((x), DIG_QUERY_MAGIC)
#define DIG_QUERY_MAGIC ISC_MAGIC('D', 'i', 'g', 'q')
#define DIG_VALID_QUERY(x) ISC_MAGIC_VALID((x), DIG_QUERY_MAGIC)
/*% The dig_lookup structure */
struct dig_lookup {
bool
pending, /*%< Pending a successful answer */
waiting_connect,
doing_xfr,
ns_search_only, /*%< dig +nssearch, host -C */
bool pending, /*%< Pending a successful answer */
waiting_connect, doing_xfr, ns_search_only, /*%< dig
* +nssearch,
* host -C */
identify, /*%< Append an "on server <foo>" message */
identify_previous_line, /*% Prepend a "Nameserver <foo>:"
message, with newline and tab */
ignore,
recurse,
aaonly,
adflag,
cdflag,
raflag,
tcflag,
zflag,
trace, /*% dig +trace */
trace_root, /*% initial query for either +trace or +nssearch */
tcp_mode,
tcp_mode_set,
comments,
stats,
section_question,
section_answer,
section_authority,
section_additional,
servfail_stops,
new_search,
need_search,
done_as_is,
besteffort,
dnssec,
expire,
sendcookie,
seenbadcookie,
badcookie,
nsid, /*% Name Server ID (RFC 5001) */
tcp_keepalive,
header_only,
ednsneg,
mapped,
print_unknown_format,
multiline,
nottl,
noclass,
onesoa,
use_usec,
nocrypto,
ttlunits,
idnin,
idnout,
expandaaaa,
qr,
accept_reply_unexpected_src; /*% print replies from unexpected
sources. */
char textname[MXNAME]; /*% Name we're going to be looking up */
char cmdline[MXNAME];
dns_rdatatype_t rdtype;
dns_rdatatype_t qrdtype;
* message, with newline and tab */
ignore, recurse, aaonly, adflag, cdflag, raflag, tcflag, zflag,
trace, /*% dig +trace */
trace_root, /*% initial query for either +trace or +nssearch
* */
tcp_mode, tcp_mode_set, comments, stats, section_question,
section_answer, section_authority, section_additional,
servfail_stops, new_search, need_search, done_as_is, besteffort,
dnssec, expire, sendcookie, seenbadcookie, badcookie,
nsid, /*% Name Server ID (RFC 5001) */
tcp_keepalive, header_only, ednsneg, mapped,
print_unknown_format, multiline, nottl, noclass, onesoa,
use_usec, nocrypto, ttlunits, idnin, idnout, expandaaaa, qr,
accept_reply_unexpected_src; /*% print replies from
* unexpected
* sources. */
char textname[MXNAME]; /*% Name we're going to be
* looking up */
char cmdline[MXNAME];
dns_rdatatype_t rdtype;
dns_rdatatype_t qrdtype;
dns_rdataclass_t rdclass;
bool rdtypeset;
bool rdclassset;
char name_space[BUFSIZE];
char oname_space[BUFSIZE];
isc_buffer_t namebuf;
isc_buffer_t onamebuf;
isc_buffer_t renderbuf;
char *sendspace;
dns_name_t *name;
isc_interval_t interval;
dns_message_t *sendmsg;
dns_name_t *oname;
bool rdtypeset;
bool rdclassset;
char name_space[BUFSIZE];
char oname_space[BUFSIZE];
isc_buffer_t namebuf;
isc_buffer_t onamebuf;
isc_buffer_t renderbuf;
char * sendspace;
dns_name_t * name;
isc_interval_t interval;
dns_message_t * sendmsg;
dns_name_t * oname;
ISC_LINK(dig_lookup_t) link;
ISC_LIST(dig_query_t) q;
ISC_LIST(dig_query_t) connecting;
dig_query_t *current_query;
dig_serverlist_t my_server_list;
dig_query_t * current_query;
dig_serverlist_t my_server_list;
dig_searchlist_t *origin;
dig_query_t *xfr_q;
uint32_t retries;
int nsfound;
uint16_t udpsize;
int16_t edns;
int16_t padding;
uint32_t ixfr_serial;
isc_buffer_t rdatabuf;
char rdatastore[MXNAME];
dst_context_t *tsigctx;
isc_buffer_t *querysig;
uint32_t msgcounter;
dns_fixedname_t fdomain;
isc_sockaddr_t *ecs_addr;
char *cookie;
dns_ednsopt_t *ednsopts;
unsigned int ednsoptscnt;
isc_dscp_t dscp;
unsigned int ednsflags;
dns_opcode_t opcode;
int rrcomments;
unsigned int eoferr;
dig_query_t * xfr_q;
uint32_t retries;
int nsfound;
uint16_t udpsize;
int16_t edns;
int16_t padding;
uint32_t ixfr_serial;
isc_buffer_t rdatabuf;
char rdatastore[MXNAME];
dst_context_t * tsigctx;
isc_buffer_t * querysig;
uint32_t msgcounter;
dns_fixedname_t fdomain;
isc_sockaddr_t * ecs_addr;
char * cookie;
dns_ednsopt_t * ednsopts;
unsigned int ednsoptscnt;
isc_dscp_t dscp;
unsigned int ednsflags;
dns_opcode_t opcode;
int rrcomments;
unsigned int eoferr;
};
/*% The dig_query structure */
struct dig_query {
unsigned int magic;
unsigned int magic;
dig_lookup_t *lookup;
bool waiting_connect,
pending_free,
waiting_senddone,
first_pass,
first_soa_rcvd,
second_rr_rcvd,
first_repeat_rcvd,
recv_made,
warn_id,
timedout;
uint32_t first_rr_serial;
uint32_t second_rr_serial;
uint32_t msg_count;
uint32_t rr_count;
bool ixfr_axfr;
char *servname;
char *userarg;
isc_buffer_t recvbuf,
lengthbuf,
tmpsendbuf,
sendbuf;
char *recvspace, *tmpsendspace,
lengthspace[4];
bool waiting_connect, pending_free, waiting_senddone, first_pass,
first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, recv_made,
warn_id, timedout;
uint32_t first_rr_serial;
uint32_t second_rr_serial;
uint32_t msg_count;
uint32_t rr_count;
bool ixfr_axfr;
char * servname;
char * userarg;
isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf;
char * recvspace, *tmpsendspace, lengthspace[4];
isc_socket_t *sock;
ISC_LINK(dig_query_t) link;
ISC_LINK(dig_query_t) clink;
isc_sockaddr_t sockaddr;
isc_time_t time_sent;
isc_time_t time_recv;
uint64_t byte_count;
isc_timer_t *timer;
isc_time_t time_sent;
isc_time_t time_recv;
uint64_t byte_count;
isc_timer_t * timer;
};
struct dig_server {
@@ -246,38 +202,38 @@ typedef ISC_LIST(dig_lookup_t) dig_lookuplist_t;
* Externals from dighost.c
*/
extern dig_lookuplist_t lookup_list;
extern dig_serverlist_t server_list;
extern dig_lookuplist_t lookup_list;
extern dig_serverlist_t server_list;
extern dig_searchlistlist_t search_list;
extern unsigned int extrabytes;
extern unsigned int extrabytes;
extern bool check_ra, have_ipv4, have_ipv6, specified_source,
usesearch, showsearch, yaml;
extern in_port_t port;
extern unsigned int timeout;
extern isc_mem_t *mctx;
extern int sendcount;
extern int ndots;
extern int lookup_counter;
extern int exitcode;
extern isc_sockaddr_t bind_address;
extern char keynametext[MXNAME];
extern char keyfile[MXNAME];
extern char keysecret[MXNAME];
extern bool check_ra, have_ipv4, have_ipv6, specified_source, usesearch,
showsearch, yaml;
extern in_port_t port;
extern unsigned int timeout;
extern isc_mem_t * mctx;
extern int sendcount;
extern int ndots;
extern int lookup_counter;
extern int exitcode;
extern isc_sockaddr_t bind_address;
extern char keynametext[MXNAME];
extern char keyfile[MXNAME];
extern char keysecret[MXNAME];
extern const dns_name_t *hmacname;
extern unsigned int digestbits;
extern dns_tsigkey_t *tsigkey;
extern bool validated;
extern isc_taskmgr_t *taskmgr;
extern isc_task_t *global_task;
extern bool free_now;
extern bool debugging, debugtiming, memdebugging;
extern bool keep_open;
extern unsigned int digestbits;
extern dns_tsigkey_t * tsigkey;
extern bool validated;
extern isc_taskmgr_t * taskmgr;
extern isc_task_t * global_task;
extern bool free_now;
extern bool debugging, debugtiming, memdebugging;
extern bool keep_open;
extern char *progname;
extern int tries;
extern int fatalexit;
extern bool verbose;
extern int tries;
extern int fatalexit;
extern bool verbose;
/*
* Routines in dighost.c.
@@ -293,14 +249,13 @@ get_reverse(char *reverse, size_t len, char *value, bool strict);
ISC_PLATFORM_NORETURN_PRE void
fatal(const char *format, ...)
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
void
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_PLATFORM_NORETURN_PRE void
digexit(void)
ISC_PLATFORM_NORETURN_POST;
digexit(void) ISC_PLATFORM_NORETURN_POST;
void
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
@@ -333,12 +288,10 @@ void
setup_system(bool ipv4only, bool ipv6only);
isc_result_t
parse_uint(uint32_t *uip, const char *value, uint32_t max,
const char *desc);
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
isc_result_t
parse_xint(uint32_t *uip, const char *value, uint32_t max,
const char *desc);
parse_xint(uint32_t *uip, const char *value, uint32_t max, const char *desc);
isc_result_t
parse_netprefix(isc_sockaddr_t **sap, const char *value);
@@ -365,8 +318,7 @@ void
set_nameserver(char *opt);
void
clone_server_list(dig_serverlist_t src,
dig_serverlist_t *dest);
clone_server_list(dig_serverlist_t src, dig_serverlist_t *dest);
void
cancel_all(void);
@@ -381,54 +333,50 @@ set_search_domain(char *domain);
* Routines to be defined in dig.c, host.c, and nslookup.c. and
* then assigned to the appropriate function pointer
*/
extern isc_result_t
(*dighost_printmessage)(dig_query_t *query, const isc_buffer_t *msgbuf,
dns_message_t *msg, bool headers);
extern isc_result_t (*dighost_printmessage)(dig_query_t * query,
const isc_buffer_t *msgbuf,
dns_message_t *msg, bool headers);
/*
* Print an error message in the appropriate format.
*/
extern void
(*dighost_error)(const char *format, ...);
extern void (*dighost_error)(const char *format, ...);
/*
* Print a warning message in the appropriate format.
*/
extern void
(*dighost_warning)(const char *format, ...);
extern void (*dighost_warning)(const char *format, ...);
/*
* Print a comment in the appropriate format.
*/
extern void
(*dighost_comments)(dig_lookup_t *lookup, const char *format, ...);
extern void (*dighost_comments)(dig_lookup_t *lookup, const char *format, ...);
/*%<
* Print the final result of the lookup.
*/
extern void
(*dighost_received)(unsigned int bytes, isc_sockaddr_t *from,
dig_query_t *query);
extern void (*dighost_received)(unsigned int bytes, isc_sockaddr_t *from,
dig_query_t *query);
/*%<
* Print a message about where and when the response
* was received from, like the final comment in the
* output of "dig".
*/
extern void
(*dighost_trying)(char *frm, dig_lookup_t *lookup);
extern void (*dighost_trying)(char *frm, dig_lookup_t *lookup);
extern void
(*dighost_shutdown)(void);
extern void (*dighost_shutdown)(void);
extern void
(*dighost_pre_exit_hook)(void);
extern void (*dighost_pre_exit_hook)(void);
void save_opt(dig_lookup_t *lookup, char *code, char *value);
void
save_opt(dig_lookup_t *lookup, char *code, char *value);
void setup_file_key(void);
void setup_text_key(void);
void
setup_file_key(void);
void
setup_text_key(void);
/*
* Routines exported from dig.c for use by dig for iOS
@@ -467,4 +415,4 @@ dig_shutdown(void);
ISC_LANG_ENDDECLS
#endif
#endif /* ifndef DIG_H */

View File

@@ -1,305 +0,0 @@
.\" Copyright (C) 2004-2007, 2010, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: nslookup
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-01-24
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "NSLOOKUP" "1" "2014\-01\-24" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
nslookup \- query Internet name servers interactively
.SH "SYNOPSIS"
.HP \w'\fBnslookup\fR\ 'u
\fBnslookup\fR [\fB\-option\fR] [name\ |\ \-] [server]
.SH "DESCRIPTION"
.PP
\fBNslookup\fR
is a program to query Internet domain name servers\&.
\fBNslookup\fR
has two modes: interactive and non\-interactive\&. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain\&. Non\-interactive mode is used to print just the name and requested information for a host or domain\&.
.SH "ARGUMENTS"
.PP
Interactive mode is entered in the following cases:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 1." 4.2
.\}
when no arguments are given (the default name server will be used)
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 2." 4.2
.\}
when the first argument is a hyphen (\-) and the second argument is the host name or Internet address of a name server\&.
.RE
.PP
Non\-interactive mode is used when the name or Internet address of the host to be looked up is given as the first argument\&. The optional second argument specifies the host name or address of a name server\&.
.PP
Options can also be specified on the command line if they precede the arguments and are prefixed with a hyphen\&. For example, to change the default query type to host information, and the initial timeout to 10 seconds, type:
.sp
.if n \{\
.RS 4
.\}
.nf
nslookup \-query=hinfo \-timeout=10
.fi
.if n \{\
.RE
.\}
.PP
The
\fB\-version\fR
option causes
\fBnslookup\fR
to print the version number and immediately exits\&.
.SH "INTERACTIVE COMMANDS"
.PP
\fBhost\fR [server]
.RS 4
Look up information for host using the current default server or using server, if specified\&. If host is an Internet address and the query type is A or PTR, the name of the host is returned\&. If host is a name and does not have a trailing period, the search list is used to qualify the name\&.
.sp
To look up a host not in the current domain, append a period to the name\&.
.RE
.PP
\fBserver\fR \fIdomain\fR
.RS 4
.RE
.PP
\fBlserver\fR \fIdomain\fR
.RS 4
Change the default server to
\fIdomain\fR;
\fBlserver\fR
uses the initial server to look up information about
\fIdomain\fR, while
\fBserver\fR
uses the current default server\&. If an authoritative answer can\*(Aqt be found, the names of servers that might have the answer are returned\&.
.RE
.PP
\fBroot\fR
.RS 4
not implemented
.RE
.PP
\fBfinger\fR
.RS 4
not implemented
.RE
.PP
\fBls\fR
.RS 4
not implemented
.RE
.PP
\fBview\fR
.RS 4
not implemented
.RE
.PP
\fBhelp\fR
.RS 4
not implemented
.RE
.PP
\fB?\fR
.RS 4
not implemented
.RE
.PP
\fBexit\fR
.RS 4
Exits the program\&.
.RE
.PP
\fBset\fR \fIkeyword\fR\fI[=value]\fR
.RS 4
This command is used to change state information that affects the lookups\&. Valid keywords are:
.PP
\fBall\fR
.RS 4
Prints the current values of the frequently used options to
\fBset\fR\&. Information about the current default server and host is also printed\&.
.RE
.PP
\fBclass=\fR\fIvalue\fR
.RS 4
Change the query class to one of:
.PP
\fBIN\fR
.RS 4
the Internet class
.RE
.PP
\fBCH\fR
.RS 4
the Chaos class
.RE
.PP
\fBHS\fR
.RS 4
the Hesiod class
.RE
.PP
\fBANY\fR
.RS 4
wildcard
.RE
.sp
The class specifies the protocol group of the information\&.
.sp
(Default = IN; abbreviation = cl)
.RE
.PP
\fB\fI[no]\fR\fR\fBdebug\fR
.RS 4
Turn on or off the display of the full response packet and any intermediate response packets when searching\&.
.sp
(Default = nodebug; abbreviation =
[no]deb)
.RE
.PP
\fB\fI[no]\fR\fR\fBd2\fR
.RS 4
Turn debugging mode on or off\&. This displays more about what nslookup is doing\&.
.sp
(Default = nod2)
.RE
.PP
\fBdomain=\fR\fIname\fR
.RS 4
Sets the search list to
\fIname\fR\&.
.RE
.PP
\fB\fI[no]\fR\fR\fBsearch\fR
.RS 4
If the lookup request contains at least one period but doesn\*(Aqt end with a trailing period, append the domain names in the domain search list to the request until an answer is received\&.
.sp
(Default = search)
.RE
.PP
\fBport=\fR\fIvalue\fR
.RS 4
Change the default TCP/UDP name server port to
\fIvalue\fR\&.
.sp
(Default = 53; abbreviation = po)
.RE
.PP
\fBquerytype=\fR\fIvalue\fR
.RS 4
.RE
.PP
\fBtype=\fR\fIvalue\fR
.RS 4
Change the type of the information query\&.
.sp
(Default = A; abbreviations = q, ty)
.RE
.PP
\fB\fI[no]\fR\fR\fBrecurse\fR
.RS 4
Tell the name server to query other servers if it does not have the information\&.
.sp
(Default = recurse; abbreviation = [no]rec)
.RE
.PP
\fBndots=\fR\fInumber\fR
.RS 4
Set the number of dots (label separators) in a domain that will disable searching\&. Absolute names always stop searching\&.
.RE
.PP
\fBretry=\fR\fInumber\fR
.RS 4
Set the number of retries to number\&.
.RE
.PP
\fBtimeout=\fR\fInumber\fR
.RS 4
Change the initial timeout interval for waiting for a reply to number seconds\&.
.RE
.PP
\fB\fI[no]\fR\fR\fBvc\fR
.RS 4
Always use a virtual circuit when sending requests to the server\&.
.sp
(Default = novc)
.RE
.PP
\fB\fI[no]\fR\fR\fBfail\fR
.RS 4
Try the next nameserver if a nameserver responds with SERVFAIL or a referral (nofail) or terminate query (fail) on such a response\&.
.sp
(Default = nofail)
.RE
.sp
.RE
.SH "RETURN VALUES"
.PP
\fBnslookup\fR
returns with an exit status of 1 if any query failed, and 0 otherwise\&.
.SH "IDN SUPPORT"
.PP
If
\fBnslookup\fR
has been built with IDN (internationalized domain name) support, it can accept and display non\-ASCII domain names\&.
\fBnslookup\fR
appropriately converts character encoding of domain name before sending a request to DNS server or displaying a reply from the server\&. If you\*(Aqd like to turn off the IDN support for some reason, define the
\fBIDN_DISABLE\fR
environment variable\&. The IDN support is disabled if the variable is set when
\fBnslookup\fR
runs or when the standard output is not a tty\&.
.SH "FILES"
.PP
/etc/resolv\&.conf
.SH "SEE ALSO"
.PP
\fBdig\fR(1),
\fBhost\fR(1),
\fBnamed\fR(8)\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2004-2007, 2010, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -18,22 +18,22 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/event.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
#include <isc/task.h>
#include <isc/netaddr.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/byaddr.h>
#include <dig/dig.h>
@@ -42,25 +42,23 @@
#include <edit/readline/readline.h>
#if defined(HAVE_EDIT_READLINE_HISTORY_H)
#include <edit/readline/history.h>
#endif
#endif /* if defined(HAVE_EDIT_READLINE_HISTORY_H) */
#elif defined(HAVE_EDITLINE_READLINE_H)
#include <editline/readline.h>
#elif defined(HAVE_READLINE_READLINE_H)
#include <readline/readline.h>
#if defined (HAVE_READLINE_HISTORY_H)
#if defined(HAVE_READLINE_HISTORY_H)
#include <readline/history.h>
#endif
#endif
#endif
#endif /* if defined(HAVE_READLINE_HISTORY_H) */
#endif /* if defined(HAVE_EDIT_READLINE_READLINE_H) */
#endif /* if defined(HAVE_READLINE) */
static bool short_form = true,
tcpmode = false, tcpmode_set = false,
identify = false, stats = true,
comments = true, section_question = true,
section_answer = true, section_authority = true,
section_additional = true, recurse = true,
aaonly = false, nofail = true,
default_lookups = true, a_noanswer = false;
static bool short_form = true, tcpmode = false, tcpmode_set = false,
identify = false, stats = true, comments = true,
section_question = true, section_answer = true,
section_authority = true, section_additional = true, recurse = true,
aaonly = false, nofail = true, default_lookups = true,
a_noanswer = false;
static bool interactive;
@@ -72,91 +70,80 @@ static int query_error = 1, print_error = 0;
static char domainopt[DNS_NAME_MAXTEXT];
static const char *rcodetext[] = {
"NOERROR",
"FORMERR",
"SERVFAIL",
"NXDOMAIN",
"NOTIMP",
"REFUSED",
"YXDOMAIN",
"YXRRSET",
"NXRRSET",
"NOTAUTH",
"NOTZONE",
"RESERVED11",
"RESERVED12",
"RESERVED13",
"RESERVED14",
"RESERVED15",
"BADVERS"
};
static const char *rcodetext[] = { "NOERROR", "FORMERR", "SERVFAIL",
"NXDOMAIN", "NOTIMP", "REFUSED",
"YXDOMAIN", "YXRRSET", "NXRRSET",
"NOTAUTH", "NOTZONE", "RESERVED11",
"RESERVED12", "RESERVED13", "RESERVED14",
"RESERVED15", "BADVERS" };
static const char *rtypetext[] = {
"rtype_0 = ", /* 0 */
"internet address = ", /* 1 */
"nameserver = ", /* 2 */
"md = ", /* 3 */
"mf = ", /* 4 */
"canonical name = ", /* 5 */
"soa = ", /* 6 */
"mb = ", /* 7 */
"mg = ", /* 8 */
"mr = ", /* 9 */
"rtype_10 = ", /* 10 */
"protocol = ", /* 11 */
"name = ", /* 12 */
"hinfo = ", /* 13 */
"minfo = ", /* 14 */
"mail exchanger = ", /* 15 */
"text = ", /* 16 */
"rp = ", /* 17 */
"afsdb = ", /* 18 */
"x25 address = ", /* 19 */
"isdn address = ", /* 20 */
"rt = ", /* 21 */
"nsap = ", /* 22 */
"nsap_ptr = ", /* 23 */
"signature = ", /* 24 */
"key = ", /* 25 */
"px = ", /* 26 */
"gpos = ", /* 27 */
"has AAAA address ", /* 28 */
"loc = ", /* 29 */
"next = ", /* 30 */
"rtype_31 = ", /* 31 */
"rtype_32 = ", /* 32 */
"service = ", /* 33 */
"rtype_34 = ", /* 34 */
"naptr = ", /* 35 */
"kx = ", /* 36 */
"cert = ", /* 37 */
"v6 address = ", /* 38 */
"dname = ", /* 39 */
"rtype_40 = ", /* 40 */
"optional = " /* 41 */
"rtype_0 = ", /* 0 */
"internet address = ", /* 1 */
"nameserver = ", /* 2 */
"md = ", /* 3 */
"mf = ", /* 4 */
"canonical name = ", /* 5 */
"soa = ", /* 6 */
"mb = ", /* 7 */
"mg = ", /* 8 */
"mr = ", /* 9 */
"rtype_10 = ", /* 10 */
"protocol = ", /* 11 */
"name = ", /* 12 */
"hinfo = ", /* 13 */
"minfo = ", /* 14 */
"mail exchanger = ", /* 15 */
"text = ", /* 16 */
"rp = ", /* 17 */
"afsdb = ", /* 18 */
"x25 address = ", /* 19 */
"isdn address = ", /* 20 */
"rt = ", /* 21 */
"nsap = ", /* 22 */
"nsap_ptr = ", /* 23 */
"signature = ", /* 24 */
"key = ", /* 25 */
"px = ", /* 26 */
"gpos = ", /* 27 */
"has AAAA address ", /* 28 */
"loc = ", /* 29 */
"next = ", /* 30 */
"rtype_31 = ", /* 31 */
"rtype_32 = ", /* 32 */
"service = ", /* 33 */
"rtype_34 = ", /* 34 */
"naptr = ", /* 35 */
"kx = ", /* 36 */
"cert = ", /* 37 */
"v6 address = ", /* 38 */
"dname = ", /* 39 */
"rtype_40 = ", /* 40 */
"optional = " /* 41 */
};
#define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0]))
static void flush_lookup_list(void);
static void getinput(isc_task_t *task, isc_event_t *event);
static void
flush_lookup_list(void);
static void
getinput(isc_task_t *task, isc_event_t *event);
static char *
rcode_totext(dns_rcode_t rcode)
{
rcode_totext(dns_rcode_t rcode) {
static char buf[sizeof("?65535")];
union {
const char *consttext;
char *deconsttext;
} totext;
if (rcode >= (sizeof(rcodetext)/sizeof(rcodetext[0]))) {
if (rcode >= (sizeof(rcodetext) / sizeof(rcodetext[0]))) {
snprintf(buf, sizeof(buf), "?%u", rcode);
totext.deconsttext = buf;
} else
} else {
totext.consttext = rcodetext[rcode];
return totext.deconsttext;
}
return (totext.deconsttext);
}
static void
@@ -215,10 +202,11 @@ printrdata(dns_rdata_t *rdata) {
unsigned int size = 1024;
bool done = false;
if (rdata->type < N_KNOWN_RRTYPES)
if (rdata->type < N_KNOWN_RRTYPES) {
printf("%s", rtypetext[rdata->type]);
else
} else {
printf("rdata_%d = ", rdata->type);
}
while (!done) {
isc_buffer_allocate(mctx, &b, size);
@@ -227,8 +215,9 @@ printrdata(dns_rdata_t *rdata) {
printf("%.*s\n", (int)isc_buffer_usedlength(b),
(char *)isc_buffer_base(b));
done = true;
} else if (result != ISC_R_NOSPACE)
} else if (result != ISC_R_NOSPACE) {
check_result(result, "dns_rdata_totext");
}
isc_buffer_free(&b);
size *= 2;
}
@@ -249,25 +238,26 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
debug("printsection()");
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
else if (result != ISC_R_SUCCESS)
} else if (result != ISC_R_SUCCESS) {
return (result);
}
for (;;) {
name = NULL;
dns_message_currentname(msg, section,
&name);
for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) {
dns_message_currentname(msg, section, &name);
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
{
loopresult = dns_rdataset_first(rdataset);
while (loopresult == ISC_R_SUCCESS) {
dns_rdataset_current(rdataset, &rdata);
switch (rdata.type) {
case dns_rdatatype_a:
case dns_rdatatype_aaaa:
if (section != DNS_SECTION_ANSWER)
if (section != DNS_SECTION_ANSWER) {
goto def_short_section;
}
dns_name_format(name, namebuf,
sizeof(namebuf));
printf("Name:\t%s\n", namebuf);
@@ -292,9 +282,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
}
}
result = dns_message_nextname(msg, section);
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
break;
else if (result != ISC_R_SUCCESS) {
} else if (result != ISC_R_SUCCESS) {
return (result);
}
}
@@ -303,7 +293,7 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
static isc_result_t
detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
dns_section_t section) {
dns_section_t section) {
isc_result_t result, loopresult;
dns_name_t *name;
dns_rdataset_t *rdataset = NULL;
@@ -332,36 +322,32 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
}
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
else if (result != ISC_R_SUCCESS)
} else if (result != ISC_R_SUCCESS) {
return (result);
}
for (;;) {
name = NULL;
dns_message_currentname(msg, section,
&name);
for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) {
dns_message_currentname(msg, section, &name);
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
{
if (section == DNS_SECTION_QUESTION) {
dns_name_format(name, namebuf,
sizeof(namebuf));
dns_name_format(name, namebuf, sizeof(namebuf));
printf("\t%s, ", namebuf);
dns_rdatatype_format(rdataset->type,
namebuf,
dns_rdatatype_format(rdataset->type, namebuf,
sizeof(namebuf));
printf("type = %s, ", namebuf);
dns_rdataclass_format(rdataset->rdclass,
namebuf,
sizeof(namebuf));
namebuf, sizeof(namebuf));
printf("class = %s\n", namebuf);
}
loopresult = dns_rdataset_first(rdataset);
while (loopresult == ISC_R_SUCCESS) {
dns_rdataset_current(rdataset, &rdata);
dns_name_format(name, namebuf,
sizeof(namebuf));
dns_name_format(name, namebuf, sizeof(namebuf));
printf(" -> %s\n", namebuf);
switch (rdata.type) {
@@ -378,9 +364,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
}
}
result = dns_message_nextname(msg, section);
if (result == ISC_R_NOMORE)
if (result == ISC_R_NOMORE) {
break;
else if (result != ISC_R_SUCCESS) {
} else if (result != ISC_R_SUCCESS) {
return (result);
}
}
@@ -388,8 +374,7 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
}
static void
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query)
{
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
UNUSED(bytes);
UNUSED(from);
UNUSED(query);
@@ -412,9 +397,11 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
while (i-- > 0) {
rdataset = NULL;
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
dns_rdatatype_cname, 0, NULL, &rdataset);
if (result != ISC_R_SUCCESS)
dns_rdatatype_cname, 0, NULL,
&rdataset);
if (result != ISC_R_SUCCESS) {
return;
}
result = dns_rdataset_first(rdataset);
check_result(result, "dns_rdataset_first");
dns_rdata_reset(&rdata);
@@ -427,9 +414,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
}
static isc_result_t
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
dns_message_t *msg, bool headers)
{
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
bool headers) {
char servtext[ISC_SOCKADDR_FORMATSIZE];
UNUSED(msgbuf);
@@ -439,7 +425,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
debug("printmessage()");
if(!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
if (!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
isc_sockaddr_format(&query->sockaddr, servtext,
sizeof(servtext));
printf("Server:\t\t%s\n", query->userarg);
@@ -460,10 +446,10 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
if (msg->rcode != 0) {
char nametext[DNS_NAME_FORMATSIZE];
dns_name_format(query->lookup->name,
nametext, sizeof(nametext));
printf("** server can't find %s: %s\n",
nametext, rcode_totext(msg->rcode));
dns_name_format(query->lookup->name, nametext,
sizeof(nametext));
printf("** server can't find %s: %s\n", nametext,
rcode_totext(msg->rcode));
debug("returning with rcode == 0");
/* the lookup failed */
@@ -471,7 +457,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
return (ISC_R_SUCCESS);
}
if ( default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
char namestr[DNS_NAME_FORMATSIZE];
dig_lookup_t *lookup;
dns_fixedname_t fixed;
@@ -495,29 +481,32 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
}
if ((msg->flags & DNS_MESSAGEFLAG_AA) == 0 &&
( !default_lookups || query->lookup->rdtype == dns_rdatatype_a) )
(!default_lookups || query->lookup->rdtype == dns_rdatatype_a))
{
puts("Non-authoritative answer:");
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER]))
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
printsection(query, msg, headers, DNS_SECTION_ANSWER);
else {
} else {
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a)
{
a_noanswer = true;
else if (!default_lookups ||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
a_noanswer ) )
} else if (!default_lookups ||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
a_noanswer))
{
printf("*** Can't find %s: No answer\n",
query->lookup->textname);
query->lookup->textname);
}
}
if (((msg->flags & DNS_MESSAGEFLAG_AA) == 0) &&
(query->lookup->rdtype != dns_rdatatype_a) &&
(query->lookup->rdtype != dns_rdatatype_aaaa) ) {
(query->lookup->rdtype != dns_rdatatype_aaaa))
{
puts("\nAuthoritative answers can be found from:");
printsection(query, msg, headers,
DNS_SECTION_AUTHORITY);
printsection(query, msg, headers,
DNS_SECTION_ADDITIONAL);
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
}
return (ISC_R_SUCCESS);
}
@@ -538,32 +527,32 @@ show_settings(bool full, bool serv_only) {
check_result(result, "get_address");
isc_sockaddr_format(&sockaddr, sockstr, sizeof(sockstr));
printf("Default server: %s\nAddress: %s\n",
srv->userarg, sockstr);
if (!full)
printf("Default server: %s\nAddress: %s\n", srv->userarg,
sockstr);
if (!full) {
return;
}
srv = ISC_LIST_NEXT(srv, link);
}
if (serv_only)
if (serv_only) {
return;
}
printf("\nSet options:\n");
printf(" %s\t\t\t%s\t\t%s\n",
tcpmode ? "vc" : "novc",
short_form ? "nodebug" : "debug",
debugging ? "d2" : "nod2");
printf(" %s\t\t%s\n",
usesearch ? "search" : "nosearch",
printf(" %s\t\t\t%s\t\t%s\n", tcpmode ? "vc" : "novc",
short_form ? "nodebug" : "debug", debugging ? "d2" : "nod2");
printf(" %s\t\t%s\n", usesearch ? "search" : "nosearch",
recurse ? "recurse" : "norecurse");
printf(" timeout = %u\t\tretry = %d\tport = %u\tndots = %d\n",
timeout, tries, port, ndots);
printf(" timeout = %u\t\tretry = %d\tport = %u\tndots = %d\n", timeout,
tries, port, ndots);
printf(" querytype = %-8s\tclass = %s\n", deftype, defclass);
printf(" srchlist = ");
for (listent = ISC_LIST_HEAD(search_list);
listent != NULL;
listent = ISC_LIST_NEXT(listent, link)) {
printf("%s", listent->origin);
if (ISC_LIST_NEXT(listent, link) != NULL)
printf("/");
for (listent = ISC_LIST_HEAD(search_list); listent != NULL;
listent = ISC_LIST_NEXT(listent, link))
{
printf("%s", listent->origin);
if (ISC_LIST_NEXT(listent, link) != NULL) {
printf("/");
}
}
printf("\n");
}
@@ -577,9 +566,9 @@ testtype(char *typetext) {
tr.base = typetext;
tr.length = strlen(typetext);
result = dns_rdatatype_fromtext(&rdtype, &tr);
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
return (true);
else {
} else {
printf("unknown query type: %s\n", typetext);
return (false);
}
@@ -594,9 +583,9 @@ testclass(char *typetext) {
tr.base = typetext;
tr.length = strlen(typetext);
result = dns_rdataclass_fromtext(&rdclass, &tr);
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
return (true);
else {
} else {
printf("unknown query class: %s\n", typetext);
return (false);
}
@@ -606,32 +595,36 @@ static void
set_port(const char *value) {
uint32_t n;
isc_result_t result = parse_uint(&n, value, 65535, "port");
if (result == ISC_R_SUCCESS)
port = (uint16_t) n;
if (result == ISC_R_SUCCESS) {
port = (uint16_t)n;
}
}
static void
set_timeout(const char *value) {
uint32_t n;
isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
timeout = n;
}
}
static void
set_tries(const char *value) {
uint32_t n;
isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
tries = n;
}
}
static void
set_ndots(const char *value) {
uint32_t n;
isc_result_t result = parse_uint(&n, value, 128, "ndots");
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
ndots = n;
}
}
static void
@@ -649,11 +642,13 @@ setoption(char *opt) {
if (CHECKOPT("all", 3)) {
show_settings(true, false);
} else if (strncasecmp(opt, "class=", 6) == 0) {
if (testclass(&opt[6]))
if (testclass(&opt[6])) {
strlcpy(defclass, &opt[6], sizeof(defclass));
}
} else if (strncasecmp(opt, "cl=", 3) == 0) {
if (testclass(&opt[3]))
if (testclass(&opt[3])) {
strlcpy(defclass, &opt[3], sizeof(defclass));
}
} else if (strncasecmp(opt, "type=", 5) == 0) {
if (testtype(&opt[5])) {
strlcpy(deftype, &opt[5], sizeof(deftype));
@@ -735,9 +730,9 @@ setoption(char *opt) {
} else if (CHECKOPT("sil", 3)) {
/* deprecation_msg = false; */
} else if (CHECKOPT("fail", 3)) {
nofail=false;
nofail = false;
} else if (CHECKOPT("nofail", 5)) {
nofail=true;
nofail = true;
} else if (strncasecmp(opt, "ndots=", 6) == 0) {
set_ndots(&opt[6]);
} else {
@@ -773,8 +768,7 @@ addlookup(char *opt) {
rdclass = dns_rdataclass_in;
}
lookup = make_empty_lookup();
if (get_reverse(store, sizeof(store), opt, true)
== ISC_R_SUCCESS) {
if (get_reverse(store, sizeof(store), opt, true) == ISC_R_SUCCESS) {
strlcpy(lookup->textname, store, sizeof(lookup->textname));
lookup->rdtype = dns_rdatatype_ptr;
lookup->rdtypeset = true;
@@ -794,18 +788,21 @@ addlookup(char *opt) {
lookup->retries = tries;
lookup->udpsize = 0;
lookup->comments = comments;
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set) {
lookup->tcp_mode = true;
else
} else {
lookup->tcp_mode = tcpmode;
}
lookup->stats = stats;
lookup->section_question = section_question;
lookup->section_answer = section_answer;
lookup->section_authority = section_authority;
lookup->section_additional = section_additional;
lookup->new_search = true;
if (nofail)
lookup->besteffort = false;
if (nofail) {
lookup->servfail_stops = false;
}
ISC_LIST_INIT(lookup->q);
ISC_LINK_INIT(lookup, link);
ISC_LIST_APPEND(lookup_list, lookup, link);
@@ -822,11 +819,11 @@ do_next_command(char *input) {
return;
}
arg = strtok_r(NULL, " \t\r\n", &last);
if ((strcasecmp(ptr, "set") == 0) &&
(arg != NULL))
if ((strcasecmp(ptr, "set") == 0) && (arg != NULL)) {
setoption(arg);
else if ((strcasecmp(ptr, "server") == 0) ||
(strcasecmp(ptr, "lserver") == 0)) {
} else if ((strcasecmp(ptr, "server") == 0) ||
(strcasecmp(ptr, "lserver") == 0))
{
isc_app_block();
set_nameserver(arg);
check_ra = false;
@@ -834,16 +831,16 @@ do_next_command(char *input) {
show_settings(true, true);
} else if (strcasecmp(ptr, "exit") == 0) {
in_use = false;
} else if (strcasecmp(ptr, "help") == 0 ||
strcasecmp(ptr, "?") == 0) {
} else if (strcasecmp(ptr, "help") == 0 || strcasecmp(ptr, "?") == 0) {
printf("The '%s' command is not yet implemented.\n", ptr);
} else if (strcasecmp(ptr, "finger") == 0 ||
strcasecmp(ptr, "root") == 0 ||
strcasecmp(ptr, "ls") == 0 ||
strcasecmp(ptr, "view") == 0) {
strcasecmp(ptr, "root") == 0 || strcasecmp(ptr, "ls") == 0 ||
strcasecmp(ptr, "view") == 0)
{
printf("The '%s' command is not implemented.\n", ptr);
} else
} else {
addlookup(ptr);
}
}
static void
@@ -857,24 +854,28 @@ get_next_command(void) {
if (interactive) {
#ifdef HAVE_READLINE
ptr = readline("> ");
if (ptr != NULL)
if (ptr != NULL) {
add_history(ptr);
#else
}
#else /* ifdef HAVE_READLINE */
fputs("> ", stderr);
fflush(stderr);
ptr = fgets(buf, COMMSIZE, stdin);
#endif
} else
#endif /* ifdef HAVE_READLINE */
} else {
ptr = fgets(buf, COMMSIZE, stdin);
}
isc_app_unblock();
if (ptr == NULL) {
in_use = false;
} else
} else {
do_next_command(ptr);
}
#ifdef HAVE_READLINE
if (interactive)
if (interactive) {
free(ptr);
#endif
}
#endif /* ifdef HAVE_READLINE */
isc_mem_free(mctx, buf);
}
@@ -883,16 +884,16 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr,
" nslookup [-opt ...] # interactive mode using default server\n");
fprintf(stderr,
" nslookup [-opt ...] - server # interactive mode using 'server'\n");
fprintf(stderr,
" nslookup [-opt ...] host # just look up 'host' using default server\n");
fprintf(stderr,
" nslookup [-opt ...] host server # just look up 'host' using 'server'\n");
exit(1);
fprintf(stderr, "Usage:\n");
fprintf(stderr, " nslookup [-opt ...] # interactive mode "
"using default server\n");
fprintf(stderr, " nslookup [-opt ...] - server # interactive mode "
"using 'server'\n");
fprintf(stderr, " nslookup [-opt ...] host # just look up "
"'host' using default server\n");
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
"'host' using 'server'\n");
exit(1);
}
static void
@@ -908,8 +909,9 @@ parse_args(int argc, char **argv) {
exit(0);
} else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
} else
} else {
have_lookup = true;
}
} else {
if (!have_lookup) {
have_lookup = true;
@@ -955,10 +957,10 @@ flush_lookup_list(void) {
s = ISC_LIST_NEXT(s, link);
ISC_LIST_DEQUEUE(l->my_server_list, sp, link);
isc_mem_free(mctx, sp);
}
if (l->sendmsg != NULL)
if (l->sendmsg != NULL) {
dns_message_destroy(&l->sendmsg);
}
lp = l;
l = ISC_LIST_NEXT(l, link);
ISC_LIST_DEQUEUE(lookup_list, lp, link);
@@ -969,8 +971,9 @@ flush_lookup_list(void) {
static void
getinput(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
if (global_event == NULL)
if (global_event == NULL) {
global_event = event;
}
while (in_use) {
get_next_command();
if (ISC_LIST_HEAD(lookup_list) != NULL) {
@@ -1007,17 +1010,19 @@ main(int argc, char **argv) {
setup_system(false, false);
parse_args(argc, argv);
if (keyfile[0] != 0)
if (keyfile[0] != 0) {
setup_file_key();
else if (keysecret[0] != 0)
} else if (keysecret[0] != 0) {
setup_text_key();
if (domainopt[0] != '\0')
}
if (domainopt[0] != '\0') {
set_search_domain(domainopt);
if (in_use)
result = isc_app_onrun(mctx, global_task, onrun_callback,
NULL);
else
}
if (in_use) {
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
} else {
result = isc_app_onrun(mctx, global_task, getinput, NULL);
}
check_result(result, "isc_app_onrun");
in_use = !in_use;
@@ -1025,8 +1030,9 @@ main(int argc, char **argv) {
puts("");
debug("done, and starting to shut down");
if (global_event != NULL)
if (global_event != NULL) {
isc_event_free(&global_event);
}
cancel_all();
destroy_libs();
isc_app_finish();

View File

@@ -1,524 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!--
- Copyright (c) 1985, 1989
- The Regents of the University of California. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.nslookup">
<info>
<date>2014-01-24</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle>nslookup</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname>nslookup</refname>
<refpurpose>query Internet name servers interactively</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2004</year>
<year>2005</year>
<year>2006</year>
<year>2007</year>
<year>2010</year>
<year>2013</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2017</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>nslookup</command>
<arg choice="opt" rep="norepeat"><option>-option</option></arg>
<arg choice="opt" rep="norepeat">name | -</arg>
<arg choice="opt" rep="norepeat">server</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>Nslookup</command>
is a program to query Internet domain name servers. <command>Nslookup</command>
has two modes: interactive and non-interactive. Interactive mode allows
the user to query name servers for information about various hosts and
domains or to print a list of hosts in a domain. Non-interactive mode
is
used to print just the name and requested information for a host or
domain.
</para>
</refsection>
<refsection><info><title>ARGUMENTS</title></info>
<para>
Interactive mode is entered in the following cases:
<orderedlist numeration="loweralpha" inheritnum="ignore" continuation="restarts">
<listitem>
<para>
when no arguments are given (the default name server will be used)
</para>
</listitem>
<listitem>
<para>
when the first argument is a hyphen (-) and the second argument is
the host name or Internet address of a name server.
</para>
</listitem>
</orderedlist>
</para>
<para>
Non-interactive mode is used when the name or Internet address of the
host to be looked up is given as the first argument. The optional second
argument specifies the host name or address of a name server.
</para>
<para>
Options can also be specified on the command line if they precede the
arguments and are prefixed with a hyphen. For example, to
change the default query type to host information, and the initial
timeout to 10 seconds, type:
<!-- <informalexample> produces bad nroff. -->
<programlisting>
nslookup -query=hinfo -timeout=10
</programlisting>
<!-- </informalexample> -->
</para>
<para>
The <option>-version</option> option causes
<command>nslookup</command> to print the version
number and immediately exits.
</para>
</refsection>
<refsection><info><title>INTERACTIVE COMMANDS</title></info>
<variablelist>
<varlistentry>
<term><constant>host</constant> <optional>server</optional></term>
<listitem>
<para>
Look up information for host using the current default server or
using server, if specified. If host is an Internet address and
the query type is A or PTR, the name of the host is returned.
If host is a name and does not have a trailing period, the
search list is used to qualify the name.
</para>
<para>
To look up a host not in the current domain, append a period to
the name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>server</constant> <replaceable class="parameter">domain</replaceable></term>
<listitem>
<para/>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>lserver</constant> <replaceable class="parameter">domain</replaceable></term>
<listitem>
<para>
Change the default server to <replaceable>domain</replaceable>; <constant>lserver</constant> uses the initial
server to look up information about <replaceable>domain</replaceable>, while <constant>server</constant> uses
the current default server. If an authoritative answer can't be
found, the names of servers that might have the answer are
returned.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>root</constant></term>
<listitem>
<para>
not implemented
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>finger</constant></term>
<listitem>
<para>
not implemented
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>ls</constant></term>
<listitem>
<para>
not implemented
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>view</constant></term>
<listitem>
<para>
not implemented
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>help</constant></term>
<listitem>
<para>
not implemented
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>?</constant></term>
<listitem>
<para>
not implemented
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>exit</constant></term>
<listitem>
<para>
Exits the program.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>set</constant>
<replaceable>keyword<optional>=value</optional></replaceable></term>
<listitem>
<para>
This command is used to change state information that affects
the lookups. Valid keywords are:
<variablelist>
<varlistentry>
<term><constant>all</constant></term>
<listitem>
<para>
Prints the current values of the frequently used
options to <command>set</command>.
Information about the current default
server and host is also printed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>class=</constant><replaceable>value</replaceable></term>
<listitem>
<para>
Change the query class to one of:
<variablelist>
<varlistentry>
<term><constant>IN</constant></term>
<listitem>
<para>
the Internet class
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>CH</constant></term>
<listitem>
<para>
the Chaos class
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>HS</constant></term>
<listitem>
<para>
the Hesiod class
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>ANY</constant></term>
<listitem>
<para>
wildcard
</para>
</listitem>
</varlistentry>
</variablelist>
The class specifies the protocol group of the information.
</para>
<para>
(Default = IN; abbreviation = cl)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant><replaceable><optional>no</optional></replaceable>debug</constant></term>
<listitem>
<para>
Turn on or off the display of the full response packet and
any intermediate response packets when searching.
</para>
<para>
(Default = nodebug; abbreviation = <optional>no</optional>deb)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant><replaceable><optional>no</optional></replaceable>d2</constant></term>
<listitem>
<para>
Turn debugging mode on or off. This displays more about
what nslookup is doing.
</para>
<para>
(Default = nod2)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>domain=</constant><replaceable>name</replaceable></term>
<listitem>
<para>
Sets the search list to <replaceable>name</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant><replaceable><optional>no</optional></replaceable>search</constant></term>
<listitem>
<para>
If the lookup request contains at least one period but
doesn't end with a trailing period, append the domain
names in the domain search list to the request until an
answer is received.
</para>
<para>
(Default = search)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>port=</constant><replaceable>value</replaceable></term>
<listitem>
<para>
Change the default TCP/UDP name server port to <replaceable>value</replaceable>.
</para>
<para>
(Default = 53; abbreviation = po)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>querytype=</constant><replaceable>value</replaceable></term>
<listitem>
<para/>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>type=</constant><replaceable>value</replaceable></term>
<listitem>
<para>
Change the type of the information query.
</para>
<para>
(Default = A and then AAAA; abbreviations = q, ty)
</para>
<para>
<emphasis role="bold">Note:</emphasis> It is
only possible to specify one query type, only
the default behavior looks up both when an
alternative is not specified.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant><replaceable><optional>no</optional></replaceable>recurse</constant></term>
<listitem>
<para>
Tell the name server to query other servers if it does not
have the
information.
</para>
<para>
(Default = recurse; abbreviation = [no]rec)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>ndots=</constant><replaceable>number</replaceable></term>
<listitem>
<para>
Set the number of dots (label separators) in a domain
that will disable searching. Absolute names always
stop searching.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>retry=</constant><replaceable>number</replaceable></term>
<listitem>
<para>
Set the number of retries to number.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>timeout=</constant><replaceable>number</replaceable></term>
<listitem>
<para>
Change the initial timeout interval for waiting for a
reply to number seconds.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant><replaceable><optional>no</optional></replaceable>vc</constant></term>
<listitem>
<para>
Always use a virtual circuit when sending requests to the
server.
</para>
<para>
(Default = novc)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant><replaceable><optional>no</optional></replaceable>fail</constant></term>
<listitem>
<para>
Try the next nameserver if a nameserver responds with
SERVFAIL or a referral (nofail) or terminate query
(fail) on such a response.
</para>
<para>
(Default = nofail)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>RETURN VALUES</title></info>
<para>
<command>nslookup</command> returns with an exit status of 1
if any query failed, and 0 otherwise.
</para>
</refsection>
<refsection><info><title>IDN SUPPORT</title></info>
<para>
If <command>nslookup</command> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
<command>nslookup</command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
If you'd like to turn off the IDN support for some reason, define
the <envar>IDN_DISABLE</envar> environment variable.
The IDN support is disabled if the variable is set when
<command>nslookup</command> runs or when the standard output is not
a tty.
</para>
</refsection>
<refsection><info><title>FILES</title></info>
<para><filename>/etc/resolv.conf</filename>
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>dig</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>host</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>.
</para>
</refsection>
</refentry>

View File

@@ -1,403 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2004-2007, 2010, 2013-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>nslookup</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.nslookup"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
nslookup
&#8212; query Internet name servers interactively
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">nslookup</code>
[<code class="option">-option</code>]
[name | -]
[server]
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p><span class="command"><strong>Nslookup</strong></span>
is a program to query Internet domain name servers. <span class="command"><strong>Nslookup</strong></span>
has two modes: interactive and non-interactive. Interactive mode allows
the user to query name servers for information about various hosts and
domains or to print a list of hosts in a domain. Non-interactive mode
is
used to print just the name and requested information for a host or
domain.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>ARGUMENTS</h2>
<p>
Interactive mode is entered in the following cases:
</p>
<div class="orderedlist"><ol class="orderedlist" type="a">
<li class="listitem">
<p>
when no arguments are given (the default name server will be used)
</p>
</li>
<li class="listitem">
<p>
when the first argument is a hyphen (-) and the second argument is
the host name or Internet address of a name server.
</p>
</li>
</ol></div>
<p>
</p>
<p>
Non-interactive mode is used when the name or Internet address of the
host to be looked up is given as the first argument. The optional second
argument specifies the host name or address of a name server.
</p>
<p>
Options can also be specified on the command line if they precede the
arguments and are prefixed with a hyphen. For example, to
change the default query type to host information, and the initial
timeout to 10 seconds, type:
</p>
<pre class="programlisting">
nslookup -query=hinfo -timeout=10
</pre>
<p>
</p>
<p>
The <code class="option">-version</code> option causes
<span class="command"><strong>nslookup</strong></span> to print the version
number and immediately exits.
</p>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>INTERACTIVE COMMANDS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term"><code class="constant">host</code> [<span class="optional">server</span>]</span></dt>
<dd>
<p>
Look up information for host using the current default server or
using server, if specified. If host is an Internet address and
the query type is A or PTR, the name of the host is returned.
If host is a name and does not have a trailing period, the
search list is used to qualify the name.
</p>
<p>
To look up a host not in the current domain, append a period to
the name.
</p>
</dd>
<dt><span class="term"><code class="constant">server</code> <em class="replaceable"><code>domain</code></em></span></dt>
<dd>
<p></p>
</dd>
<dt><span class="term"><code class="constant">lserver</code> <em class="replaceable"><code>domain</code></em></span></dt>
<dd>
<p>
Change the default server to <em class="replaceable"><code>domain</code></em>; <code class="constant">lserver</code> uses the initial
server to look up information about <em class="replaceable"><code>domain</code></em>, while <code class="constant">server</code> uses
the current default server. If an authoritative answer can't be
found, the names of servers that might have the answer are
returned.
</p>
</dd>
<dt><span class="term"><code class="constant">root</code></span></dt>
<dd>
<p>
not implemented
</p>
</dd>
<dt><span class="term"><code class="constant">finger</code></span></dt>
<dd>
<p>
not implemented
</p>
</dd>
<dt><span class="term"><code class="constant">ls</code></span></dt>
<dd>
<p>
not implemented
</p>
</dd>
<dt><span class="term"><code class="constant">view</code></span></dt>
<dd>
<p>
not implemented
</p>
</dd>
<dt><span class="term"><code class="constant">help</code></span></dt>
<dd>
<p>
not implemented
</p>
</dd>
<dt><span class="term"><code class="constant">?</code></span></dt>
<dd>
<p>
not implemented
</p>
</dd>
<dt><span class="term"><code class="constant">exit</code></span></dt>
<dd>
<p>
Exits the program.
</p>
</dd>
<dt><span class="term"><code class="constant">set</code>
<em class="replaceable"><code>keyword[<span class="optional">=value</span>]</code></em></span></dt>
<dd>
<p>
This command is used to change state information that affects
the lookups. Valid keywords are:
</p>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term"><code class="constant">all</code></span></dt>
<dd>
<p>
Prints the current values of the frequently used
options to <span class="command"><strong>set</strong></span>.
Information about the current default
server and host is also printed.
</p>
</dd>
<dt><span class="term"><code class="constant">class=</code><em class="replaceable"><code>value</code></em></span></dt>
<dd>
<p>
Change the query class to one of:
</p>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term"><code class="constant">IN</code></span></dt>
<dd>
<p>
the Internet class
</p>
</dd>
<dt><span class="term"><code class="constant">CH</code></span></dt>
<dd>
<p>
the Chaos class
</p>
</dd>
<dt><span class="term"><code class="constant">HS</code></span></dt>
<dd>
<p>
the Hesiod class
</p>
</dd>
<dt><span class="term"><code class="constant">ANY</code></span></dt>
<dd>
<p>
wildcard
</p>
</dd>
</dl></div>
<p>
The class specifies the protocol group of the information.
</p>
<p>
(Default = IN; abbreviation = cl)
</p>
</dd>
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>debug</code></span></dt>
<dd>
<p>
Turn on or off the display of the full response packet and
any intermediate response packets when searching.
</p>
<p>
(Default = nodebug; abbreviation = [<span class="optional">no</span>]deb)
</p>
</dd>
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>d2</code></span></dt>
<dd>
<p>
Turn debugging mode on or off. This displays more about
what nslookup is doing.
</p>
<p>
(Default = nod2)
</p>
</dd>
<dt><span class="term"><code class="constant">domain=</code><em class="replaceable"><code>name</code></em></span></dt>
<dd>
<p>
Sets the search list to <em class="replaceable"><code>name</code></em>.
</p>
</dd>
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>search</code></span></dt>
<dd>
<p>
If the lookup request contains at least one period but
doesn't end with a trailing period, append the domain
names in the domain search list to the request until an
answer is received.
</p>
<p>
(Default = search)
</p>
</dd>
<dt><span class="term"><code class="constant">port=</code><em class="replaceable"><code>value</code></em></span></dt>
<dd>
<p>
Change the default TCP/UDP name server port to <em class="replaceable"><code>value</code></em>.
</p>
<p>
(Default = 53; abbreviation = po)
</p>
</dd>
<dt><span class="term"><code class="constant">querytype=</code><em class="replaceable"><code>value</code></em></span></dt>
<dd>
<p></p>
</dd>
<dt><span class="term"><code class="constant">type=</code><em class="replaceable"><code>value</code></em></span></dt>
<dd>
<p>
Change the type of the information query.
</p>
<p>
(Default = A; abbreviations = q, ty)
</p>
</dd>
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>recurse</code></span></dt>
<dd>
<p>
Tell the name server to query other servers if it does not
have the
information.
</p>
<p>
(Default = recurse; abbreviation = [no]rec)
</p>
</dd>
<dt><span class="term"><code class="constant">ndots=</code><em class="replaceable"><code>number</code></em></span></dt>
<dd>
<p>
Set the number of dots (label separators) in a domain
that will disable searching. Absolute names always
stop searching.
</p>
</dd>
<dt><span class="term"><code class="constant">retry=</code><em class="replaceable"><code>number</code></em></span></dt>
<dd>
<p>
Set the number of retries to number.
</p>
</dd>
<dt><span class="term"><code class="constant">timeout=</code><em class="replaceable"><code>number</code></em></span></dt>
<dd>
<p>
Change the initial timeout interval for waiting for a
reply to number seconds.
</p>
</dd>
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>vc</code></span></dt>
<dd>
<p>
Always use a virtual circuit when sending requests to the
server.
</p>
<p>
(Default = novc)
</p>
</dd>
<dt><span class="term"><code class="constant"><em class="replaceable"><code>[<span class="optional">no</span>]</code></em>fail</code></span></dt>
<dd>
<p>
Try the next nameserver if a nameserver responds with
SERVFAIL or a referral (nofail) or terminate query
(fail) on such a response.
</p>
<p>
(Default = nofail)
</p>
</dd>
</dl></div>
<p>
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>RETURN VALUES</h2>
<p>
<span class="command"><strong>nslookup</strong></span> returns with an exit status of 1
if any query failed, and 0 otherwise.
</p>
</div>
<div class="refsection">
<a name="id-1.11"></a><h2>IDN SUPPORT</h2>
<p>
If <span class="command"><strong>nslookup</strong></span> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
<span class="command"><strong>nslookup</strong></span> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
If you'd like to turn off the IDN support for some reason, define
the <code class="envar">IDN_DISABLE</code> environment variable.
The IDN support is disabled if the variable is set when
<span class="command"><strong>nslookup</strong></span> runs or when the standard output is not
a tty.
</p>
</div>
<div class="refsection">
<a name="id-1.12"></a><h2>FILES</h2>
<p><code class="filename">/etc/resolv.conf</code>
</p>
</div>
<div class="refsection">
<a name="id-1.13"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">dig</span>(1)
</span>,
<span class="citerefentry">
<span class="refentrytitle">host</span>(1)
</span>,
<span class="citerefentry">
<span class="refentrytitle">named</span>(8)
</span>.
</p>
</div>
</div></body>
</html>

226
bin/dig/nslookup.rst Normal file
View File

@@ -0,0 +1,226 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_nslookup:
nslookup - query Internet name servers interactively
----------------------------------------------------
Synopsis
~~~~~~~~
:program:`nslookup` [-option] [name | -] [server]
Description
~~~~~~~~~~~
``Nslookup`` is a program to query Internet domain name servers.
``Nslookup`` has two modes: interactive and non-interactive. Interactive
mode allows the user to query name servers for information about various
hosts and domains or to print a list of hosts in a domain.
Non-interactive mode is used to print just the name and requested
information for a host or domain.
Arguments
~~~~~~~~~
Interactive mode is entered in the following cases:
a. when no arguments are given (the default name server will be used)
b. when the first argument is a hyphen (-) and the second argument is
the host name or Internet address of a name server.
Non-interactive mode is used when the name or Internet address of the
host to be looked up is given as the first argument. The optional second
argument specifies the host name or address of a name server.
Options can also be specified on the command line if they precede the
arguments and are prefixed with a hyphen. For example, to change the
default query type to host information, and the initial timeout to 10
seconds, type:
::
nslookup -query=hinfo -timeout=10
The ``-version`` option causes ``nslookup`` to print the version number
and immediately exits.
Interactive Commands
~~~~~~~~~~~~~~~~~~~~
``host`` [server]
Look up information for host using the current default server or
using server, if specified. If host is an Internet address and the
query type is A or PTR, the name of the host is returned. If host is
a name and does not have a trailing period, the search list is used
to qualify the name.
To look up a host not in the current domain, append a period to the
name.
``server`` domain | ``lserver`` domain
Change the default server to domain; ``lserver`` uses the initial
server to look up information about domain, while ``server`` uses the
current default server. If an authoritative answer can't be found,
the names of servers that might have the answer are returned.
``root``
not implemented
``finger``
not implemented
``ls``
not implemented
``view``
not implemented
``help``
not implemented
``?``
not implemented
``exit``
Exits the program.
``set`` keyword[=value]
This command is used to change state information that affects the
lookups. Valid keywords are:
``all``
Prints the current values of the frequently used options to
``set``. Information about the current default server and host is
also printed.
``class=``\ value
Change the query class to one of:
``IN``
the Internet class
``CH``
the Chaos class
``HS``
the Hesiod class
``ANY``
wildcard
The class specifies the protocol group of the information.
(Default = IN; abbreviation = cl)
``nodebug``
Turn on or off the display of the full response packet and any
intermediate response packets when searching.
(Default = nodebug; abbreviation = [no]deb)
``nod2``
Turn debugging mode on or off. This displays more about what
nslookup is doing.
(Default = nod2)
``domain=``\ name
Sets the search list to name.
``nosearch``
If the lookup request contains at least one period but doesn't end
with a trailing period, append the domain names in the domain
search list to the request until an answer is received.
(Default = search)
``port=``\ value
Change the default TCP/UDP name server port to value.
(Default = 53; abbreviation = po)
``querytype=``\ value | ``type=``\ value
Change the type of the information query.
(Default = A and then AAAA; abbreviations = q, ty)
**Note:** It is only possible to specify one query type, only the default
behavior looks up both when an alternative is not specified.
``norecurse``
Tell the name server to query other servers if it does not have
the information.
(Default = recurse; abbreviation = [no]rec)
``ndots=``\ number
Set the number of dots (label separators) in a domain that will
disable searching. Absolute names always stop searching.
``retry=``\ number
Set the number of retries to number.
``timeout=``\ number
Change the initial timeout interval for waiting for a reply to
number seconds.
``novc``
Always use a virtual circuit when sending requests to the server.
(Default = novc)
``nofail``
Try the next nameserver if a nameserver responds with SERVFAIL or
a referral (nofail) or terminate query (fail) on such a response.
(Default = nofail)
Return Values
~~~~~~~~~~~~~
``nslookup`` returns with an exit status of 1 if any query failed, and 0
otherwise.
IDN Support
~~~~~~~~~~~
If ``nslookup`` has been built with IDN (internationalized domain name)
support, it can accept and display non-ASCII domain names. ``nslookup``
appropriately converts character encoding of domain name before sending
a request to DNS server or displaying a reply from the server. If you'd
like to turn off the IDN support for some reason, define the IDN_DISABLE
environment variable. The IDN support is disabled if the variable is set
when ``nslookup`` runs or when the standard output is not a tty.
Files
~~~~~
``/etc/resolv.conf``
See Also
~~~~~~~~
:manpage:`dig(1)`, :manpage:`host(1)`, :manpage:`named(8)`.

View File

@@ -44,17 +44,20 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -77,7 +80,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -44,17 +44,20 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>.\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>.\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -75,7 +78,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -44,17 +44,20 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -77,7 +80,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -44,17 +44,20 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\..\Build\$(Configuration)\</OutDir>
<IntDir>.\$(Configuration)\</IntDir>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>false</TreatWarningAsError>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;USE_READLINE_STATIC;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -77,7 +80,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level1</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>

View File

@@ -21,10 +21,10 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
CDEFINES = -DVERSION=\"${VERSION}\" -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
DNSDEPLIBS = ../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../lib/isc/libisc.@A@
@@ -50,18 +50,6 @@ SRCS = dnssec-cds.c dnssec-dsfromkey.c dnssec-importkey.c \
dnssec-settime.c dnssec-signzone.c dnssec-verify.c \
dnssectool.c
MANPAGES = dnssec-cds.8 dnssec-dsfromkey.8 dnssec-importkey.8 \
dnssec-keyfromlabel.8 dnssec-keygen.8 dnssec-revoke.8 \
dnssec-settime.8 dnssec-signzone.8 dnssec-verify.8
HTMLPAGES = dnssec-cds.html dnssec-dsfromkey.html \
dnssec-importkey.html dnssec-keyfromlabel.html \
dnssec-keygen.html dnssec-revoke.html \
dnssec-settime.html dnssec-signzone.html \
dnssec-verify.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@
dnssec-cds@EXEEXT@: dnssec-cds.@O@ ${OBJS} ${DEPLIBS}
@@ -108,21 +96,14 @@ dnssec-importkey@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
dnssec-importkey.@O@ ${OBJS} ${LIBS}
doc man:: ${MANOBJS}
docclean manclean maintainer-clean::
rm -f ${MANOBJS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
install:: ${TARGETS} installdirs
for t in ${TARGETS}; do ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} $$t ${DESTDIR}${sbindir} || exit 1; done
for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8 || exit 1; done
uninstall::
for m in ${MANPAGES}; do rm -f ${DESTDIR}${mandir}/man8/$$m || exit 1; done
for t in ${TARGETS}; do ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/$$t || exit 1; done
clean distclean::

View File

@@ -1,297 +0,0 @@
.\" Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: dnssec-cds
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2017-10-02
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "DNSSEC\-CDS" "8" "2017\-10\-02" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dnssec-cds \- change DS records for a child zone based on CDS/CDNSKEY
.SH "SYNOPSIS"
.HP \w'\fBdnssec\-cds\fR\ 'u
\fBdnssec\-cds\fR [\fB\-a\ \fR\fB\fIalg\fR\fR...] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-D\fR] {\fB\-d\ \fR\fB\fIdsset\-file\fR\fR} {\fB\-f\ \fR\fB\fIchild\-file\fR\fR} [\fB\-i\fR\ [\fIextension\fR]] [\fB\-s\ \fR\fB\fIstart\-time\fR\fR] [\fB\-T\ \fR\fB\fIttl\fR\fR] [\fB\-u\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-V\fR] {domain}
.SH "DESCRIPTION"
.PP
The
\fBdnssec\-cds\fR
command changes DS records at a delegation point based on CDS or CDNSKEY records published in the child zone\&. If both CDS and CDNSKEY records are present in the child zone, the CDS is preferred\&. This enables a child zone to inform its parent of upcoming changes to its key\-signing keys; by polling periodically with
\fBdnssec\-cds\fR, the parent can keep the DS records up to date and enable automatic rolling of KSKs\&.
.PP
Two input files are required\&. The
\fB\-f \fR\fB\fIchild\-file\fR\fR
option specifies a file containing the child\*(Aqs CDS and/or CDNSKEY records, plus RRSIG and DNSKEY records so that they can be authenticated\&. The
\fB\-d \fR\fB\fIpath\fR\fR
option specifies the location of a file containing the current DS records\&. For example, this could be a
dsset\-
file generated by
\fBdnssec\-signzone\fR, or the output of
\fBdnssec\-dsfromkey\fR, or the output of a previous run of
\fBdnssec\-cds\fR\&.
.PP
The
\fBdnssec\-cds\fR
command uses special DNSSEC validation logic specified by RFC 7344\&. It requires that the CDS and/or CDNSKEY records are validly signed by a key represented in the existing DS records\&. This will typicially be the pre\-existing key\-signing key (KSK)\&.
.PP
For protection against replay attacks, the signatures on the child records must not be older than they were on a previous run of
\fBdnssec\-cds\fR\&. This time is obtained from the modification time of the
dsset\-
file, or from the
\fB\-s\fR
option\&.
.PP
To protect against breaking the delegation,
\fBdnssec\-cds\fR
ensures that the DNSKEY RRset can be verified by every key algorithm in the new DS RRset, and that the same set of keys are covered by every DS digest type\&.
.PP
By default, replacement DS records are written to the standard output; with the
\fB\-i\fR
option the input file is overwritten in place\&. The replacement DS records will be the same as the existing records when no change is required\&. The output can be empty if the CDS / CDNSKEY records specify that the child zone wants to go insecure\&.
.PP
Warning: Be careful not to delete the DS records when
\fBdnssec\-cds\fR
fails!
.PP
Alternatively,
\fBdnssec\-cds \-u\fR
writes an
\fBnsupdate\fR
script to the standard output\&. You can use the
\fB\-u\fR
and
\fB\-i\fR
options together to maintain a
dsset\-
file as well as emit an
\fBnsupdate\fR
script\&.
.SH "OPTIONS"
.PP
\-a \fIalgorithm\fR
.RS 4
Specify a digest algorithm to use when converting CDNSKEY records to DS records\&. This option can be repeated, so that multiple DS records are created for each CDNSKEY record\&. This option has no effect when using CDS records\&.
.sp
The
\fIalgorithm\fR
must be one of SHA\-1, SHA\-256, or SHA\-384\&. These values are case insensitive, and the hyphen may be omitted\&. If no algorithm is specified, the default is SHA\-256\&.
.RE
.PP
\-c \fIclass\fR
.RS 4
Specifies the DNS class of the zones\&.
.RE
.PP
\-D
.RS 4
Generate DS records from CDNSKEY records if both CDS and CDNSKEY records are present in the child zone\&. By default CDS records are preferred\&.
.RE
.PP
\-d \fIpath\fR
.RS 4
Location of the parent DS records\&. The
\fIpath\fR
can be the name of a file containing the DS records, or if it is a directory,
\fBdnssec\-cds\fR
looks for a
dsset\-
file for the
\fIdomain\fR
inside the directory\&.
.sp
To protect against replay attacks, child records are rejected if they were signed earlier than the modification time of the
dsset\-
file\&. This can be adjusted with the
\fB\-s\fR
option\&.
.RE
.PP
\-f \fIchild\-file\fR
.RS 4
File containing the child\*(Aqs CDS and/or CDNSKEY records, plus its DNSKEY records and the covering RRSIG records so that they can be authenticated\&.
.sp
The EXAMPLES below describe how to generate this file\&.
.RE
.PP
\-i [\fIextension\fR]
.RS 4
Update the
dsset\-
file in place, instead of writing DS records to the standard output\&.
.sp
There must be no space between the
\fB\-i\fR
and the
\fIextension\fR\&. If you provide no
\fIextension\fR
then the old
dsset\-
is discarded\&. If an
\fIextension\fR
is present, a backup of the old
dsset\-
file is kept with the
\fIextension\fR
appended to its filename\&.
.sp
To protect against replay attacks, the modification time of the
dsset\-
file is set to match the signature inception time of the child records, provided that is later than the file\*(Aqs current modification time\&.
.RE
.PP
\-s \fIstart\-time\fR
.RS 4
Specify the date and time after which RRSIG records become acceptable\&. This can be either an absolute or relative time\&. An absolute start time is indicated by a number in YYYYMMDDHHMMSS notation; 20170827133700 denotes 13:37:00 UTC on August 27th, 2017\&. A time relative to the
dsset\-
file is indicated with \-N, which is N seconds before the file modification time\&. A time relative to the current time is indicated with now+N\&.
.sp
If no
\fIstart\-time\fR
is specified, the modification time of the
dsset\-
file is used\&.
.RE
.PP
\-T \fIttl\fR
.RS 4
Specifies a TTL to be used for new DS records\&. If not specified, the default is the TTL of the old DS records\&. If they had no explicit TTL then the new DS records also have no explicit TTL\&.
.RE
.PP
\-u
.RS 4
Write an
\fBnsupdate\fR
script to the standard output, instead of printing the new DS reords\&. The output will be empty if no change is needed\&.
.sp
Note: The TTL of new records needs to be specified, either in the original
dsset\-
file, or with the
\fB\-T\fR
option, or using the
\fBnsupdate\fR\fBttl\fR
command\&.
.RE
.PP
\-V
.RS 4
Print version information\&.
.RE
.PP
\-v \fIlevel\fR
.RS 4
Sets the debugging level\&. Level 1 is intended to be usefully verbose for general users; higher levels are intended for developers\&.
.RE
.PP
\fIdomain\fR
.RS 4
The name of the delegation point / child zone apex\&.
.RE
.SH "EXIT STATUS"
.PP
The
\fBdnssec\-cds\fR
command exits 0 on success, or non\-zero if an error occurred\&.
.PP
In the success case, the DS records might or might not need to be changed\&.
.SH "EXAMPLES"
.PP
Before running
\fBdnssec\-signzone\fR, you can ensure that the delegations are up\-to\-date by running
\fBdnssec\-cds\fR
on every
dsset\-
file\&.
.PP
To fetch the child records required by
\fBdnssec\-cds\fR
you can invoke
\fBdig\fR
as in the script below\&. It\*(Aqs okay if the
\fBdig\fR
fails since
\fBdnssec\-cds\fR
performs all the necessary checking\&.
.sp
.if n \{\
.RS 4
.\}
.nf
for f in dsset\-*
do
d=${f#dsset\-}
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec\-cds \-i \-f /dev/stdin \-d $f $d
done
.fi
.if n \{\
.RE
.\}
.PP
When the parent zone is automatically signed by
\fBnamed\fR, you can use
\fBdnssec\-cds\fR
with
\fBnsupdate\fR
to maintain a delegation as follows\&. The
dsset\-
file allows the script to avoid having to fetch and validate the parent DS records, and it keeps the replay attack protection time\&.
.sp
.if n \{\
.RS 4
.\}
.nf
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec\-cds \-u \-i \-f /dev/stdin \-d $f $d |
nsupdate \-l
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
\fBdig\fR(1),
\fBdnssec-settime\fR(8),
\fBdnssec-signzone\fR(8),
\fBnsupdate\fR(1),
BIND 9 Administrator Reference Manual,
RFC 7344\&.
.SH "AUTHORS"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.PP
\fBTony Finch\fR <\&dot@dotat\&.at\&>, <\&fanf2@cam\&.ac\&.uk\&>
.br
.RS 4
.RE
.SH "COPYRIGHT"
.br
Copyright \(co 2017-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -55,7 +55,7 @@
#if USE_PKCS11
#include <pk11/result.h>
#endif
#endif /* if USE_PKCS11 */
#include "dnssectool.h"
@@ -75,9 +75,9 @@ static dns_fixedname_t fixed;
static dns_name_t *name = NULL;
static dns_rdataclass_t rdclass = dns_rdataclass_in;
static const char *startstr = NULL; /* from which we derive notbefore */
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
static dns_rdata_rrsig_t oldestsig; /* for recording inception time */
static const char *startstr = NULL; /* from which we derive notbefore */
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
static dns_rdata_rrsig_t oldestsig; /* for recording inception time */
static int nkey; /* number of child zone DNSKEY records */
@@ -131,7 +131,7 @@ static dns_rdataset_t old_ds_set, new_ds_set;
static keyinfo_t *old_key_tbl, *new_key_tbl;
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
static void
verbose_time(int level, const char *msg, isc_stdtime_t time) {
@@ -150,8 +150,7 @@ verbose_time(int level, const char *msg, isc_stdtime_t time) {
if (verbose < 3) {
vbprintf(level, "%s %s\n", msg, timestr);
} else {
vbprintf(level, "%s %s (%" PRIu32 ")\n",
msg, timestr, time);
vbprintf(level, "%s %s (%" PRIu32 ")\n", msg, timestr, time);
}
}
@@ -173,16 +172,15 @@ initname(char *setname) {
static void
findset(dns_db_t *db, dns_dbnode_t *node, dns_rdatatype_t type,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
{
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
isc_result_t result;
dns_rdataset_init(rdataset);
if (sigrdataset != NULL) {
dns_rdataset_init(sigrdataset);
}
result = dns_db_findrdataset(db, node, NULL, type, 0, 0,
rdataset, sigrdataset);
result = dns_db_findrdataset(db, node, NULL, type, 0, 0, rdataset,
sigrdataset);
if (result != ISC_R_NOTFOUND) {
check_result(result, "dns_db_findrdataset()");
}
@@ -206,8 +204,7 @@ freelist(dns_rdataset_t *rdataset) {
dns_rdatalist_fromrdataset(rdataset, &rdlist);
for (rdata = ISC_LIST_HEAD(rdlist->rdata);
rdata != NULL;
for (rdata = ISC_LIST_HEAD(rdlist->rdata); rdata != NULL;
rdata = ISC_LIST_HEAD(rdlist->rdata))
{
ISC_LIST_UNLINK(rdlist->rdata, rdata, link);
@@ -236,15 +233,14 @@ static void
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
isc_result_t result;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
rdclass, 0, NULL, dbp);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, dbp);
check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename,
dns_masterformat_text, DNS_MASTER_HINT);
result = dns_db_load(*dbp, filename, dns_masterformat_text,
DNS_MASTER_HINT);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
fatal("can't load %s: %s", filename,
isc_result_totext(result));
fatal("can't load %s: %s", filename, isc_result_totext(result));
}
result = dns_db_findnode(*dbp, name, false, nodep);
@@ -272,9 +268,8 @@ load_child_sets(const char *file) {
}
static void
get_dsset_name(char *filename, size_t size,
const char *path, const char *suffix)
{
get_dsset_name(char *filename, size_t size, const char *path,
const char *suffix) {
isc_result_t result;
isc_buffer_t buf;
size_t len;
@@ -318,7 +313,7 @@ get_dsset_name(char *filename, size_t size,
static void
load_parent_set(const char *path) {
isc_result_t result;
dns_db_t *db = NULL;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_time_t modtime;
char filename[PATH_MAX + 1];
@@ -327,8 +322,8 @@ load_parent_set(const char *path) {
result = isc_file_getmodtime(filename, &modtime);
if (result != ISC_R_SUCCESS) {
fatal("could not get modification time of %s: %s",
filename, isc_result_totext(result));
fatal("could not get modification time of %s: %s", filename,
isc_result_totext(result));
}
notbefore = isc_time_seconds(&modtime);
if (startstr != NULL) {
@@ -342,8 +337,8 @@ load_parent_set(const char *path) {
findset(db, node, dns_rdatatype_ds, &old_ds_set, NULL);
if (!dns_rdataset_isassociated(&old_ds_set)) {
fatal("could not find DS records for %s in %s",
namestr, filename);
fatal("could not find DS records for %s in %s", namestr,
filename);
}
free_db(&db, &node);
@@ -365,9 +360,8 @@ formatset(dns_rdataset_t *rdataset) {
* which just separates fields with spaces. The huge tab stop width
* eliminates any tab characters.
*/
result = dns_master_stylecreate(&style, styleflags,
0, 0, 0, 0, 0, 1000000, 0,
mctx);
result = dns_master_stylecreate(&style, styleflags, 0, 0, 0, 0, 0,
1000000, 0, mctx);
check_result(result, "dns_master_stylecreate2 failed");
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
@@ -387,9 +381,8 @@ formatset(dns_rdataset_t *rdataset) {
}
static void
write_parent_set(const char *path, const char *inplace,
bool nsupdate, dns_rdataset_t *rdataset)
{
write_parent_set(const char *path, const char *inplace, bool nsupdate,
dns_rdataset_t *rdataset) {
isc_result_t result;
isc_buffer_t *buf = NULL;
isc_region_t r;
@@ -440,8 +433,8 @@ write_parent_set(const char *path, const char *inplace,
result = isc_file_settime(tmpname, &filetime);
if (result != ISC_R_SUCCESS) {
isc_file_remove(tmpname);
fatal("can't set modification time of %s: %s",
tmpname, isc_result_totext(result));
fatal("can't set modification time of %s: %s", tmpname,
isc_result_totext(result));
}
if (inplace[0] != '\0') {
@@ -456,13 +449,11 @@ typedef enum { LOOSE, TIGHT } strictness_t;
* Find out if any (C)DS record matches a particular (C)DNSKEY.
*/
static bool
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
{
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
isc_result_t result;
unsigned char dsbuf[DNS_DS_BUFFERSIZE];
for (result = dns_rdataset_first(dsset);
result == ISC_R_SUCCESS;
for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(dsset))
{
dns_rdata_ds_t ds;
@@ -481,7 +472,8 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
result = dns_ds_buildrdata(name, &ki->rdata, ds.digest_type,
dsbuf, &newdsrdata);
if (result != ISC_R_SUCCESS) {
vbprintf(3, "dns_ds_buildrdata("
vbprintf(3,
"dns_ds_buildrdata("
"keytag=%d, algo=%d, digest=%d): %s\n",
ds.key_tag, ds.algorithm, ds.digest_type,
dns_result_totext(result));
@@ -492,23 +484,22 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
dsrdata.type = dns_rdatatype_ds;
if (dns_rdata_compare(&dsrdata, &newdsrdata) == 0) {
vbprintf(1, "found matching %s %d %d %d\n",
c ? "CDS" : "DS",
ds.key_tag, ds.algorithm, ds.digest_type);
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return (true);
} else if (strictness == TIGHT) {
vbprintf(0, "key does not match %s %d %d %d "
"when it looks like it should\n",
c ? "CDS" : "DS",
ds.key_tag, ds.algorithm, ds.digest_type);
vbprintf(0,
"key does not match %s %d %d %d "
"when it looks like it should\n",
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return (false);
}
}
vbprintf(1, "no matching %s for %s %d %d\n",
dsset->type == dns_rdatatype_cds
? "CDS" : "DS",
ki->rdata.type == dns_rdatatype_cdnskey
? "CDNSKEY" : "DNSKEY",
dsset->type == dns_rdatatype_cds ? "CDS" : "DS",
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
ki->tag, ki->algo);
return (false);
@@ -520,8 +511,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
*/
static keyinfo_t *
match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
strictness_t strictness)
{
strictness_t strictness) {
isc_result_t result;
keyinfo_t *keytable;
int i;
@@ -531,8 +521,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
for (result = dns_rdataset_first(keyset), i = 0;
result == ISC_R_SUCCESS;
result = dns_rdataset_next(keyset), i++)
result == ISC_R_SUCCESS; result = dns_rdataset_next(keyset), i++)
{
keyinfo_t *ki;
dns_rdata_dnskey_t dnskey;
@@ -558,13 +547,13 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
continue;
}
result = dns_dnssec_keyfromrdata(name, keyrdata,
mctx, &ki->dst);
result = dns_dnssec_keyfromrdata(name, keyrdata, mctx,
&ki->dst);
if (result != ISC_R_SUCCESS) {
vbprintf(3, "dns_dnssec_keyfromrdata("
vbprintf(3,
"dns_dnssec_keyfromrdata("
"keytag=%d, algo=%d): %s\n",
ki->tag, ki->algo,
dns_result_totext(result));
ki->tag, ki->algo, dns_result_totext(result));
}
}
@@ -599,8 +588,7 @@ free_keytable(keyinfo_t **keytable_p) {
*/
static dns_secalg_t *
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
dns_rdataset_t *sigset)
{
dns_rdataset_t *sigset) {
isc_result_t result;
dns_secalg_t *algo;
int i;
@@ -608,8 +596,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
algo = isc_mem_get(mctx, nkey);
memset(algo, 0, nkey);
for (result = dns_rdataset_first(sigset);
result == ISC_R_SUCCESS;
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(sigset))
{
dns_rdata_t sigrdata = DNS_RDATA_INIT;
@@ -630,26 +617,27 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
for (i = 0; i < nkey; i++) {
keyinfo_t *ki = &keytbl[i];
if (sig.keyid != ki->tag ||
sig.algorithm != ki->algo ||
if (sig.keyid != ki->tag || sig.algorithm != ki->algo ||
!dns_name_equal(&sig.signer, name))
{
continue;
}
if (ki->dst == NULL) {
vbprintf(1, "skip RRSIG by key %d:"
vbprintf(1,
"skip RRSIG by key %d:"
" no matching (C)DS\n",
sig.keyid);
continue;
}
result = dns_dnssec_verify(name, rdataset, ki->dst,
false, 0, mctx,
&sigrdata, NULL);
false, 0, mctx, &sigrdata,
NULL);
if (result != ISC_R_SUCCESS &&
result != DNS_R_FROMWILDCARD) {
vbprintf(1, "skip RRSIG by key %d:"
vbprintf(1,
"skip RRSIG by key %d:"
" verification failed: %s\n",
sig.keyid, isc_result_totext(result));
continue;
@@ -663,8 +651,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
* only after the signature has been verified
*/
if (oldestsig.timesigned == 0 ||
isc_serial_lt(sig.timesigned,
oldestsig.timesigned))
isc_serial_lt(sig.timesigned, oldestsig.timesigned))
{
verbose_time(2, "this is the oldest so far",
sig.timesigned);
@@ -704,8 +691,7 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
isc_result_t result;
bool all_ok = true;
for (result = dns_rdataset_first(dsset);
result == ISC_R_SUCCESS;
for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(dsset))
{
dns_rdata_t dsrdata = DNS_RDATA_INIT;
@@ -724,8 +710,10 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
}
}
if (!ds_ok) {
vbprintf(0, "missing signature for algorithm %d "
"(key %d)\n", ds.algorithm, ds.key_tag);
vbprintf(0,
"missing signature for algorithm %d "
"(key %d)\n",
ds.algorithm, ds.key_tag);
all_ok = false;
}
}
@@ -766,26 +754,29 @@ ds_from_cds(dns_rdatalist_t *dslist, isc_buffer_t *buf, dns_rdata_t *cds) {
dns_rdata_ds_t ds;
dns_rdata_t *rdata;
REQUIRE(buf != NULL);
rdata = rdata_get();
result = dns_rdata_tostruct(cds, &ds, NULL);
check_result(result, "dns_rdata_tostruct(CDS)");
ds.common.rdtype = dns_rdatatype_ds;
result = dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ds,
&ds, buf);
result = dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ds, &ds,
buf);
return (rdata_put(result, dslist, rdata));
}
static isc_result_t
ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
dns_rdata_t *cdnskey)
{
dns_rdata_t *cdnskey) {
isc_result_t result;
unsigned i, n;
n = sizeof(dtype)/sizeof(dtype[0]);
REQUIRE(buf != NULL);
n = sizeof(dtype) / sizeof(dtype[0]);
for (i = 0; i < n; i++) {
if (dtype[i] != 0) {
dns_rdata_t *rdata;
@@ -814,9 +805,8 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
}
static void
make_new_ds_set(ds_maker_func_t *ds_from_rdata,
uint32_t ttl, dns_rdataset_t *rdset)
{
make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
dns_rdataset_t *rdset) {
unsigned int size = 16;
for (;;) {
isc_result_t result;
@@ -836,8 +826,7 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata,
isc_buffer_allocate(mctx, &new_ds_buf, size);
for (result = dns_rdataset_first(rdset);
result == ISC_R_SUCCESS;
result = dns_rdataset_next(rdset))
result == ISC_R_SUCCESS; result = dns_rdataset_next(rdset))
{
isc_result_t tresult;
dns_rdata_t rdata = DNS_RDATA_INIT;
@@ -891,8 +880,7 @@ consistent_digests(dns_rdataset_t *dsset) {
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
for (result = dns_rdataset_first(dsset), i = 0;
result == ISC_R_SUCCESS;
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
result = dns_rdataset_next(dsset), i++)
{
dns_rdata_init(&arrdata[i]);
@@ -929,10 +917,10 @@ consistent_digests(dns_rdataset_t *dsset) {
while (i < n) {
key_tag = ds[i].key_tag;
algorithm = ds[i].algorithm;
for (j = 0; j < d && i+j < n; j++) {
if (ds[i+j].key_tag != key_tag ||
ds[i+j].algorithm != algorithm ||
ds[i+j].digest_type != ds[j].digest_type)
for (j = 0; j < d && i + j < n; j++) {
if (ds[i + j].key_tag != key_tag ||
ds[i + j].algorithm != algorithm ||
ds[i + j].digest_type != ds[j].digest_type)
{
match = false;
}
@@ -969,9 +957,8 @@ print_diff(const char *cmd, dns_rdataset_t *rdataset) {
}
static void
update_diff(const char *cmd, uint32_t ttl,
dns_rdataset_t *addset, dns_rdataset_t *delset)
{
update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_t *delset) {
isc_result_t result;
dns_db_t *db;
dns_dbnode_t *node;
@@ -980,8 +967,8 @@ update_diff(const char *cmd, uint32_t ttl,
uint32_t save;
db = NULL;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
check_result(result, "dns_db_create()");
ver = NULL;
@@ -994,12 +981,11 @@ update_diff(const char *cmd, uint32_t ttl,
dns_rdataset_init(&diffset);
result = dns_db_addrdataset(db, node, ver, 0, addset,
DNS_DBADD_MERGE, NULL);
result = dns_db_addrdataset(db, node, ver, 0, addset, DNS_DBADD_MERGE,
NULL);
check_result(result, "dns_db_addrdataset()");
result = dns_db_subtractrdataset(db, node, ver, delset,
0, &diffset);
result = dns_db_subtractrdataset(db, node, ver, delset, 0, &diffset);
if (result == DNS_R_UNCHANGED) {
save = addset->ttl;
addset->ttl = ttl;
@@ -1045,18 +1031,22 @@ usage(void) {
program);
fprintf(stderr, "Version: %s\n", VERSION);
fprintf(stderr, "Options:\n"
" -a <algorithm> digest algorithm (SHA-1 / SHA-256 / SHA-384)\n"
" -c <class> of domain (default IN)\n"
" -D prefer CDNSKEY records instead of CDS\n"
" -d <file|dir> where to find parent dsset- file\n"
" -f <file> child DNSKEY+CDNSKEY+CDS+RRSIG records\n"
" -i[extension] update dsset- file in place\n"
" -s <start-time> oldest permitted child signatures\n"
" -u emit nsupdate script\n"
" -T <ttl> TTL of DS records\n"
" -V print version\n"
" -v <verbosity>\n"
);
" -a <algorithm> digest algorithm (SHA-1 / "
"SHA-256 / SHA-384)\n"
" -c <class> of domain (default IN)\n"
" -D prefer CDNSKEY records instead "
"of CDS\n"
" -d <file|dir> where to find parent dsset- "
"file\n"
" -f <file> child DNSKEY+CDNSKEY+CDS+RRSIG "
"records\n"
" -i[extension] update dsset- file in place\n"
" -s <start-time> oldest permitted child "
"signatures\n"
" -u emit nsupdate script\n"
" -T <ttl> TTL of DS records\n"
" -V print version\n"
" -v <verbosity>\n");
exit(1);
}
@@ -1076,7 +1066,7 @@ main(int argc, char *argv[]) {
#if USE_PKCS11
pk11_result_register();
#endif
#endif /* if USE_PKCS11 */
dns_result_register();
isc_commandline_errprint = false;
@@ -1105,8 +1095,7 @@ main(int argc, char *argv[]) {
* so that it works just like sed(1).
*/
if (isc_commandline_argument ==
argv[isc_commandline_index - 1])
{
argv[isc_commandline_index - 1]) {
isc_commandline_index--;
inplace = "";
} else {
@@ -1115,7 +1104,7 @@ main(int argc, char *argv[]) {
break;
case 'm':
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
ISC_MEM_DEBUGRECORD;
ISC_MEM_DEBUGRECORD;
break;
case 's':
startstr = isc_commandline_argument;
@@ -1198,8 +1187,7 @@ main(int argc, char *argv[]) {
fatal("missing RRSIG CDNSKEY records for %s", namestr);
}
if (dns_rdataset_isassociated(&cds_set) &&
!dns_rdataset_isassociated(&cds_sig))
{
!dns_rdataset_isassociated(&cds_sig)) {
fatal("missing RRSIG CDS records for %s", namestr);
}
@@ -1220,18 +1208,16 @@ main(int argc, char *argv[]) {
if (dns_rdataset_isassociated(&cdnskey_set)) {
vbprintf(1, "verify CDNSKEY signature(s)\n");
if (!signed_loose(matching_sigs(old_key_tbl,
&cdnskey_set, &cdnskey_sig)))
{
if (!signed_loose(matching_sigs(old_key_tbl, &cdnskey_set,
&cdnskey_sig))) {
fatal("could not validate child CDNSKEY RRset for %s",
namestr);
}
}
if (dns_rdataset_isassociated(&cds_set)) {
vbprintf(1, "verify CDS signature(s)\n");
if (!signed_loose(matching_sigs(old_key_tbl,
&cds_set, &cds_sig)))
{
if (!signed_loose(
matching_sigs(old_key_tbl, &cds_set, &cds_sig))) {
fatal("could not validate child CDS RRset for %s",
namestr);
}
@@ -1248,12 +1234,11 @@ main(int argc, char *argv[]) {
dns_rdatatype_format(oldestsig.covered, type, sizeof(type));
verbose_time(1, "child signature inception time",
oldestsig.timesigned);
vbprintf(2, "from RRSIG %s by key %d\n",
type, oldestsig.keyid);
vbprintf(2, "from RRSIG %s by key %d\n", type, oldestsig.keyid);
}
/*
* Sucessfully do nothing if there's neither CDNSKEY nor CDS
* Successfully do nothing if there's neither CDNSKEY nor CDS
* RFC 7344 section 4.1 first paragraph
*/
if (!dns_rdataset_isassociated(&cdnskey_set) &&
@@ -1286,16 +1271,17 @@ main(int argc, char *argv[]) {
if (!consistent_digests(&new_ds_set)) {
fatal("CDS records at %s do not cover each key "
"with the same set of digest types", namestr);
"with the same set of digest types",
namestr);
}
vbprintf(1, "verify DNSKEY signature(s)\n");
if (!signed_strict(&new_ds_set,
matching_sigs(new_key_tbl,
&dnskey_set, &dnskey_sig)))
if (!signed_strict(&new_ds_set, matching_sigs(new_key_tbl, &dnskey_set,
&dnskey_sig)))
{
fatal("could not validate child DNSKEY RRset "
"with new DS records for %s", namestr);
"with new DS records for %s",
namestr);
}
free_keytable(&new_key_tbl);

View File

@@ -1,390 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.dnssec-cds">
<info>
<date>2017-10-02</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
<author>
<personname>Tony Finch</personname>
<email>dot@dotat.at</email>
<email>fanf2@cam.ac.uk</email>
<affiliation>Cambridge University Information Services</affiliation>
<personblurb></personblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle><application>dnssec-cds</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>dnssec-cds</application></refname>
<refpurpose>change DS records for a child zone based on CDS/CDNSKEY</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2017</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>dnssec-cds</command>
<arg choice="opt" rep="repeat"><option>-a <replaceable class="parameter">alg</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D</option></arg>
<arg choice="req" rep="norepeat"><option>-d <replaceable class="parameter">dsset-file</replaceable></option></arg>
<arg choice="req" rep="norepeat"><option>-f <replaceable class="parameter">child-file</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-i</option><arg choice="opt" rep="norepeat"><replaceable class="parameter">extension</replaceable></arg></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">start-time</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">ttl</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-u</option></arg>
<arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-V</option></arg>
<arg choice="req" rep="norepeat">domain</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para>
The <command>dnssec-cds</command> command changes DS records at
a delegation point based on CDS or CDNSKEY records published in
the child zone. If both CDS and CDNSKEY records are present in
the child zone, the CDS is preferred. This enables a child zone
to inform its parent of upcoming changes to its key-signing keys;
by polling periodically with <command>dnssec-cds</command>, the
parent can keep the DS records up to date and enable automatic
rolling of KSKs.
</para>
<para>
Two input files are required. The
<option>-f <replaceable class="parameter">child-file</replaceable></option>
option specifies a file containing the child's CDS and/or CDNSKEY
records, plus RRSIG and DNSKEY records so that they can be
authenticated. The
<option>-d <replaceable class="parameter">path</replaceable></option>
option specifies the location of a file containing the current DS
records. For example, this could be a <filename>dsset-</filename>
file generated by <command>dnssec-signzone</command>, or the output of
<command>dnssec-dsfromkey</command>, or the output of a previous
run of <command>dnssec-cds</command>.
</para>
<para>
The <command>dnssec-cds</command> command uses special DNSSEC
validation logic specified by RFC 7344. It requires that the CDS
and/or CDNSKEY records are validly signed by a key represented in the
existing DS records. This will typicially be the pre-existing
key-signing key (KSK).
</para>
<para>
For protection against replay attacks, the signatures on the
child records must not be older than they were on a previous run
of <command>dnssec-cds</command>. This time is obtained from the
modification time of the <filename>dsset-</filename> file, or
from the <option>-s</option> option.
</para>
<para>
To protect against breaking the delegation,
<command>dnssec-cds</command> ensures that the DNSKEY RRset can be
verified by every key algorithm in the new DS RRset, and that the
same set of keys are covered by every DS digest type.
</para>
<para>
By default, replacement DS records are written to the standard
output; with the <option>-i</option> option the input file is
overwritten in place. The replacement DS records will be the
same as the existing records when no change is required. The
output can be empty if the CDS / CDNSKEY records specify that
the child zone wants to go insecure.
</para>
<para>
Warning: Be careful not to delete the DS records
when <command>dnssec-cds</command> fails!
</para>
<para>
Alternatively, <command>dnssec-cds -u</command> writes
an <command>nsupdate</command> script to the standard output.
You can use the <option>-u</option> and <option>-i</option>
options together to maintain a <filename>dsset-</filename> file
as well as emit an <command>nsupdate</command> script.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-a <replaceable class="parameter">algorithm</replaceable></term>
<listitem>
<para>
Specify a digest algorithm to use when converting CDNSKEY
records to DS records. This option can be repeated, so
that multiple DS records are created for each CDNSKEY
record. This option has no effect when using CDS records.
</para>
<para>
The <replaceable>algorithm</replaceable> must be one of
SHA-1, SHA-256, or SHA-384. These values are case insensitive,
and the hyphen may be omitted. If no algorithm is specified,
the default is SHA-256.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c <replaceable class="parameter">class</replaceable></term>
<listitem>
<para>
Specifies the DNS class of the zones.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Generate DS records from CDNSKEY records if both CDS and
CDNSKEY records are present in the child zone. By default
CDS records are preferred.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d <replaceable class="parameter">path</replaceable></term>
<listitem>
<para>
Location of the parent DS records.
The <replaceable>path</replaceable> can be the name of a file
containing the DS records, or if it is a
directory, <command>dnssec-cds</command> looks for
a <filename>dsset-</filename> file for
the <replaceable>domain</replaceable> inside the directory.
</para>
<para>
To protect against replay attacks, child records are
rejected if they were signed earlier than the modification
time of the <filename>dsset-</filename> file. This can be
adjusted with the <option>-s</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-f <replaceable class="parameter">child-file</replaceable></term>
<listitem>
<para>
File containing the child's CDS and/or CDNSKEY records,
plus its DNSKEY records and the covering RRSIG records so
that they can be authenticated.
</para>
<para>
The EXAMPLES below describe how to generate this file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-i<arg choice="opt" rep="norepeat"><replaceable class="parameter">extension</replaceable></arg></term>
<listitem>
<para>
Update the <filename>dsset-</filename> file in place,
instead of writing DS records to the standard output.
</para>
<para>
There must be no space between the <option>-i</option> and
the <replaceable>extension</replaceable>. If you provide
no <replaceable>extension</replaceable> then the
old <filename>dsset-</filename> is discarded. If
an <replaceable>extension</replaceable> is present, a
backup of the old <filename>dsset-</filename> file is kept
with the <replaceable>extension</replaceable> appended to
its filename.
</para>
<para>
To protect against replay attacks, the modification time
of the <filename>dsset-</filename> file is set to match
the signature inception time of the child records,
provided that is later than the file's current
modification time.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s <replaceable class="parameter">start-time</replaceable></term>
<listitem>
<para>
Specify the date and time after which RRSIG records become
acceptable. This can be either an absolute or relative
time. An absolute start time is indicated by a number in
YYYYMMDDHHMMSS notation; 20170827133700 denotes 13:37:00
UTC on August 27th, 2017. A time relative to
the <filename>dsset-</filename> file is indicated with -N,
which is N seconds before the file modification time. A
time relative to the current time is indicated with now+N.
</para>
<para>
If no <replaceable>start-time</replaceable> is specified, the
modification time of the <filename>dsset-</filename> file
is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-T <replaceable class="parameter">ttl</replaceable></term>
<listitem>
<para>
Specifies a TTL to be used for new DS records. If not
specified, the default is the TTL of the old DS records.
If they had no explicit TTL then the new DS records also
have no explicit TTL.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Write an <command>nsupdate</command> script to the
standard output, instead of printing the new DS reords.
The output will be empty if no change is needed.
</para>
<para>
Note: The TTL of new records needs to be specified, either
in the original <filename>dsset-</filename> file, or with
the <option>-T</option> option, or using
the <command>nsupdate</command> <command>ttl</command>
command.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-V</term>
<listitem>
<para>
Print version information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v <replaceable class="parameter">level</replaceable></term>
<listitem>
<para>
Sets the debugging level. Level 1 is intended to be
usefully verbose for general users; higher levels are
intended for developers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>domain</replaceable></term>
<listitem>
<para>
The name of the delegation point / child zone apex.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>EXIT STATUS</title></info>
<para>
The <command>dnssec-cds</command> command exits 0 on success, or
non-zero if an error occurred.
</para>
<para>
In the success case, the DS records might or might not need
to be changed.
</para>
</refsection>
<refsection><info><title>EXAMPLES</title></info>
<para>
Before running <command>dnssec-signzone</command>, you can ensure
that the delegations are up-to-date by running
<command>dnssec-cds</command> on every <filename>dsset-</filename> file.
</para>
<para>
To fetch the child records required by <command>dnssec-cds</command>
you can invoke <command>dig</command> as in the script below. It's
okay if the <command>dig</command> fails since
<command>dnssec-cds</command> performs all the necessary checking.
</para>
<programlisting>for f in dsset-*
do
d=${f#dsset-}
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec-cds -i -f /dev/stdin -d $f $d
done
</programlisting>
<para>
When the parent zone is automatically signed by
<command>named</command>, you can use <command>dnssec-cds</command>
with <command>nsupdate</command> to maintain a delegation as follows.
The <filename>dsset-</filename> file allows the script to avoid
having to fetch and validate the parent DS records, and it keeps the
replay attack protection time.
</para>
<programlisting>
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec-cds -u -i -f /dev/stdin -d $f $d |
nsupdate -l
</programlisting>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para>
<citerefentry>
<refentrytitle>dig</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>dnssec-settime</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>dnssec-signzone</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>nsupdate</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>,
<citetitle>RFC 7344</citetitle>.
</para>
</refsection>
</refentry>

View File

@@ -1,343 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>dnssec-cds</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.dnssec-cds"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
<span class="application">dnssec-cds</span>
&#8212; change DS records for a child zone based on CDS/CDNSKEY
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">dnssec-cds</code>
[<code class="option">-a <em class="replaceable"><code>alg</code></em></code>...]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-D</code>]
{<code class="option">-d <em class="replaceable"><code>dsset-file</code></em></code>}
{<code class="option">-f <em class="replaceable"><code>child-file</code></em></code>}
[<code class="option">-i</code> [<em class="replaceable"><code>extension</code></em>]]
[<code class="option">-s <em class="replaceable"><code>start-time</code></em></code>]
[<code class="option">-T <em class="replaceable"><code>ttl</code></em></code>]
[<code class="option">-u</code>]
[<code class="option">-v <em class="replaceable"><code>level</code></em></code>]
[<code class="option">-V</code>]
{domain}
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p>
The <span class="command"><strong>dnssec-cds</strong></span> command changes DS records at
a delegation point based on CDS or CDNSKEY records published in
the child zone. If both CDS and CDNSKEY records are present in
the child zone, the CDS is preferred. This enables a child zone
to inform its parent of upcoming changes to its key-signing keys;
by polling periodically with <span class="command"><strong>dnssec-cds</strong></span>, the
parent can keep the DS records up to date and enable automatic
rolling of KSKs.
</p>
<p>
Two input files are required. The
<code class="option">-f <em class="replaceable"><code>child-file</code></em></code>
option specifies a file containing the child's CDS and/or CDNSKEY
records, plus RRSIG and DNSKEY records so that they can be
authenticated. The
<code class="option">-d <em class="replaceable"><code>path</code></em></code>
option specifies the location of a file containing the current DS
records. For example, this could be a <code class="filename">dsset-</code>
file generated by <span class="command"><strong>dnssec-signzone</strong></span>, or the output of
<span class="command"><strong>dnssec-dsfromkey</strong></span>, or the output of a previous
run of <span class="command"><strong>dnssec-cds</strong></span>.
</p>
<p>
The <span class="command"><strong>dnssec-cds</strong></span> command uses special DNSSEC
validation logic specified by RFC 7344. It requires that the CDS
and/or CDNSKEY records are validly signed by a key represented in the
existing DS records. This will typicially be the pre-existing
key-signing key (KSK).
</p>
<p>
For protection against replay attacks, the signatures on the
child records must not be older than they were on a previous run
of <span class="command"><strong>dnssec-cds</strong></span>. This time is obtained from the
modification time of the <code class="filename">dsset-</code> file, or
from the <code class="option">-s</code> option.
</p>
<p>
To protect against breaking the delegation,
<span class="command"><strong>dnssec-cds</strong></span> ensures that the DNSKEY RRset can be
verified by every key algorithm in the new DS RRset, and that the
same set of keys are covered by every DS digest type.
</p>
<p>
By default, replacement DS records are written to the standard
output; with the <code class="option">-i</code> option the input file is
overwritten in place. The replacement DS records will be the
same as the existing records when no change is required. The
output can be empty if the CDS / CDNSKEY records specify that
the child zone wants to go insecure.
</p>
<p>
Warning: Be careful not to delete the DS records
when <span class="command"><strong>dnssec-cds</strong></span> fails!
</p>
<p>
Alternatively, <span class="command"><strong>dnssec-cds -u</strong></span> writes
an <span class="command"><strong>nsupdate</strong></span> script to the standard output.
You can use the <code class="option">-u</code> and <code class="option">-i</code>
options together to maintain a <code class="filename">dsset-</code> file
as well as emit an <span class="command"><strong>nsupdate</strong></span> script.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-a <em class="replaceable"><code>algorithm</code></em></span></dt>
<dd>
<p>
Specify a digest algorithm to use when converting CDNSKEY
records to DS records. This option can be repeated, so
that multiple DS records are created for each CDNSKEY
record. This option has no effect when using CDS records.
</p>
<p>
The <em class="replaceable"><code>algorithm</code></em> must be one of
SHA-1, SHA-256, or SHA-384. These values are case insensitive,
and the hyphen may be omitted. If no algorithm is specified,
the default is SHA-256.
</p>
</dd>
<dt><span class="term">-c <em class="replaceable"><code>class</code></em></span></dt>
<dd>
<p>
Specifies the DNS class of the zones.
</p>
</dd>
<dt><span class="term">-D</span></dt>
<dd>
<p>
Generate DS records from CDNSKEY records if both CDS and
CDNSKEY records are present in the child zone. By default
CDS records are preferred.
</p>
</dd>
<dt><span class="term">-d <em class="replaceable"><code>path</code></em></span></dt>
<dd>
<p>
Location of the parent DS records.
The <em class="replaceable"><code>path</code></em> can be the name of a file
containing the DS records, or if it is a
directory, <span class="command"><strong>dnssec-cds</strong></span> looks for
a <code class="filename">dsset-</code> file for
the <em class="replaceable"><code>domain</code></em> inside the directory.
</p>
<p>
To protect against replay attacks, child records are
rejected if they were signed earlier than the modification
time of the <code class="filename">dsset-</code> file. This can be
adjusted with the <code class="option">-s</code> option.
</p>
</dd>
<dt><span class="term">-f <em class="replaceable"><code>child-file</code></em></span></dt>
<dd>
<p>
File containing the child's CDS and/or CDNSKEY records,
plus its DNSKEY records and the covering RRSIG records so
that they can be authenticated.
</p>
<p>
The EXAMPLES below describe how to generate this file.
</p>
</dd>
<dt><span class="term">-i[<em class="replaceable"><code>extension</code></em>]</span></dt>
<dd>
<p>
Update the <code class="filename">dsset-</code> file in place,
instead of writing DS records to the standard output.
</p>
<p>
There must be no space between the <code class="option">-i</code> and
the <em class="replaceable"><code>extension</code></em>. If you provide
no <em class="replaceable"><code>extension</code></em> then the
old <code class="filename">dsset-</code> is discarded. If
an <em class="replaceable"><code>extension</code></em> is present, a
backup of the old <code class="filename">dsset-</code> file is kept
with the <em class="replaceable"><code>extension</code></em> appended to
its filename.
</p>
<p>
To protect against replay attacks, the modification time
of the <code class="filename">dsset-</code> file is set to match
the signature inception time of the child records,
provided that is later than the file's current
modification time.
</p>
</dd>
<dt><span class="term">-s <em class="replaceable"><code>start-time</code></em></span></dt>
<dd>
<p>
Specify the date and time after which RRSIG records become
acceptable. This can be either an absolute or relative
time. An absolute start time is indicated by a number in
YYYYMMDDHHMMSS notation; 20170827133700 denotes 13:37:00
UTC on August 27th, 2017. A time relative to
the <code class="filename">dsset-</code> file is indicated with -N,
which is N seconds before the file modification time. A
time relative to the current time is indicated with now+N.
</p>
<p>
If no <em class="replaceable"><code>start-time</code></em> is specified, the
modification time of the <code class="filename">dsset-</code> file
is used.
</p>
</dd>
<dt><span class="term">-T <em class="replaceable"><code>ttl</code></em></span></dt>
<dd>
<p>
Specifies a TTL to be used for new DS records. If not
specified, the default is the TTL of the old DS records.
If they had no explicit TTL then the new DS records also
have no explicit TTL.
</p>
</dd>
<dt><span class="term">-u</span></dt>
<dd>
<p>
Write an <span class="command"><strong>nsupdate</strong></span> script to the
standard output, instead of printing the new DS reords.
The output will be empty if no change is needed.
</p>
<p>
Note: The TTL of new records needs to be specified, either
in the original <code class="filename">dsset-</code> file, or with
the <code class="option">-T</code> option, or using
the <span class="command"><strong>nsupdate</strong></span> <span class="command"><strong>ttl</strong></span>
command.
</p>
</dd>
<dt><span class="term">-V</span></dt>
<dd>
<p>
Print version information.
</p>
</dd>
<dt><span class="term">-v <em class="replaceable"><code>level</code></em></span></dt>
<dd>
<p>
Sets the debugging level. Level 1 is intended to be
usefully verbose for general users; higher levels are
intended for developers.
</p>
</dd>
<dt><span class="term"><em class="replaceable"><code>domain</code></em></span></dt>
<dd>
<p>
The name of the delegation point / child zone apex.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>EXIT STATUS</h2>
<p>
The <span class="command"><strong>dnssec-cds</strong></span> command exits 0 on success, or
non-zero if an error occurred.
</p>
<p>
In the success case, the DS records might or might not need
to be changed.
</p>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>EXAMPLES</h2>
<p>
Before running <span class="command"><strong>dnssec-signzone</strong></span>, you can ensure
that the delegations are up-to-date by running
<span class="command"><strong>dnssec-cds</strong></span> on every <code class="filename">dsset-</code> file.
</p>
<p>
To fetch the child records required by <span class="command"><strong>dnssec-cds</strong></span>
you can invoke <span class="command"><strong>dig</strong></span> as in the script below. It's
okay if the <span class="command"><strong>dig</strong></span> fails since
<span class="command"><strong>dnssec-cds</strong></span> performs all the necessary checking.
</p>
<pre class="programlisting">for f in dsset-*
do
d=${f#dsset-}
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec-cds -i -f /dev/stdin -d $f $d
done
</pre>
<p>
When the parent zone is automatically signed by
<span class="command"><strong>named</strong></span>, you can use <span class="command"><strong>dnssec-cds</strong></span>
with <span class="command"><strong>nsupdate</strong></span> to maintain a delegation as follows.
The <code class="filename">dsset-</code> file allows the script to avoid
having to fetch and validate the parent DS records, and it keeps the
replay attack protection time.
</p>
<pre class="programlisting">
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec-cds -u -i -f /dev/stdin -d $f $d |
nsupdate -l
</pre>
</div>
<div class="refsection">
<a name="id-1.11"></a><h2>SEE ALSO</h2>
<p>
<span class="citerefentry">
<span class="refentrytitle">dig</span>(1)
</span>,
<span class="citerefentry">
<span class="refentrytitle">dnssec-settime</span>(8)
</span>,
<span class="citerefentry">
<span class="refentrytitle">dnssec-signzone</span>(8)
</span>,
<span class="citerefentry">
<span class="refentrytitle">nsupdate</span>(1)
</span>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>,
<em class="citetitle">RFC 7344</em>.
</p>
</div>
</div></body>
</html>

212
bin/dnssec/dnssec-cds.rst Normal file
View File

@@ -0,0 +1,212 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_dnssec-cds:
dnssec-cds - change DS records for a child zone based on CDS/CDNSKEY
--------------------------------------------------------------------
Synopsis
~~~~~~~~
:program:`dnssec-cds` [**-a** alg...] [**-c** class] [**-D**] {**-d** dsset-file} {**-f** child-file} [**-i** [extension]] [**-s** start-time] [**-T** ttl] [**-u**] [**-v** level] [**-V**] {domain}
Description
~~~~~~~~~~~
The ``dnssec-cds`` command changes DS records at a delegation point
based on CDS or CDNSKEY records published in the child zone. If both CDS
and CDNSKEY records are present in the child zone, the CDS is preferred.
This enables a child zone to inform its parent of upcoming changes to
its key-signing keys; by polling periodically with ``dnssec-cds``, the
parent can keep the DS records up to date and enable automatic rolling
of KSKs.
Two input files are required. The ``-f child-file`` option specifies a
file containing the child's CDS and/or CDNSKEY records, plus RRSIG and
DNSKEY records so that they can be authenticated. The ``-d path`` option
specifies the location of a file containing the current DS records. For
example, this could be a ``dsset-`` file generated by
``dnssec-signzone``, or the output of ``dnssec-dsfromkey``, or the
output of a previous run of ``dnssec-cds``.
The ``dnssec-cds`` command uses special DNSSEC validation logic
specified by :rfc:`7344`. It requires that the CDS and/or CDNSKEY records
are validly signed by a key represented in the existing DS records. This
will typically be the pre-existing key-signing key (KSK).
For protection against replay attacks, the signatures on the child
records must not be older than they were on a previous run of
``dnssec-cds``. This time is obtained from the modification time of the
``dsset-`` file, or from the ``-s`` option.
To protect against breaking the delegation, ``dnssec-cds`` ensures that
the DNSKEY RRset can be verified by every key algorithm in the new DS
RRset, and that the same set of keys are covered by every DS digest
type.
By default, replacement DS records are written to the standard output;
with the ``-i`` option the input file is overwritten in place. The
replacement DS records will be the same as the existing records when no
change is required. The output can be empty if the CDS / CDNSKEY records
specify that the child zone wants to go insecure.
Warning: Be careful not to delete the DS records when ``dnssec-cds``
fails!
Alternatively, ``dnssec-cds -u`` writes an ``nsupdate`` script to the
standard output. You can use the ``-u`` and ``-i`` options together to
maintain a ``dsset-`` file as well as emit an ``nsupdate`` script.
Options
~~~~~~~
**-a** algorithm
Specify a digest algorithm to use when converting CDNSKEY records to
DS records. This option can be repeated, so that multiple DS records
are created for each CDNSKEY record. This option has no effect when
using CDS records.
The algorithm must be one of SHA-1, SHA-256, or SHA-384. These values
are case insensitive, and the hyphen may be omitted. If no algorithm
is specified, the default is SHA-256.
**-c** class
Specifies the DNS class of the zones.
**-D**
Generate DS records from CDNSKEY records if both CDS and CDNSKEY
records are present in the child zone. By default CDS records are
preferred.
**-d** path
Location of the parent DS records. The path can be the name of a file
containing the DS records, or if it is a directory, ``dnssec-cds``
looks for a ``dsset-`` file for the domain inside the directory.
To protect against replay attacks, child records are rejected if they
were signed earlier than the modification time of the ``dsset-``
file. This can be adjusted with the ``-s`` option.
**-f** child-file
File containing the child's CDS and/or CDNSKEY records, plus its
DNSKEY records and the covering RRSIG records so that they can be
authenticated.
The EXAMPLES below describe how to generate this file.
**-iextension**
Update the ``dsset-`` file in place, instead of writing DS records to
the standard output.
There must be no space between the ``-i`` and the extension. If you
provide no extension then the old ``dsset-`` is discarded. If an
extension is present, a backup of the old ``dsset-`` file is kept
with the extension appended to its filename.
To protect against replay attacks, the modification time of the
``dsset-`` file is set to match the signature inception time of the
child records, provided that is later than the file's current
modification time.
**-s** start-time
Specify the date and time after which RRSIG records become
acceptable. This can be either an absolute or relative time. An
absolute start time is indicated by a number in YYYYMMDDHHMMSS
notation; 20170827133700 denotes 13:37:00 UTC on August 27th, 2017. A
time relative to the ``dsset-`` file is indicated with -N, which is N
seconds before the file modification time. A time relative to the
current time is indicated with now+N.
If no start-time is specified, the modification time of the
``dsset-`` file is used.
**-T** ttl
Specifies a TTL to be used for new DS records. If not specified, the
default is the TTL of the old DS records. If they had no explicit TTL
then the new DS records also have no explicit TTL.
**-u**
Write an ``nsupdate`` script to the standard output, instead of
printing the new DS reords. The output will be empty if no change is
needed.
Note: The TTL of new records needs to be specified, either in the
original ``dsset-`` file, or with the ``-T`` option, or using the
``nsupdate`` ``ttl`` command.
**-V**
Print version information.
**-v** level
Sets the debugging level. Level 1 is intended to be usefully verbose
for general users; higher levels are intended for developers.
domain
The name of the delegation point / child zone apex.
Exit Status
~~~~~~~~~~~
The ``dnssec-cds`` command exits 0 on success, or non-zero if an error
occurred.
In the success case, the DS records might or might not need to be
changed.
Examples
~~~~~~~~
Before running ``dnssec-signzone``, you can ensure that the delegations
are up-to-date by running ``dnssec-cds`` on every ``dsset-`` file.
To fetch the child records required by ``dnssec-cds`` you can invoke
``dig`` as in the script below. It's okay if the ``dig`` fails since
``dnssec-cds`` performs all the necessary checking.
::
for f in dsset-*
do
d=${f#dsset-}
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec-cds -i -f /dev/stdin -d $f $d
done
When the parent zone is automatically signed by ``named``, you can use
``dnssec-cds`` with ``nsupdate`` to maintain a delegation as follows.
The ``dsset-`` file allows the script to avoid having to fetch and
validate the parent DS records, and it keeps the replay attack
protection time.
::
dig +dnssec +noall +answer $d DNSKEY $d CDNSKEY $d CDS |
dnssec-cds -u -i -f /dev/stdin -d $f $d |
nsupdate -l
See Also
~~~~~~~~
:manpage:`dig(1)`, :manpage:`dnssec-settime(8)`, :manpage:`dnssec-signzone(8)`, :manpage:`nsupdate(1)`, BIND 9 Administrator
Reference Manual, :rfc:`7344`.

View File

@@ -1,226 +0,0 @@
.\" Copyright (C) 2008-2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: dnssec-dsfromkey
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2019-05-08
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "DNSSEC\-DSFROMKEY" "8" "2019\-05\-08" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dnssec-dsfromkey \- DNSSEC DS RR generation tool
.SH "SYNOPSIS"
.HP \w'\fBdnssec\-dsfromkey\fR\ 'u
\fBdnssec\-dsfromkey\fR [\fB\-1\fR | \fB\-2\fR | \fB\-a\ \fR\fB\fIalg\fR\fR] [\fB\-C\fR | \fB\-l\ \fR\fB\fIdomain\fR\fR] [\fB\-T\ \fR\fB\fITTL\fR\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-K\ \fR\fB\fIdirectory\fR\fR] {keyfile}
.HP \w'\fBdnssec\-dsfromkey\fR\ 'u
\fBdnssec\-dsfromkey\fR [\fB\-1\fR | \fB\-2\fR | \fB\-a\ \fR\fB\fIalg\fR\fR] [\fB\-C\fR | \fB\-l\ \fR\fB\fIdomain\fR\fR] [\fB\-T\ \fR\fB\fITTL\fR\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-A\fR] {\fB\-f\ \fR\fB\fIfile\fR\fR} [dnsname]
.HP \w'\fBdnssec\-dsfromkey\fR\ 'u
\fBdnssec\-dsfromkey\fR [\fB\-1\fR | \fB\-2\fR | \fB\-a\ \fR\fB\fIalg\fR\fR] [\fB\-C\fR | \fB\-l\ \fR\fB\fIdomain\fR\fR] [\fB\-T\ \fR\fB\fITTL\fR\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-K\ \fR\fB\fIdirectory\fR\fR] {\-s} {dnsname}
.HP \w'\fBdnssec\-dsfromkey\fR\ 'u
\fBdnssec\-dsfromkey\fR [\fB\-h\fR | \fB\-V\fR]
.SH "DESCRIPTION"
.PP
The
\fBdnssec\-dsfromkey\fR
command outputs DS (Delegation Signer) resource records (RRs), or CDS (Child DS) RRs with the
\fB\-C\fR
option\&.
.PP
The input keys can be specified in a number of ways:
.PP
By default,
\fBdnssec\-dsfromkey\fR
reads a key file named like
Knnnn\&.+aaa+iiiii\&.key, as generated by
\fBdnssec\-keygen\fR\&.
.PP
With the
\fB\-f \fR\fB\fIfile\fR\fR
option,
\fBdnssec\-dsfromkey\fR
reads keys from a zone file or partial zone file (which can contain just the DNSKEY records)\&.
.PP
With the
\fB\-s\fR
option,
\fBdnssec\-dsfromkey\fR
reads a
keyset\-
file, as generated by
\fBdnssec\-keygen\fR\fB\-C\fR\&.
.SH "OPTIONS"
.PP
\-1
.RS 4
An abbreviation for
\fB\-a SHA\-1\fR\&. (Note: The SHA\-1 algorithm is no longer recommended for use when generating new DS and CDS records\&.)
.RE
.PP
\-2
.RS 4
An abbreviation for
\fB\-a SHA\-256\fR\&.
.RE
.PP
\-a \fIalgorithm\fR
.RS 4
Specify a digest algorithm to use when converting DNSKEY records to DS records\&. This option can be repeated, so that multiple DS records are created for each DNSKEY record\&.
.sp
The
\fIalgorithm\fR
must be one of SHA\-1, SHA\-256, or SHA\-384\&. These values are case insensitive, and the hyphen may be omitted\&. If no algorithm is specified, the default is SHA\-256\&. (Note: The SHA\-1 algorithm is no longer recommended for use when generating new DS and CDS records\&.)
.RE
.PP
\-A
.RS 4
Include ZSKs when generating DS records\&. Without this option, only keys which have the KSK flag set will be converted to DS records and printed\&. Useful only in
\fB\-f\fR
zone file mode\&.
.RE
.PP
\-c \fIclass\fR
.RS 4
Specifies the DNS class (default is IN)\&. Useful only in
\fB\-s\fR
keyset or
\fB\-f\fR
zone file mode\&.
.RE
.PP
\-C
.RS 4
Generate CDS records rather than DS records\&.
.RE
.PP
\-f \fIfile\fR
.RS 4
Zone file mode:
\fBdnssec\-dsfromkey\fR\*(Aqs final
\fIdnsname\fR
argument is the DNS domain name of a zone whose master file can be read from
\fBfile\fR\&. If the zone name is the same as
\fBfile\fR, then it may be omitted\&.
.sp
If
\fIfile\fR
is
"\-", then the zone data is read from the standard input\&. This makes it possible to use the output of the
\fBdig\fR
command as input, as in:
.sp
\fBdig dnskey example\&.com | dnssec\-dsfromkey \-f \- example\&.com\fR
.RE
.PP
\-h
.RS 4
Prints usage information\&.
.RE
.PP
\-K \fIdirectory\fR
.RS 4
Look for key files or
keyset\-
files in
\fBdirectory\fR\&.
.RE
.PP
\-s
.RS 4
Keyset mode:
\fBdnssec\-dsfromkey\fR\*(Aqs final
\fIdnsname\fR
argument is the DNS domain name used to locate a
keyset\-
file\&.
.RE
.PP
\-T \fITTL\fR
.RS 4
Specifies the TTL of the DS records\&. By default the TTL is omitted\&.
.RE
.PP
\-v \fIlevel\fR
.RS 4
Sets the debugging level\&.
.RE
.PP
\-V
.RS 4
Prints version information\&.
.RE
.SH "EXAMPLE"
.PP
To build the SHA\-256 DS RR from the
\fBKexample\&.com\&.+003+26160\fR
keyfile name, you can issue the following command:
.PP
\fBdnssec\-dsfromkey \-2 Kexample\&.com\&.+003+26160\fR
.PP
The command would print something like:
.PP
\fBexample\&.com\&. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0C5EA0B94\fR
.SH "FILES"
.PP
The keyfile can be designated by the key identification
Knnnn\&.+aaa+iiiii
or the full file name
Knnnn\&.+aaa+iiiii\&.key
as generated by
dnssec\-keygen(8)\&.
.PP
The keyset file name is built from the
\fBdirectory\fR, the string
keyset\-
and the
\fBdnsname\fR\&.
.SH "CAVEAT"
.PP
A keyfile error can give a "file not found" even if the file exists\&.
.SH "SEE ALSO"
.PP
\fBdnssec-keygen\fR(8),
\fBdnssec-signzone\fR(8),
BIND 9 Administrator Reference Manual,
RFC 3658
(DS RRs),
RFC 4509
(SHA\-256 for DS RRs),
RFC 6605
(SHA\-384 for DS RRs),
RFC 7344
(CDS and CDNSKEY RRs)\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2008-2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -43,18 +43,18 @@
#if USE_PKCS11
#include <pk11/result.h>
#endif
#endif /* if USE_PKCS11 */
#include "dnssectool.h"
const char *program = "dnssec-dsfromkey";
static dns_rdataclass_t rdclass;
static dns_fixedname_t fixed;
static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static uint32_t ttl;
static bool emitttl = false;
static dns_fixedname_t fixed;
static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static uint32_t ttl;
static bool emitttl = false;
static isc_result_t
initname(char *setname) {
@@ -76,88 +76,101 @@ db_load_from_stream(dns_db_t *db, FILE *fp) {
dns_rdatacallbacks_init(&callbacks);
result = dns_db_beginload(db, &callbacks);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("dns_db_beginload failed: %s", isc_result_totext(result));
}
result = dns_master_loadstream(fp, name, name, rdclass, 0,
&callbacks, mctx);
if (result != ISC_R_SUCCESS)
result = dns_master_loadstream(fp, name, name, rdclass, 0, &callbacks,
mctx);
if (result != ISC_R_SUCCESS) {
fatal("can't load from input: %s", isc_result_totext(result));
}
result = dns_db_endload(db, &callbacks);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("dns_db_endload failed: %s", isc_result_totext(result));
}
}
static isc_result_t
loadset(const char *filename, dns_rdataset_t *rdataset) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
char setname[DNS_NAME_FORMATSIZE];
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS)
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
if (strcmp(filename, "-") == 0) {
db_load_from_stream(db, stdin);
filename = "input";
} else {
result = dns_db_load(db, filename, dns_masterformat_text, 0);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
fatal("can't load %s: %s", filename,
isc_result_totext(result));
}
}
result = dns_db_findnode(db, name, false, &node);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't find %s node in %s", setname, filename);
}
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
0, 0, rdataset, NULL);
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, 0,
rdataset, NULL);
if (result == ISC_R_NOTFOUND)
if (result == ISC_R_NOTFOUND) {
fatal("no DNSKEY RR for %s in %s", setname, filename);
else if (result != ISC_R_SUCCESS)
} else if (result != ISC_R_SUCCESS) {
fatal("dns_db_findrdataset");
}
if (node != NULL)
if (node != NULL) {
dns_db_detachnode(db, &node);
if (db != NULL)
}
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
}
static isc_result_t
loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
isc_result_t result;
char filename[PATH_MAX + 1];
isc_buffer_t buf;
isc_result_t result;
char filename[PATH_MAX + 1];
isc_buffer_t buf;
dns_rdataset_init(rdataset);
isc_buffer_init(&buf, filename, sizeof(filename));
if (dirname != NULL) {
/* allow room for a trailing slash */
if (strlen(dirname) >= isc_buffer_availablelength(&buf))
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
return (ISC_R_NOSPACE);
}
isc_buffer_putstr(&buf, dirname);
if (dirname[strlen(dirname) - 1] != '/')
if (dirname[strlen(dirname) - 1] != '/') {
isc_buffer_putstr(&buf, "/");
}
}
if (isc_buffer_availablelength(&buf) < 7)
if (isc_buffer_availablelength(&buf) < 7) {
return (ISC_R_NOSPACE);
}
isc_buffer_putstr(&buf, "keyset-");
result = dns_name_tofilenametext(name, false, &buf);
check_result(result, "dns_name_tofilenametext()");
if (isc_buffer_availablelength(&buf) == 0)
if (isc_buffer_availablelength(&buf) == 0) {
return (ISC_R_NOSPACE);
}
isc_buffer_putuint8(&buf, 0);
return (loadset(filename, rdataset));
@@ -165,22 +178,22 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
static void
loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
dns_rdata_t *rdata)
{
isc_result_t result;
dst_key_t *key = NULL;
isc_buffer_t keyb;
isc_region_t r;
dns_rdata_t *rdata) {
isc_result_t result;
dst_key_t *key = NULL;
isc_buffer_t keyb;
isc_region_t r;
dns_rdata_init(rdata);
isc_buffer_init(&keyb, key_buf, key_buf_size);
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC,
mctx, &key);
if (result != ISC_R_SUCCESS)
fatal("can't load %s.key: %s",
filename, isc_result_totext(result));
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC, mctx,
&key);
if (result != ISC_R_SUCCESS) {
fatal("can't load %s.key: %s", filename,
isc_result_totext(result));
}
if (verbose > 2) {
char keystr[DST_KEY_FORMATSIZE];
@@ -190,12 +203,13 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
}
result = dst_key_todns(key, &keyb);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't decode key");
}
isc_buffer_usedregion(&keyb, &r);
dns_rdata_fromregion(rdata, dst_key_class(key),
dns_rdatatype_dnskey, &r);
dns_rdata_fromregion(rdata, dst_key_class(key), dns_rdatatype_dnskey,
&r);
rdclass = dst_key_class(key);
@@ -208,15 +222,16 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
static void
logkey(dns_rdata_t *rdata) {
isc_result_t result;
dst_key_t *key = NULL;
dst_key_t *key = NULL;
isc_buffer_t buf;
char keystr[DST_KEY_FORMATSIZE];
char keystr[DST_KEY_FORMATSIZE];
isc_buffer_init(&buf, rdata->data, rdata->length);
isc_buffer_add(&buf, rdata->length);
result = dst_key_fromdns(name, rdclass, &buf, mctx, &key);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return;
}
dst_key_format(key, keystr, sizeof(keystr));
fprintf(stderr, "%s: %s\n", program, keystr);
@@ -243,35 +258,42 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
dns_rdata_init(&ds);
result = dns_rdata_tostruct(rdata, &dnskey, NULL);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't convert DNSKEY");
}
if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0 && !showall)
if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0 && !showall) {
return;
}
result = dns_ds_buildrdata(name, rdata, dt, buf, &ds);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't build record");
}
result = dns_name_totext(name, false, &nameb);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't print name");
}
result = dns_rdata_tofmttext(&ds, (dns_name_t *) NULL, 0, 0, 0, "",
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
&textb);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't print rdata");
}
result = dns_rdataclass_totext(rdclass, &classb);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't print class");
}
isc_buffer_usedregion(&nameb, &r);
printf("%.*s ", (int)r.length, r.base);
if (emitttl)
if (emitttl) {
printf("%u ", ttl);
}
isc_buffer_usedregion(&classb, &r);
printf("%.*s", (int)r.length, r.base);
@@ -290,7 +312,7 @@ static void
emits(bool showall, bool cds, dns_rdata_t *rdata) {
unsigned i, n;
n = sizeof(dtype)/sizeof(dtype[0]);
n = sizeof(dtype) / sizeof(dtype[0]);
for (i = 0; i < n; i++) {
if (dtype[i] != 0) {
emit(dtype[i], showall, cds, rdata);
@@ -304,43 +326,46 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, " %s [options] -f zonefile [zonename]\n\n", program);
fprintf(stderr, " %s [options] -s dnsname\n\n", program);
fprintf(stderr, " %s [-h|-V]\n\n", program);
fprintf(stderr, "Version: %s\n", VERSION);
fprintf(stderr, "Options:\n"
" -1: digest algorithm SHA-1\n"
" -2: digest algorithm SHA-256\n"
" -a algorithm: digest algorithm (SHA-1, SHA-256 or SHA-384)\n"
" -A: include all keys in DS set, not just KSKs (-f only)\n"
" -c class: rdata class for DS set (default IN) (-f or -s only)\n"
" -C: print CDS records\n"
" -f zonefile: read keys from a zone file\n"
" -h: print help information\n"
" -K directory: where to find key or keyset files\n"
" -s: read keys from keyset-<dnsname> file\n"
" -T: TTL of output records (omitted by default)\n"
" -v level: verbosity\n"
" -V: print version information\n");
" -1: digest algorithm SHA-1\n"
" -2: digest algorithm SHA-256\n"
" -a algorithm: digest algorithm (SHA-1, SHA-256 or "
"SHA-384)\n"
" -A: include all keys in DS set, not just KSKs (-f "
"only)\n"
" -c class: rdata class for DS set (default IN) (-f "
"or -s only)\n"
" -C: print CDS records\n"
" -f zonefile: read keys from a zone file\n"
" -h: print help information\n"
" -K directory: where to find key or keyset files\n"
" -s: read keys from keyset-<dnsname> file\n"
" -T: TTL of output records (omitted by default)\n"
" -v level: verbosity\n"
" -V: print version information\n");
fprintf(stderr, "Output: DS or CDS RRs\n");
exit (-1);
exit(-1);
}
int
main(int argc, char **argv) {
char *classname = NULL;
char *filename = NULL, *dir = NULL, *namestr;
char *endp, *arg1;
int ch;
bool cds = false;
bool usekeyset = false;
bool showall = false;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
char *classname = NULL;
char *filename = NULL, *dir = NULL, *namestr;
char *endp, *arg1;
int ch;
bool cds = false;
bool usekeyset = false;
bool showall = false;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
dns_rdata_init(&rdata);
@@ -352,7 +377,7 @@ main(int argc, char **argv) {
#if USE_PKCS11
pk11_result_register();
#endif
#endif /* if USE_PKCS11 */
dns_result_register();
isc_commandline_errprint = false;
@@ -379,13 +404,16 @@ main(int argc, char **argv) {
classname = isc_commandline_argument;
break;
case 'd':
fprintf(stderr, "%s: the -d option is deprecated; "
"use -K\n", program);
/* fall through */
fprintf(stderr,
"%s: the -d option is deprecated; "
"use -K\n",
program);
/* fall through */
case 'K':
dir = isc_commandline_argument;
if (strlen(dir) == 0U)
if (strlen(dir) == 0U) {
fatal("directory must be non-empty string");
}
break;
case 'f':
filename = isc_commandline_argument;
@@ -402,17 +430,19 @@ main(int argc, char **argv) {
break;
case 'v':
verbose = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0')
if (*endp != '\0') {
fatal("-v must be followed by a number");
}
break;
case 'F':
/* Reserved for FIPS mode */
/* FALLTHROUGH */
/* Reserved for FIPS mode */
/* FALLTHROUGH */
case '?':
if (isc_commandline_option != '?')
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
/* FALLTHROUGH */
}
/* FALLTHROUGH */
case 'h':
/* Does not return. */
usage();
@@ -422,8 +452,8 @@ main(int argc, char **argv) {
version(program);
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
}
}

View File

@@ -1,355 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.dnssec-dsfromkey">
<info>
<date>2019-05-08</date>
</info>
<refentryinfo>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle><application>dnssec-dsfromkey</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>dnssec-dsfromkey</application></refname>
<refpurpose>DNSSEC DS RR generation tool</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2008</year>
<year>2009</year>
<year>2010</year>
<year>2011</year>
<year>2012</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>dnssec-dsfromkey</command>
<group choice="opt">
<arg choice="plain"><option>-1</option></arg>
<arg choice="plain"><option>-2</option></arg>
<arg choice="plain"><option>-a <replaceable class="parameter">alg</replaceable></option></arg>
</group>
<group>
<arg choice="plain" rep="norepeat"><option>-C</option></arg>
<arg choice="plain" rep="norepeat"><option>-l <replaceable class="parameter">domain</replaceable></option></arg>
</group>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">TTL</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="req" rep="norepeat">keyfile</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>dnssec-dsfromkey</command>
<group choice="opt">
<arg choice="plain"><option>-1</option></arg>
<arg choice="plain"><option>-2</option></arg>
<arg choice="plain"><option>-a <replaceable class="parameter">alg</replaceable></option></arg>
</group>
<group>
<arg choice="plain" rep="norepeat"><option>-C</option></arg>
<arg choice="plain" rep="norepeat"><option>-l <replaceable class="parameter">domain</replaceable></option></arg>
</group>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">TTL</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-A</option></arg>
<arg choice="req" rep="norepeat"><option>-f <replaceable class="parameter">file</replaceable></option></arg>
<arg choice="opt" rep="norepeat">dnsname</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>dnssec-dsfromkey</command>
<group choice="opt">
<arg choice="plain"><option>-1</option></arg>
<arg choice="plain"><option>-2</option></arg>
<arg choice="plain"><option>-a <replaceable class="parameter">alg</replaceable></option></arg>
</group>
<group>
<arg choice="plain" rep="norepeat"><option>-C</option></arg>
<arg choice="plain" rep="norepeat"><option>-l <replaceable class="parameter">domain</replaceable></option></arg>
</group>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">TTL</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="req" rep="norepeat">-s</arg>
<arg choice="req" rep="norepeat">dnsname</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>dnssec-dsfromkey</command>
<group choice="opt">
<arg choice="plain" rep="norepeat"><option>-h</option></arg>
<arg choice="plain" rep="norepeat"><option>-V</option></arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para>
The <command>dnssec-dsfromkey</command> command outputs DS (Delegation
Signer) resource records (RRs), or CDS (Child DS) RRs with the
<option>-C</option> option.
</para>
<para>
The input keys can be specified in a number of ways:
</para>
<para>
By default, <command>dnssec-dsfromkey</command> reads a key file
named like <filename>Knnnn.+aaa+iiiii.key</filename>, as generated
by <command>dnssec-keygen</command>.
</para>
<para>
With the <option>-f <replaceable>file</replaceable></option>
option, <command>dnssec-dsfromkey</command> reads keys from a zone file
or partial zone file (which can contain just the DNSKEY records).
</para>
<para>
With the <option>-s</option>
option, <command>dnssec-dsfromkey</command> reads
a <filename>keyset-</filename> file, as generated
by <command>dnssec-keygen</command> <option>-C</option>.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-1</term>
<listitem>
<para>
An abbreviation for <option>-a SHA-1</option>.
(Note: The SHA-1 algorithm is no longer recommended for use
when generating new DS and CDS records.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-2</term>
<listitem>
<para>
An abbreviation for <option>-a SHA-256</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-a <replaceable class="parameter">algorithm</replaceable></term>
<listitem>
<para>
Specify a digest algorithm to use when converting DNSKEY
records to DS records. This option can be repeated, so
that multiple DS records are created for each DNSKEY
record.
</para>
<para>
The <replaceable>algorithm</replaceable> must be one of
SHA-1, SHA-256, or SHA-384. These values are case insensitive,
and the hyphen may be omitted. If no algorithm is specified,
the default is SHA-256.
(Note: The SHA-1 algorithm is no longer recommended for use
when generating new DS and CDS records.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-A</term>
<listitem>
<para>
Include ZSKs when generating DS records. Without this option, only
keys which have the KSK flag set will be converted to DS records
and printed. Useful only in <option>-f</option> zone file mode.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-c <replaceable class="parameter">class</replaceable></term>
<listitem>
<para>
Specifies the DNS class (default is IN). Useful only
in <option>-s</option> keyset or <option>-f</option>
zone file mode.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-C</term>
<listitem>
<para>
Generate CDS records rather than DS records.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-f <replaceable class="parameter">file</replaceable></term>
<listitem>
<para>
Zone file mode: <command>dnssec-dsfromkey</command>'s
final <replaceable>dnsname</replaceable> argument is
the DNS domain name of a zone whose master file can be read
from <option>file</option>. If the zone name is the same as
<option>file</option>, then it may be omitted.
</para>
<para>
If <replaceable>file</replaceable> is <literal>"-"</literal>, then
the zone data is read from the standard input. This makes it
possible to use the output of the <command>dig</command>
command as input, as in:
</para>
<para>
<userinput>dig dnskey example.com | dnssec-dsfromkey -f - example.com</userinput>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Prints usage information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-K <replaceable class="parameter">directory</replaceable></term>
<listitem>
<para>
Look for key files or <filename>keyset-</filename> files in
<option>directory</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s</term>
<listitem>
<para>
Keyset mode: <command>dnssec-dsfromkey</command>'s
final <replaceable>dnsname</replaceable> argument is the DNS
domain name used to locate a <filename>keyset-</filename> file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-T <replaceable class="parameter">TTL</replaceable></term>
<listitem>
<para>
Specifies the TTL of the DS records. By default the TTL is omitted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v <replaceable class="parameter">level</replaceable></term>
<listitem>
<para>
Sets the debugging level.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-V</term>
<listitem>
<para>
Prints version information.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>EXAMPLE</title></info>
<para>
To build the SHA-256 DS RR from the
<userinput>Kexample.com.+003+26160</userinput>
keyfile name, you can issue the following command:
</para>
<para><userinput>dnssec-dsfromkey -2 Kexample.com.+003+26160</userinput>
</para>
<para>
The command would print something like:
</para>
<para><userinput>example.com. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0C5EA0B94</userinput>
</para>
</refsection>
<refsection><info><title>FILES</title></info>
<para>
The keyfile can be designated by the key identification
<filename>Knnnn.+aaa+iiiii</filename> or the full file name
<filename>Knnnn.+aaa+iiiii.key</filename> as generated by
<refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>.
</para>
<para>
The keyset file name is built from the <option>directory</option>,
the string <filename>keyset-</filename> and the
<option>dnsname</option>.
</para>
</refsection>
<refsection><info><title>CAVEAT</title></info>
<para>
A keyfile error can give a "file not found" even if the file exists.
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>dnssec-signzone</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>,
<citetitle>RFC 3658</citetitle> (DS RRs),
<citetitle>RFC 4509</citetitle> (SHA-256 for DS RRs),
<citetitle>RFC 6605</citetitle> (SHA-384 for DS RRs),
<citetitle>RFC 7344</citetitle> (CDS and CDNSKEY RRs).
</para>
</refsection>
</refentry>

View File

@@ -1,307 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
- Copyright (C) 2008-2012, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>dnssec-dsfromkey</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="man.dnssec-dsfromkey"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>
<span class="application">dnssec-dsfromkey</span>
&#8212; DNSSEC DS RR generation tool
</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p>
<code class="command">dnssec-dsfromkey</code>
[
<code class="option">-1</code>
| <code class="option">-2</code>
| <code class="option">-a <em class="replaceable"><code>alg</code></em></code>
]
[
<code class="option">-C</code>
| <code class="option">-l <em class="replaceable"><code>domain</code></em></code>
]
[<code class="option">-T <em class="replaceable"><code>TTL</code></em></code>]
[<code class="option">-v <em class="replaceable"><code>level</code></em></code>]
[<code class="option">-K <em class="replaceable"><code>directory</code></em></code>]
{keyfile}
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">dnssec-dsfromkey</code>
[
<code class="option">-1</code>
| <code class="option">-2</code>
| <code class="option">-a <em class="replaceable"><code>alg</code></em></code>
]
[
<code class="option">-C</code>
| <code class="option">-l <em class="replaceable"><code>domain</code></em></code>
]
[<code class="option">-T <em class="replaceable"><code>TTL</code></em></code>]
[<code class="option">-v <em class="replaceable"><code>level</code></em></code>]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-A</code>]
{<code class="option">-f <em class="replaceable"><code>file</code></em></code>}
[dnsname]
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">dnssec-dsfromkey</code>
[
<code class="option">-1</code>
| <code class="option">-2</code>
| <code class="option">-a <em class="replaceable"><code>alg</code></em></code>
]
[
<code class="option">-C</code>
| <code class="option">-l <em class="replaceable"><code>domain</code></em></code>
]
[<code class="option">-T <em class="replaceable"><code>TTL</code></em></code>]
[<code class="option">-v <em class="replaceable"><code>level</code></em></code>]
[<code class="option">-c <em class="replaceable"><code>class</code></em></code>]
[<code class="option">-K <em class="replaceable"><code>directory</code></em></code>]
{-s}
{dnsname}
</p></div>
<div class="cmdsynopsis"><p>
<code class="command">dnssec-dsfromkey</code>
[
<code class="option">-h</code>
| <code class="option">-V</code>
]
</p></div>
</div>
<div class="refsection">
<a name="id-1.7"></a><h2>DESCRIPTION</h2>
<p>
The <span class="command"><strong>dnssec-dsfromkey</strong></span> command outputs DS (Delegation
Signer) resource records (RRs), or CDS (Child DS) RRs with the
<code class="option">-C</code> option.
</p>
<p>
The input keys can be specified in a number of ways:
</p>
<p>
By default, <span class="command"><strong>dnssec-dsfromkey</strong></span> reads a key file
named like <code class="filename">Knnnn.+aaa+iiiii.key</code>, as generated
by <span class="command"><strong>dnssec-keygen</strong></span>.
</p>
<p>
With the <code class="option">-f <em class="replaceable"><code>file</code></em></code>
option, <span class="command"><strong>dnssec-dsfromkey</strong></span> reads keys from a zone file
or partial zone file (which can contain just the DNSKEY records).
</p>
<p>
With the <code class="option">-s</code>
option, <span class="command"><strong>dnssec-dsfromkey</strong></span> reads
a <code class="filename">keyset-</code> file, as generated
by <span class="command"><strong>dnssec-keygen</strong></span> <code class="option">-C</code>.
</p>
</div>
<div class="refsection">
<a name="id-1.8"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term">-1</span></dt>
<dd>
<p>
An abbreviation for <code class="option">-a SHA-1</code>.
(Note: The SHA-1 algorithm is no longer recommended for use
when generating new DS and CDS records.)
</p>
</dd>
<dt><span class="term">-2</span></dt>
<dd>
<p>
An abbreviation for <code class="option">-a SHA-256</code>.
</p>
</dd>
<dt><span class="term">-a <em class="replaceable"><code>algorithm</code></em></span></dt>
<dd>
<p>
Specify a digest algorithm to use when converting DNSKEY
records to DS records. This option can be repeated, so
that multiple DS records are created for each DNSKEY
record.
</p>
<p>
The <em class="replaceable"><code>algorithm</code></em> must be one of
SHA-1, SHA-256, or SHA-384. These values are case insensitive,
and the hyphen may be omitted. If no algorithm is specified,
the default is SHA-256.
(Note: The SHA-1 algorithm is no longer recommended for use
when generating new DS and CDS records.)
</p>
</dd>
<dt><span class="term">-A</span></dt>
<dd>
<p>
Include ZSKs when generating DS records. Without this option, only
keys which have the KSK flag set will be converted to DS records
and printed. Useful only in <code class="option">-f</code> zone file mode.
</p>
</dd>
<dt><span class="term">-c <em class="replaceable"><code>class</code></em></span></dt>
<dd>
<p>
Specifies the DNS class (default is IN). Useful only
in <code class="option">-s</code> keyset or <code class="option">-f</code>
zone file mode.
</p>
</dd>
<dt><span class="term">-C</span></dt>
<dd>
<p>
Generate CDS records rather than DS records.
</p>
</dd>
<dt><span class="term">-f <em class="replaceable"><code>file</code></em></span></dt>
<dd>
<p>
Zone file mode: <span class="command"><strong>dnssec-dsfromkey</strong></span>'s
final <em class="replaceable"><code>dnsname</code></em> argument is
the DNS domain name of a zone whose master file can be read
from <code class="option">file</code>. If the zone name is the same as
<code class="option">file</code>, then it may be omitted.
</p>
<p>
If <em class="replaceable"><code>file</code></em> is <code class="literal">"-"</code>, then
the zone data is read from the standard input. This makes it
possible to use the output of the <span class="command"><strong>dig</strong></span>
command as input, as in:
</p>
<p>
<strong class="userinput"><code>dig dnskey example.com | dnssec-dsfromkey -f - example.com</code></strong>
</p>
</dd>
<dt><span class="term">-h</span></dt>
<dd>
<p>
Prints usage information.
</p>
</dd>
<dt><span class="term">-K <em class="replaceable"><code>directory</code></em></span></dt>
<dd>
<p>
Look for key files or <code class="filename">keyset-</code> files in
<code class="option">directory</code>.
</p>
</dd>
<dt><span class="term">-s</span></dt>
<dd>
<p>
Keyset mode: <span class="command"><strong>dnssec-dsfromkey</strong></span>'s
final <em class="replaceable"><code>dnsname</code></em> argument is the DNS
domain name used to locate a <code class="filename">keyset-</code> file.
</p>
</dd>
<dt><span class="term">-T <em class="replaceable"><code>TTL</code></em></span></dt>
<dd>
<p>
Specifies the TTL of the DS records. By default the TTL is omitted.
</p>
</dd>
<dt><span class="term">-v <em class="replaceable"><code>level</code></em></span></dt>
<dd>
<p>
Sets the debugging level.
</p>
</dd>
<dt><span class="term">-V</span></dt>
<dd>
<p>
Prints version information.
</p>
</dd>
</dl></div>
</div>
<div class="refsection">
<a name="id-1.9"></a><h2>EXAMPLE</h2>
<p>
To build the SHA-256 DS RR from the
<strong class="userinput"><code>Kexample.com.+003+26160</code></strong>
keyfile name, you can issue the following command:
</p>
<p><strong class="userinput"><code>dnssec-dsfromkey -2 Kexample.com.+003+26160</code></strong>
</p>
<p>
The command would print something like:
</p>
<p><strong class="userinput"><code>example.com. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0C5EA0B94</code></strong>
</p>
</div>
<div class="refsection">
<a name="id-1.10"></a><h2>FILES</h2>
<p>
The keyfile can be designated by the key identification
<code class="filename">Knnnn.+aaa+iiiii</code> or the full file name
<code class="filename">Knnnn.+aaa+iiiii.key</code> as generated by
<span class="refentrytitle">dnssec-keygen</span>(8).
</p>
<p>
The keyset file name is built from the <code class="option">directory</code>,
the string <code class="filename">keyset-</code> and the
<code class="option">dnsname</code>.
</p>
</div>
<div class="refsection">
<a name="id-1.11"></a><h2>CAVEAT</h2>
<p>
A keyfile error can give a "file not found" even if the file exists.
</p>
</div>
<div class="refsection">
<a name="id-1.12"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry">
<span class="refentrytitle">dnssec-keygen</span>(8)
</span>,
<span class="citerefentry">
<span class="refentrytitle">dnssec-signzone</span>(8)
</span>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>,
<em class="citetitle">RFC 3658</em> (DS RRs),
<em class="citetitle">RFC 4509</em> (SHA-256 for DS RRs),
<em class="citetitle">RFC 6605</em> (SHA-384 for DS RRs),
<em class="citetitle">RFC 7344</em> (CDS and CDNSKEY RRs).
</p>
</div>
</div></body>
</html>

View File

@@ -0,0 +1,150 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_dnssec-dsfromkey:
dnssec-dsfromkey - DNSSEC DS RR generation tool
-----------------------------------------------
Synopsis
~~~~~~~~
:program:`dnssec-dsfromkey` [ **-1** | **-2** | **-a** alg ] [ **-C** ] [**-T** TTL] [**-v** level] [**-K** directory] {keyfile}
:program:`dnssec-dsfromkey` [ **-1** | **-2** | **-a** alg ] [ **-C** ] [**-T** TTL] [**-v** level] [**-c** class] [**-A**] {**-f** file} [dnsname]
:program:`dnssec-dsfromkey` [ **-1** | **-2** | **-a** alg ] [ **-C** ] [**-T** TTL] [**-v** level] [**-c** class] [**-K** directory] {**-s**} {dnsname}
:program:`dnssec-dsfromkey` [ **-h** | **-V** ]
Description
~~~~~~~~~~~
The ``dnssec-dsfromkey`` command outputs DS (Delegation Signer) resource records
(RRs), or CDS (Child DS) RRs with the ``-C`` option.
The input keys can be specified in a number of ways:
By default, ``dnssec-dsfromkey`` reads a key file named like
``Knnnn.+aaa+iiiii.key``, as generated by ``dnssec-keygen``.
With the ``-f file`` option, ``dnssec-dsfromkey`` reads keys from a zone
file or partial zone file (which can contain just the DNSKEY records).
With the ``-s`` option, ``dnssec-dsfromkey`` reads a ``keyset-`` file,
as generated by ``dnssec-keygen`` ``-C``.
Options
~~~~~~~
**-1**
An abbreviation for ``-a SHA1``
**-2**
An abbreviation for ``-a SHA-256``
**-a** algorithm
Specify a digest algorithm to use when converting DNSKEY records to
DS records. This option can be repeated, so that multiple DS records
are created for each DNSKEY record.
The algorithm must be one of SHA-1, SHA-256, or SHA-384. These values
are case insensitive, and the hyphen may be omitted. If no algorithm
is specified, the default is SHA-256.
**-A**
Include ZSKs when generating DS records. Without this option, only
keys which have the KSK flag set will be converted to DS records and
printed. Useful only in ``-f`` zone file mode.
**-c** class
Specifies the DNS class (default is IN). Useful only in ``-s`` keyset
or ``-f`` zone file mode.
**-C**
Generate CDS records rather than DS records.
**-f** file
Zone file mode: ``dnssec-dsfromkey``'s final dnsname argument is the
DNS domain name of a zone whose master file can be read from
``file``. If the zone name is the same as ``file``, then it may be
omitted.
If file is ``"-"``, then the zone data is read from the standard
input. This makes it possible to use the output of the ``dig``
command as input, as in:
``dig dnskey example.com | dnssec-dsfromkey -f - example.com``
**-h**
Prints usage information.
**-K** directory
Look for key files or ``keyset-`` files in ``directory``.
**-s**
Keyset mode: ``dnssec-dsfromkey``'s final dnsname argument is the DNS
domain name used to locate a ``keyset-`` file.
**-T** TTL
Specifies the TTL of the DS records. By default the TTL is omitted.
**-v** level
Sets the debugging level.
**-V**
Prints version information.
Example
~~~~~~~
To build the SHA-256 DS RR from the ``Kexample.com.+003+26160`` keyfile
name, you can issue the following command:
``dnssec-dsfromkey -2 Kexample.com.+003+26160``
The command would print something like:
``example.com. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0C5EA0B94``
Files
~~~~~
The keyfile can be designated by the key identification
``Knnnn.+aaa+iiiii`` or the full file name ``Knnnn.+aaa+iiiii.key`` as
generated by dnssec-keygen8.
The keyset file name is built from the ``directory``, the string
``keyset-`` and the ``dnsname``.
Caveat
~~~~~~
A keyfile error can give a "file not found" even if the file exists.
See Also
~~~~~~~~
:manpage:`dnssec-keygen(8)`, :manpage:`dnssec-signzone(8)`, BIND 9 Administrator Reference Manual,
:rfc:`3658` (DS RRs), :rfc:`4509` (SHA-256 for DS RRs),
:rfc:`6605` (SHA-384 for DS RRs), :rfc:`7344` (CDS and CDNSKEY RRs).

View File

@@ -1,138 +0,0 @@
.\" Copyright (C) 2013-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\" Title: dnssec-importkey
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: August 21, 2015
.\" Manual: BIND9
.\" Source: ISC
.\" Language: English
.\"
.TH "DNSSEC\-IMPORTKEY" "8" "August 21, 2015" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dnssec-importkey \- import DNSKEY records from external systems so they can be managed
.SH "SYNOPSIS"
.HP \w'\fBdnssec\-importkey\fR\ 'u
\fBdnssec\-importkey\fR [\fB\-K\ \fR\fB\fIdirectory\fR\fR] [\fB\-L\ \fR\fB\fIttl\fR\fR] [\fB\-P\ \fR\fB\fIdate/offset\fR\fR] [\fB\-P\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-D\ \fR\fB\fIdate/offset\fR\fR] [\fB\-D\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-h\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-V\fR] {\fBkeyfile\fR}
.HP \w'\fBdnssec\-importkey\fR\ 'u
\fBdnssec\-importkey\fR {\fB\-f\ \fR\fB\fIfilename\fR\fR} [\fB\-K\ \fR\fB\fIdirectory\fR\fR] [\fB\-L\ \fR\fB\fIttl\fR\fR] [\fB\-P\ \fR\fB\fIdate/offset\fR\fR] [\fB\-P\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-D\ \fR\fB\fIdate/offset\fR\fR] [\fB\-D\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-h\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-V\fR] [\fBdnsname\fR]
.SH "DESCRIPTION"
.PP
\fBdnssec\-importkey\fR
reads a public DNSKEY record and generates a pair of \&.key/\&.private files\&. The DNSKEY record may be read from an existing \&.key file, in which case a corresponding \&.private file will be generated, or it may be read from any other file or from the standard input, in which case both \&.key and \&.private files will be generated\&.
.PP
The newly\-created \&.private file does
\fInot\fR
contain private key data, and cannot be used for signing\&. However, having a \&.private file makes it possible to set publication (\fB\-P\fR) and deletion (\fB\-D\fR) times for the key, which means the public key can be added to and removed from the DNSKEY RRset on schedule even if the true private key is stored offline\&.
.SH "OPTIONS"
.PP
\-f \fIfilename\fR
.RS 4
Zone file mode: instead of a public keyfile name, the argument is the DNS domain name of a zone master file, which can be read from
\fBfile\fR\&. If the domain name is the same as
\fBfile\fR, then it may be omitted\&.
.sp
If
\fBfile\fR
is set to
"\-", then the zone data is read from the standard input\&.
.RE
.PP
\-K \fIdirectory\fR
.RS 4
Sets the directory in which the key files are to reside\&.
.RE
.PP
\-L \fIttl\fR
.RS 4
Sets the default TTL to use for this key when it is converted into a DNSKEY RR\&. If the key is imported into a zone, this is the TTL that will be used for it, unless there was already a DNSKEY RRset in place, in which case the existing TTL would take precedence\&. Setting the default TTL to
0
or
none
removes it\&.
.RE
.PP
\-h
.RS 4
Emit usage message and exit\&.
.RE
.PP
\-v \fIlevel\fR
.RS 4
Sets the debugging level\&.
.RE
.PP
\-V
.RS 4
Prints version information\&.
.RE
.SH "TIMING OPTIONS"
.PP
Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS\&. If the argument begins with a \*(Aq+\*(Aq or \*(Aq\-\*(Aq, it is interpreted as an offset from the present time\&. For convenience, if such an offset is followed by one of the suffixes \*(Aqy\*(Aq, \*(Aqmo\*(Aq, \*(Aqw\*(Aq, \*(Aqd\*(Aq, \*(Aqh\*(Aq, or \*(Aqmi\*(Aq, then the offset is computed in years (defined as 365 24\-hour days, ignoring leap years), months (defined as 30 24\-hour days), weeks, days, hours, or minutes, respectively\&. Without a suffix, the offset is computed in seconds\&. To explicitly prevent a date from being set, use \*(Aqnone\*(Aq or \*(Aqnever\*(Aq\&.
.PP
\-P \fIdate/offset\fR
.RS 4
Sets the date on which a key is to be published to the zone\&. After that date, the key will be included in the zone but will not be used to sign it\&.
.RE
.PP
\-P sync \fIdate/offset\fR
.RS 4
Sets the date on which CDS and CDNSKEY records that match this key are to be published to the zone\&.
.RE
.PP
\-D \fIdate/offset\fR
.RS 4
Sets the date on which the key is to be deleted\&. After that date, the key will no longer be included in the zone\&. (It may remain in the key repository, however\&.)
.RE
.PP
\-D sync \fIdate/offset\fR
.RS 4
Sets the date on which the CDS and CDNSKEY records that match this key are to be deleted\&.
.RE
.SH "FILES"
.PP
A keyfile can be designed by the key identification
Knnnn\&.+aaa+iiiii
or the full file name
Knnnn\&.+aaa+iiiii\&.key
as generated by
dnssec\-keygen(8)\&.
.SH "SEE ALSO"
.PP
\fBdnssec-keygen\fR(8),
\fBdnssec-signzone\fR(8),
BIND 9 Administrator Reference Manual,
RFC 5011\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2013-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
.br

View File

@@ -42,23 +42,23 @@
#if USE_PKCS11
#include <pk11/result.h>
#endif
#endif /* if USE_PKCS11 */
#include "dnssectool.h"
const char *program = "dnssec-importkey";
static dns_rdataclass_t rdclass;
static dns_fixedname_t fixed;
static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static bool setpub = false, setdel = false;
static bool setttl = false;
static isc_stdtime_t pub = 0, del = 0;
static dns_ttl_t ttl = 0;
static isc_stdtime_t syncadd = 0, syncdel = 0;
static bool setsyncadd = false;
static bool setsyncdel = false;
static dns_fixedname_t fixed;
static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static bool setpub = false, setdel = false;
static bool setttl = false;
static isc_stdtime_t pub = 0, del = 0;
static dns_ttl_t ttl = 0;
static isc_stdtime_t syncadd = 0, syncdel = 0;
static bool setsyncadd = false;
static bool setsyncdel = false;
static isc_result_t
initname(char *setname) {
@@ -80,32 +80,36 @@ db_load_from_stream(dns_db_t *db, FILE *fp) {
dns_rdatacallbacks_init(&callbacks);
result = dns_db_beginload(db, &callbacks);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("dns_db_beginload failed: %s", isc_result_totext(result));
}
result = dns_master_loadstream(fp, name, name, rdclass, 0,
&callbacks, mctx);
if (result != ISC_R_SUCCESS)
result = dns_master_loadstream(fp, name, name, rdclass, 0, &callbacks,
mctx);
if (result != ISC_R_SUCCESS) {
fatal("can't load from input: %s", isc_result_totext(result));
}
result = dns_db_endload(db, &callbacks);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("dns_db_endload failed: %s", isc_result_totext(result));
}
}
static isc_result_t
loadset(const char *filename, dns_rdataset_t *rdataset) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
char setname[DNS_NAME_FORMATSIZE];
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS)
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
if (strcmp(filename, "-") == 0) {
db_load_from_stream(db, stdin);
@@ -113,48 +117,53 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
} else {
result = dns_db_load(db, filename, dns_masterformat_text,
DNS_MASTER_NOTTL);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
fatal("can't load %s: %s", filename,
isc_result_totext(result));
}
}
result = dns_db_findnode(db, name, false, &node);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't find %s node in %s", setname, filename);
}
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
0, 0, rdataset, NULL);
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, 0,
rdataset, NULL);
if (result == ISC_R_NOTFOUND)
if (result == ISC_R_NOTFOUND) {
fatal("no DNSKEY RR for %s in %s", setname, filename);
else if (result != ISC_R_SUCCESS)
} else if (result != ISC_R_SUCCESS) {
fatal("dns_db_findrdataset");
}
if (node != NULL)
if (node != NULL) {
dns_db_detachnode(db, &node);
if (db != NULL)
}
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
}
static void
loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
dns_rdata_t *rdata)
{
isc_result_t result;
dst_key_t *key = NULL;
isc_buffer_t keyb;
isc_region_t r;
dns_rdata_t *rdata) {
isc_result_t result;
dst_key_t *key = NULL;
isc_buffer_t keyb;
isc_region_t r;
dns_rdata_init(rdata);
isc_buffer_init(&keyb, key_buf, key_buf_size);
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC,
mctx, &key);
if (result != ISC_R_SUCCESS)
fatal("invalid keyfile name %s: %s",
filename, isc_result_totext(result));
result = dst_key_fromnamedfile(filename, NULL, DST_TYPE_PUBLIC, mctx,
&key);
if (result != ISC_R_SUCCESS) {
fatal("invalid keyfile name %s: %s", filename,
isc_result_totext(result));
}
if (verbose > 2) {
char keystr[DST_KEY_FORMATSIZE];
@@ -164,12 +173,13 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
}
result = dst_key_todns(key, &keyb);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("can't decode key");
}
isc_buffer_usedregion(&keyb, &r);
dns_rdata_fromregion(rdata, dst_key_class(key),
dns_rdatatype_dnskey, &r);
dns_rdata_fromregion(rdata, dst_key_class(key), dns_rdatatype_dnskey,
&r);
rdclass = dst_key_class(key);
@@ -208,31 +218,35 @@ emit(const char *dir, dns_rdata_t *rdata) {
isc_result_totext(result));
}
result = dst_key_fromfile(dst_key_name(key), dst_key_id(key),
dst_key_alg(key),
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE,
dir, mctx, &tmp);
result = dst_key_fromfile(
dst_key_name(key), dst_key_id(key), dst_key_alg(key),
DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, dir, mctx, &tmp);
if (result == ISC_R_SUCCESS) {
if (dst_key_isprivate(tmp) && !dst_key_isexternal(tmp))
if (dst_key_isprivate(tmp) && !dst_key_isexternal(tmp)) {
fatal("Private key already exists in %s", priname);
}
dst_key_free(&tmp);
}
dst_key_setexternal(key, true);
if (setpub)
if (setpub) {
dst_key_settime(key, DST_TIME_PUBLISH, pub);
if (setdel)
}
if (setdel) {
dst_key_settime(key, DST_TIME_DELETE, del);
if (setsyncadd)
}
if (setsyncadd) {
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
if (setsyncdel)
}
if (setsyncdel) {
dst_key_settime(key, DST_TIME_SYNCDELETE, syncdel);
}
if (setttl)
if (setttl) {
dst_key_setttl(key, ttl);
}
result = dst_key_tofile(key, DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
dir);
result = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, dir);
if (result != ISC_R_SUCCESS) {
dst_key_format(key, keystr, sizeof(keystr));
fatal("Failed to write key %s: %s", keystr,
@@ -256,53 +270,54 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
fprintf(stderr, " %s options -f file [keyname]\n\n", program);
fprintf(stderr, "Version: %s\n", VERSION);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -f file: read key from zone file\n");
fprintf(stderr, " -K <directory>: directory in which to store "
"the key files\n");
"the key files\n");
fprintf(stderr, " -L ttl: set default key TTL\n");
fprintf(stderr, " -v <verbose level>\n");
fprintf(stderr, " -V: print version information\n");
fprintf(stderr, " -h: print usage and exit\n");
fprintf(stderr, "Timing options:\n");
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
"publication date\n");
"publication date\n");
fprintf(stderr, " -P sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY publication date\n");
"CDS and CDNSKEY publication date\n");
fprintf(stderr, " -D date/[+-]offset/none: set/unset key "
"deletion date\n");
"deletion date\n");
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n");
"CDS and CDNSKEY deletion date\n");
exit (-1);
exit(-1);
}
int
main(int argc, char **argv) {
char *classname = NULL;
char *filename = NULL, *dir = NULL, *namestr;
char *endp;
int ch;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
isc_stdtime_t now;
char *classname = NULL;
char *filename = NULL, *dir = NULL, *namestr;
char *endp;
int ch;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
isc_stdtime_t now;
dns_rdata_init(&rdata);
isc_stdtime_get(&now);
if (argc == 1)
if (argc == 1) {
usage();
}
isc_mem_create(&mctx);
#if USE_PKCS11
pk11_result_register();
#endif
#endif /* if USE_PKCS11 */
dns_result_register();
isc_commandline_errprint = false;
@@ -313,26 +328,29 @@ main(int argc, char **argv) {
case 'D':
/* -Dsync ? */
if (isoptarg("sync", argv, usage)) {
if (setsyncdel)
if (setsyncdel) {
fatal("-D sync specified more than "
"once");
}
syncdel = strtotime(isc_commandline_argument,
now, now, &setsyncdel);
now, now, &setsyncdel);
break;
}
/* -Ddnskey ? */
(void)isoptarg("dnskey", argv, usage);
if (setdel)
if (setdel) {
fatal("-D specified more than once");
}
del = strtotime(isc_commandline_argument,
now, now, &setdel);
del = strtotime(isc_commandline_argument, now, now,
&setdel);
break;
case 'K':
dir = isc_commandline_argument;
if (strlen(dir) == 0U)
if (strlen(dir) == 0U) {
fatal("directory must be non-empty string");
}
break;
case 'L':
ttl = strtottl(isc_commandline_argument);
@@ -341,35 +359,39 @@ main(int argc, char **argv) {
case 'P':
/* -Psync ? */
if (isoptarg("sync", argv, usage)) {
if (setsyncadd)
if (setsyncadd) {
fatal("-P sync specified more than "
"once");
}
syncadd = strtotime(isc_commandline_argument,
now, now, &setsyncadd);
now, now, &setsyncadd);
break;
}
/* -Pdnskey ? */
(void)isoptarg("dnskey", argv, usage);
if (setpub)
if (setpub) {
fatal("-P specified more than once");
}
pub = strtotime(isc_commandline_argument,
now, now, &setpub);
pub = strtotime(isc_commandline_argument, now, now,
&setpub);
break;
case 'f':
filename = isc_commandline_argument;
break;
case 'v':
verbose = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0')
if (*endp != '\0') {
fatal("-v must be followed by a number");
}
break;
case '?':
if (isc_commandline_option != '?')
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
/* FALLTHROUGH */
}
/* FALLTHROUGH */
case 'h':
/* Does not return. */
usage();
@@ -379,23 +401,26 @@ main(int argc, char **argv) {
version(program);
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
}
}
rdclass = strtoclass(classname);
if (argc < isc_commandline_index + 1 && filename == NULL)
if (argc < isc_commandline_index + 1 && filename == NULL) {
fatal("the key file name was not specified");
if (argc > isc_commandline_index + 1)
}
if (argc > isc_commandline_index + 1) {
fatal("extraneous arguments");
}
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
setup_logging(mctx, &log);
@@ -405,23 +430,26 @@ main(int argc, char **argv) {
if (argc < isc_commandline_index + 1) {
/* using filename as zone name */
namestr = filename;
} else
} else {
namestr = argv[isc_commandline_index];
}
result = initname(namestr);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("could not initialize name %s", namestr);
}
result = loadset(filename, &rdataset);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
fatal("could not load DNSKEY set: %s\n",
isc_result_totext(result));
}
for (result = dns_rdataset_first(&rdataset);
result == ISC_R_SUCCESS;
result = dns_rdataset_next(&rdataset)) {
result = dns_rdataset_next(&rdataset))
{
dns_rdata_init(&rdata);
dns_rdataset_current(&rdataset, &rdata);
emit(dir, &rdata);
@@ -429,24 +457,27 @@ main(int argc, char **argv) {
} else {
unsigned char key_buf[DST_KEY_MAXSIZE];
loadkey(argv[isc_commandline_index], key_buf,
DST_KEY_MAXSIZE, &rdata);
loadkey(argv[isc_commandline_index], key_buf, DST_KEY_MAXSIZE,
&rdata);
emit(dir, &rdata);
}
if (dns_rdataset_isassociated(&rdataset))
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10)
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return (1);
} else
} else {
return (0);
}
}

View File

@@ -1,254 +0,0 @@
<!--
- Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- See the COPYRIGHT file distributed with this work for additional
- information regarding copyright ownership.
-->
<!-- Converted by db4-upgrade version 1.0 -->
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.dnssec-importkey">
<info>
<date>2014-02-20</date>
</info>
<refentryinfo>
<date>August 21, 2015</date>
<corpname>ISC</corpname>
<corpauthor>Internet Systems Consortium, Inc.</corpauthor>
</refentryinfo>
<refmeta>
<refentrytitle><application>dnssec-importkey</application></refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>BIND9</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>dnssec-importkey</application></refname>
<refpurpose>import DNSKEY records from external systems so they can be managed</refpurpose>
</refnamediv>
<docinfo>
<copyright>
<year>2013</year>
<year>2014</year>
<year>2015</year>
<year>2016</year>
<year>2018</year>
<year>2019</year>
<year>2020</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>dnssec-importkey</command>
<arg choice="opt" rep="norepeat"><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-L <replaceable class="parameter">ttl</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-P <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-P sync <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D sync <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-V</option></arg>
<arg choice="req" rep="norepeat"><option>keyfile</option></arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>dnssec-importkey</command>
<arg choice="req" rep="norepeat"><option>-f <replaceable class="parameter">filename</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-L <replaceable class="parameter">ttl</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-P <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-P sync <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-D sync <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-V</option></arg>
<arg choice="opt" rep="norepeat"><option>dnsname</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection><info><title>DESCRIPTION</title></info>
<para><command>dnssec-importkey</command>
reads a public DNSKEY record and generates a pair of
.key/.private files. The DNSKEY record may be read from an
existing .key file, in which case a corresponding .private file
will be generated, or it may be read from any other file or
from the standard input, in which case both .key and .private
files will be generated.
</para>
<para>
The newly-created .private file does <emphasis>not</emphasis>
contain private key data, and cannot be used for signing.
However, having a .private file makes it possible to set
publication (<option>-P</option>) and deletion
(<option>-D</option>) times for the key, which means the
public key can be added to and removed from the DNSKEY RRset
on schedule even if the true private key is stored offline.
</para>
</refsection>
<refsection><info><title>OPTIONS</title></info>
<variablelist>
<varlistentry>
<term>-f <replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
Zone file mode: instead of a public keyfile name, the argument
is the DNS domain name of a zone master file, which can be read
from <option>file</option>. If the domain name is the same as
<option>file</option>, then it may be omitted.
</para>
<para>
If <option>file</option> is set to <literal>"-"</literal>, then
the zone data is read from the standard input.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-K <replaceable class="parameter">directory</replaceable></term>
<listitem>
<para>
Sets the directory in which the key files are to reside.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-L <replaceable class="parameter">ttl</replaceable></term>
<listitem>
<para>
Sets the default TTL to use for this key when it is converted
into a DNSKEY RR. If the key is imported into a zone,
this is the TTL that will be used for it, unless there was
already a DNSKEY RRset in place, in which case the existing TTL
would take precedence. Setting the default TTL to
<literal>0</literal> or <literal>none</literal> removes it.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Emit usage message and exit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v <replaceable class="parameter">level</replaceable></term>
<listitem>
<para>
Sets the debugging level.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-V</term>
<listitem>
<para>
Prints version information.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>TIMING OPTIONS</title></info>
<para>
Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
If the argument begins with a '+' or '-', it is interpreted as
an offset from the present time. For convenience, if such an offset
is followed by one of the suffixes 'y', 'mo', 'w', 'd', 'h', or 'mi',
then the offset is computed in years (defined as 365 24-hour days,
ignoring leap years), months (defined as 30 24-hour days), weeks,
days, hours, or minutes, respectively. Without a suffix, the offset
is computed in seconds. To explicitly prevent a date from being
set, use 'none' or 'never'.
</para>
<variablelist>
<varlistentry>
<term>-P <replaceable class="parameter">date/offset</replaceable></term>
<listitem>
<para>
Sets the date on which a key is to be published to the zone.
After that date, the key will be included in the zone but will
not be used to sign it.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-P sync <replaceable class="parameter">date/offset</replaceable></term>
<listitem>
<para>
Sets the date on which CDS and CDNSKEY records that match this
key are to be published to the zone.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D <replaceable class="parameter">date/offset</replaceable></term>
<listitem>
<para>
Sets the date on which the key is to be deleted. After that
date, the key will no longer be included in the zone. (It
may remain in the key repository, however.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D sync <replaceable class="parameter">date/offset</replaceable></term>
<listitem>
<para>
Sets the date on which the CDS and CDNSKEY records that match
this key are to be deleted.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection><info><title>FILES</title></info>
<para>
A keyfile can be designed by the key identification
<filename>Knnnn.+aaa+iiiii</filename> or the full file name
<filename>Knnnn.+aaa+iiiii.key</filename> as generated by
<refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>.
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>dnssec-signzone</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citetitle>BIND 9 Administrator Reference Manual</citetitle>,
<citetitle>RFC 5011</citetitle>.
</para>
</refsection>
</refentry>

Some files were not shown because too many files have changed in this diff Show More