Compare commits

..
Author SHA1 Message Date
Matthijs Mekking d0b1a8b69a fixup! Refactor zone.c, use dns_remote_t structure 2022-10-28 10:26:05 +02:00
Matthijs Mekking 2d2a5dc860 fixup! Add new files for remote server communication 2022-10-28 10:24:36 +02:00
Matthijs Mekking 6bf3a30585 Refactor zone.c, use dns_remote_t structure
Use the new dns_remote_t structure for remote server communication to
primaries, parental agents, etc.
2022-10-26 14:40:30 +02:00
Matthijs Mekking 8cfeb973a4 Add new files for remote server communication
The dns_remote_t structure is intended to replace the variables in
the structure that deals with remote server communication to primaries,
parental agents, forwarders, etc.
2022-10-26 14:38:19 +02:00
Matthijs Mekking 0dc43a0a1f Add updateds system test 2022-10-21 16:33:51 +02:00
Matthijs Mekking 24d9677c0f Add update-ds configuration
Introduce a way to configure servers that can be used to dynamically
update DS records during KSK rollovers. The update-ds configuration
option is a zone only option and may reference a parental-agents
statement.

Add some checkconf checks similar to parental-agents, like the option
being at the wrong level, a duplicate list, an empty list, at the
wrong zone type, and a reference to parental-agents not found.
2022-10-21 16:26:54 +02:00
2932 changed files with 201759 additions and 1256740 deletions
+4 -9
View File
@@ -34,10 +34,6 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(urcu\.h|urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
@@ -54,6 +50,8 @@ IncludeCategories:
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<bind9/'
Priority: 45
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
@@ -63,9 +61,9 @@ IncludeCategories:
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 4
Priority: 1
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
Priority: 1
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
@@ -78,6 +76,3 @@ PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE' ]
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+15 -31
View File
@@ -34,40 +34,26 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
Priority: 10
Priority: 2
- Regex: '^<dns/'
Priority: 15
- Regex: '^<dst/'
Priority: 20
- Regex: '^<isccc/'
Priority: 25
Priority: 3
- Regex: '^<iscccc/'
Priority: 4
- Regex: '^<isccfg/'
Priority: 30
Priority: 5
- Regex: '^<ns/'
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
Priority: 55
- Regex: '^".*"'
Priority: 99
Priority: 6
- Regex: '^<bind9/)'
Priority: 7
- Regex: '^(<[^/]*)/)'
Priority: 8
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
- Regex: '.*'
Priority: 0
Priority: 10
- Regex: '<[[:alnum:].]+>'
Priority: 1
- Regex: '".*"'
Priority: 9
IndentExternBlock: NoIndent
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
@@ -78,5 +64,3 @@ PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+3 -3
View File
@@ -52,7 +52,7 @@
;; libtest
(expand-file-name
(concat directory-of-current-dir-locals-file "tests/include"))
;; bin
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/check"))
@@ -61,7 +61,7 @@
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/confgen"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/confgen/include"))
(concat directory-of-current-dir-locals-file "bin/confgen/include"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/dig/include"))
(expand-file-name
@@ -79,7 +79,7 @@
(expand-file-name "/usr/include/libxml2")
(expand-file-name "/usr/include/json-c")
(expand-file-name "/usr/local/opt/openssl@1.1/include")
(expand-file-name "/usr/local/opt/libxml2/include/libxml2")
(expand-file-name "/usr/local/opt/json-c/include/json-c/")
-5
View File
@@ -1,5 +0,0 @@
[*.sh{,.in}]
indent_style = space
indent_size = 2
binary_next_line = true
switch_case_indent = true
-22
View File
@@ -1526,25 +1526,3 @@ ffaab41a01621c0e02196e225f9269daf8b2ec8f
ffac31097d25039951063bbb9f864e223a46ad1b
# update copyright notice / whitespace
ffbe6b95371c99b7fb05e6de17a8d6b7bf4f629f
# remove trailing whitespace
5893debf46ce1b5fbe793114a59da28fac4cccb7
# arithmetic expansion in system tests
4d42bdc245a1db1654abb502a52a5a8a3a570881
# arithmetic expansion in system tests
1436025e20ae13cfe55df14d62f5812c0cea2ee9
# subshell notation in system tests
05baf7206b7baaf91cb8e049ad13e413c52cdf3f
# reformat shell scripts with shfmt
4cb8b13987b930952238cc88e84272b8cf911933
# Reformat sources with up-to-date clang-format-17
79d93600116faabd89798522817ad95a69684fff
# Reformat sources with up-to-date clang-format-18
b7de2c7cb959fa35099d72c3f9b13938348c74e6
# Reformat sources with up-to-date clang-format-19
ff69d07fed2619a9bedf5ccc18cf106b7dd49bef
# Reformat sources with up-to-date clang-format-19
ebb5bd9c0f079de8970b538fe48e5f5c60ea7ee9
# Remove redundant semicolons after the closing braces of functions
1a19ce39db12ed4ecf59a3d0f5734656d24999a5
# Remove redundant parentheses from the return statement
0258850f202b7a46b52f3e3a4968c3fc68fe9a45
+1 -1
View File
@@ -10,4 +10,4 @@
/util/** export-ignore
/util/bindkeys.pl -export-ignore
/util/check-make-install.in -export-ignore
/util/dtrace.sh -export-ignore
/util/mksymtbl.pl -export-ignore
-1
View File
@@ -1 +0,0 @@
contrib/gitchangelog/changelog.rc.py
-55
View File
@@ -1,55 +0,0 @@
name: "CodeQL"
on:
push:
branches: [ "bind-9.16", "bind-9.18", "main" ]
schedule:
- cron: '39 8 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: liburcu-dev libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
version: 1.0
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
-50
View File
@@ -1,50 +0,0 @@
name: SonarCloud
on:
push:
branches: [ "bind-9.16", "bind-9.18", "main" ]
schedule:
- cron: '39 8 * * 3'
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: liburcu-dev libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
version: 1.0
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Run build-wrapper
run: |
autoreconf -fi
./configure
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
-3
View File
@@ -5,7 +5,6 @@
*.la
*.lo
*.log
*.log.txt
*.o
*.orig
*.plist/ # ccc-analyzer store its results in .plist directories
@@ -75,7 +74,6 @@ doc/man/dnssec-importkey.8in
doc/man/dnssec-keyfromlabel.8in
doc/man/dnssec-keygen.8in
doc/man/dnssec-keymgr.8in
doc/man/dnssec-ksr.8in
doc/man/dnssec-revoke.8in
doc/man/dnssec-settime.8in
doc/man/dnssec-signzone.8in
@@ -96,7 +94,6 @@ doc/man/pkcs11-tokens.8in
/GPATH
/GRTAGS
/GTAGS
TAGS
# Emacs specific files
\.dir-locals-2.el
/emacs.desktop
+456 -811
View File
File diff suppressed because it is too large Load Diff
+21 -38
View File
@@ -1,63 +1,46 @@
<!--
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please make sure that you make the new issue
confidential by clicking the checkbox at the bottom!
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
-->
### Summary
<!-- Concisely summarize the bug encountered. -->
(Summarize the bug encountered concisely.)
### BIND version affected
<!--
Make sure you are testing with the **latest** supported version of BIND
for a given branch. Many bugs have been fixed over time!
### BIND version used
See https://kb.isc.org/docs/supported-platforms for the current list.
The latest source is available from https://www.isc.org/download/#BIND
Paste the output of `named -V` here.
-->
(Paste the output of `named -V`.)
### Steps to reproduce
<!--
This is extremely important! Be precise and use itemized lists, please.
Even if a default configuration is affected, please include the full configuration
files _you were testing with_.
Example:
1. Use _attached_ configuration file
2. Start BIND server with command: `named -g -c named.conf ...`
3. Simulate legitimate clients using command `dnsperf -S1 -d legit-queries ...`
4. Simulate attack traffic using command `dnsperf -S1 -d attack-queries ...`
-->
1.
2.
3.
(How one can reproduce the issue - this is very important.)
### What is the current *bug* behavior?
<!-- What actually happens. -->
(What actually happens.)
### What is the expected *correct* behavior?
<!-- What you should see instead. -->
(What you should see instead.)
### Relevant configuration files
<!-- Paste any relevant configuration files here - please use code blocks (```)
(Paste any relevant configuration files - please use code blocks (```)
to format console output. If submitting the contents of your
configuration file in a non-confidential issue, it is advisable to
obscure key secrets; this can be done automatically by using
`named-checkconf -px`. -->
configuration file in a non-confidential Issue, it is advisable to
obscure key secrets: this can be done automatically by using
`named-checkconf -px`.)
### Relevant logs
### Relevant logs and/or screenshots
<!-- Paste any relevant logs here - please use code blocks (```) to format console
output, logs, and code, as it's very hard to read otherwise. -->
(Paste any relevant logs - please use code blocks (```) to format console
output, logs, and code, as it's very hard to read otherwise.)
/label ~Bug
### Possible fixes
(If you can, link to the line of code that might be responsible for the
problem.)
/label ~bug
+37
View File
@@ -0,0 +1,37 @@
<!--
THIS ISSUE TEMPLATE IS INTENDED ONLY FOR INTERNAL USE.
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
-->
### CVE-specific actions
- [ ] Assign a CVE identifier
- [ ] Determine CVSS score
- [ ] Determine the range of BIND versions affected (including the Subscription Edition)
- [ ] Determine whether workarounds for the problem exists
- [ ] Create a draft of the security advisory and put the information above in there
- [ ] Prepare a detailed description of the problem which should include the following by default:
- instructions for reproducing the problem (a system test is good enough)
- explanation of code flow which triggers the problem (a system test is *not* good enough)
- [ ] Prepare a private merge request containing the following items in separate commits:
- a test for the issue (may be moved to a separate merge request for deferred merging)
- a fix for the issue
- documentation updates (`CHANGES`, release notes, anything else applicable)
- [ ] Ensure the merge request from the previous step is reviewed by SWENG staff and has no outstanding discussions
- [ ] Ensure the documentation changes introduced by the merge request addressing the problem are reviewed by Support and Marketing staff
- [ ] Prepare backports of the merge request addressing the problem for all affected (and still maintained) BIND branches (backporting might affect the issue's scope and/or description)
- [ ] Prepare a standalone patch for the last stable release of each affected (and still maintained) BIND branch
### Release-specific actions
- [ ] Create/update the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] Ensure the merge requests containing CVE fixes are merged into `security-*` branches in CVE identifier order
### Post-disclosure actions
- [ ] Merge a regression test reproducing the bug into all affected (and still maintained) BIND branches
-8
View File
@@ -1,8 +0,0 @@
Hi and thanks for filing an issue! It will be read with care by human beings.
It would be a tremendous help if you could follow these steps first:
- [ ] Search the existing issues in GitLab (both open and closed) to see if your report might be a duplicate. We have a large database here and many issues have already been fixed in the latest versions!
- [ ] Make sure this is **not** a support question. If you have specific trouble configuring or debugging your setup, please use the bind-users mailing list: https://lists.isc.org/mailman/listinfo/bind-users
- [ ] You have read and understood the "out in the open" support policy: https://blog.powerdns.com/2016/01/18/open-source-support-out-in-the-open/ . Even though it was written by the PowerDNS folks, we follow it as well!
Before continuing, **please select the appropriate issue template in the drop-down menu above, under the heading _Description_**.
+1 -1
View File
@@ -8,4 +8,4 @@
### Links / references
/label ~Feature
/label ~"feature request"
@@ -1,129 +0,0 @@
<!--
THIS ISSUE TEMPLATE IS INTENDED ONLY FOR INTERNAL USE.
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please make sure that you make the new issue
confidential!
-->
| Quick Links | :link: |
| ------------------------ | ------------------------------------ |
| Incident Manager: | @user |
| Deputy Incident Manager: | @user |
| Public Disclosure Date: | YYYY-MM-DD |
| CVSS Score: | [0.0][cvss_score] |
| CWE: | [CWE-NNN][cwe_category]
| Security Advisory: | isc-private/printing-press!NNN |
| Mattermost Channel: | [CVE-YYYY-NNNN][mattermost_url] |
| Support Ticket: | [URL] |
| Release Checklist: | #NNNN |
[cvss_score]: https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:X/AC:X/PR:X/UI:X/S:X/C:X/I:X/A:X&version=3.1
[cwe_category]: https://cwe.mitre.org/data/definitions/NNN.html
[mattermost_url]:
:bulb: **Click [here][checklist_explanations] (internal resource) for general information about the security incident handling process.**
[checklist_explanations]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations
### Earlier Than T-5
- [ ] [:link:][step_deputy] **(IM)** Pick a Deputy Incident Manager
- [ ] [:link:][step_respond] **(IM)** Respond to the bug reporter
- [ ] [:link:][step_public_mrs] **(SwEng)** Ensure there are no public merge requests which inadvertently disclose the issue
- [ ] [:link:][step_coordinate_cve_id] **(SwEng)** Check if we need to coordinate with other vendors (an industry-wide CVE identifier might be necessary)
- [ ] [:link:][step_assign_cve_id] **(IM)** Assign a CVE identifier
- [ ] [:link:][step_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier, the CVSS score, and the CWE category
- [ ] [:link:][step_versions_affected] **(SwEng)** Determine the range of product versions affected (including the Subscription Edition)
- [ ] [:link:][step_workarounds] **(SwEng)** Determine whether workarounds for the problem exist
- [ ] [:link:][step_earliest_prepare] **(Support)** Prepare "earliest" notification text
- [ ] [:link:][step_earliest_send] **(Support)** Update "earliest" notification ticket in support portal Earliest queue which will notify earliest customers
- [ ] [:link:][step_advisory_mr] **(Support)** Create a merge request for the Security Advisory and include all readily available information in it
- [ ] [:link:][step_reproducer_mr] **(SwEng)** Prepare a private merge request containing a system test reproducing the problem
- [ ] [:link:][step_notify_support] **(SwEng)** Notify Support when a reproducer is ready
- [ ] [:link:][step_code_analysis] **(SwEng)** Prepare a detailed explanation of the code flow triggering the problem
- [ ] [:link:][step_fix_mr] **(SwEng)** Prepare a private merge request with the fix
- [ ] [:link:][step_review_fix] **(SwEng)** Ensure the merge request with the fix is reviewed and has no outstanding discussions
- [ ] [:link:][step_review_docs] **(Support)** Review the documentation changes introduced by the merge request with the fix
- [ ] [:link:][step_backports] **(SwEng)** Prepare backports of the merge request addressing the problem for all affected (and still maintained) branches of a given product
- [ ] [:link:][step_finish_advisory] **(Support)** Finish preparing the Security Advisory
- [ ] [:link:][step_meta_issue] **(QA)** Create (or update) the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] [:link:][step_coordinate_check] **(SwEng)** Make sure other vendors are able to release on the date that was previously agreed upon
- [ ] [:link:][step_merge_fixes] **(QA)** Merge the CVE fixes in CVE identifier order
- [ ] [:link:][step_patches] **(QA)** Prepare a standalone patch for the last stable release of each affected (and still maintained) product branch
- [ ] [:link:][step_asn_releases] **(QA)** Prepare ASN releases (as outlined in the Release Checklist)
### At T-5
- [ ] [:link:][step_asn_links] **(Marketing)** (BIND 9 only) Update the BIND -S information document in the support portal with download links to the new versions
- [ ] [:link:][step_asn_send] **(Support)** Notify eligible customers by adding a ticket to the 5 Day queue in RT with the text of the advisory (earliest, and T-5)
- [ ] [:link:][step_preannouncement] **(Marketing)** (BIND 9 only) Send a pre-announcement email to the *bind-announce* mailing list to alert users that the upcoming release will include security fixes
### At T-3
- [ ] [:link:][step_asn_send] **(Support)** Notify eligible customers by adding a ticket to the 3 Day queue in RT with the text of the advisory (T-3)
### At T-1
- [ ] [:link:][step_packager_emails] **(First IM)** Send notifications to OS packagers
### On the Day of Public Disclosure
- [ ] [:link:][step_clearance] **(IM)** Grant QA & Marketing clearance to proceed with public release
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Add the new CVEs to the vulnerability matrix in the Knowledge Base
- [ ] [:link:][step_bump_advisory] **(Support)** Bump Document Version for the Security Advisory in Printing Press
- [ ] [:link:][step_publish_advisory] **(Support)** Publish the Security Advisory in the Knowledge Base
- [ ] [:link:][step_publish] **(QA/Marketing)** Publish the releases (as outlined in the release checklist)
- [ ] [:link:][step_notifications] **(First IM)** Send notification emails to third parties
- [ ] [:link:][step_mitre] **(First IM)** Advise MITRE about the disclosed CVEs
- [ ] [:link:][step_merge_advisory] **(First IM)** Merge the Security Advisory merge request
- [ ] [:link:][step_embargo_end] **(IM)** Inform original reporter (if external) that the security disclosure process is complete
- [ ] [:link:][step_asn_clear] **(Support)** Update the tickets in the ASN queues in RT that the embargo is lifted
- [ ] [:link:][step_customers] **(Marketing)** Open a ticket in the appropriate announce queue in RT that the release is published
### After Public Disclosure
- [ ] [:link:][step_regression] **(QA)** Merge a regression test reproducing the bug into all affected (and still maintained) branches
[step_deputy]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#pick-a-deputy-incident-manager
[step_respond]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#respond-to-the-bug-reporter
[step_public_mrs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-there-are-no-public-merge-requests-which-inadvertently-disclose-the-issue
[step_coordinate_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#check-if-we-need-to-coordinate-with-other-vendors-an-industry-wide-cve-identifier-might-be-necessary
[step_assign_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#assign-a-cve-identifier
[step_note_cve_info]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-this-issue-with-the-assigned-cve-identifier-the-cvss-score-and-the-cwe-category
[step_versions_affected]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-the-range-of-product-versions-affected-including-the-subscription-edition
[step_workarounds]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-whether-workarounds-for-the-problem-exist
[step_earliest_prepare]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-earliest-notification-text
[step_earliest_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-earliest-notification-ticket-in-support-portal-earliest-queue-which-will-notify-earliest-customers
[step_advisory_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-a-merge-request-for-the-security-advisory-and-include-all-readily-available-information-in-it
[step_reproducer_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-containing-a-system-test-reproducing-the-problem
[step_notify_support]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-support-when-a-reproducer-is-ready
[step_code_analysis]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-detailed-explanation-of-the-code-flow-triggering-the-problem
[step_fix_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-with-the-fix
[step_review_fix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-the-merge-request-with-the-fix-is-reviewed-and-has-no-outstanding-discussions
[step_review_docs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#review-the-documentation-changes-introduced-by-the-merge-request-with-the-fix
[step_backports]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-backports-of-the-merge-request-addressing-the-problem-for-all-affected-and-still-maintained-branches-of-a-given-product
[step_finish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#finish-preparing-the-security-advisory
[step_meta_issue]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-or-update-the-private-issue-containing-links-to-fixes-reproducers-for-all-cves-fixed-in-a-given-release-cycle
[step_coordinate_check]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#make-sure-other-vendors-are-able-to-release-on-the-date-that-was-previously-agreed-upon
[step_merge_fixes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-cve-fixes-in-cve-identifier-order
[step_patches]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-standalone-patch-for-the-last-stable-release-of-each-affected-and-still-maintained-product-branch
[step_asn_releases]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-asn-releases-as-outlined-in-the-release-checklist
[step_asn_links]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-the-bind-s-information-document-in-the-support-portal-with-download-links-to-the-new-versions
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-eligible-customers-by-adding-a-ticket-to-the-5-day-queue-in-rt-with-the-text-of-the-advisory-earliest-and-t-5
[step_preannouncement]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-send-a-pre-announcement-email-to-the-bind-announce-mailing-list-to-alert-users-that-the-upcoming-release-will-include-security-fixes
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-eligible-customers-by-adding-a-ticket-to-the-3-day-queue-in-rt-with-the-text-of-the-advisory-t-3
[step_packager_emails]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notifications-to-os-packagers
[step_clearance]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#grant-qa-marketing-clearance-to-proceed-with-public-release
[step_matrix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-add-the-new-cves-to-the-vulnerability-matrix-in-the-knowledge-base
[step_bump_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bump-document-version-for-the-security-advisory-in-printing-press
[step_publish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-security-advisory-in-the-knowledge-base
[step_publish]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-releases-as-outlined-in-the-release-checklist
[step_notifications]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notification-emails-to-third-parties
[step_mitre]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#advise-mitre-about-the-disclosed-cves
[step_merge_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-security-advisory-merge-request
[step_embargo_end]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-original-reporter-if-external-that-the-security-disclosure-process-is-complete
[step_asn_clear]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-tickets-in-the-asn-queues-in-rt-that-the-embargo-is-lifted
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#open-a-ticket-in-the-appropriate-announce-queue-in-rt-that-the-release-is-published
[step_regression]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-a-regression-test-reproducing-the-bug-into-all-affected-and-still-maintained-branches
/confidential
+92
View File
@@ -0,0 +1,92 @@
## Release Schedule
**Code Freeze:**
**Tagging Deadline:**
**Public Release:**
## Documentation Review Links
**Closed issues assigned to the milestone without a release note:**
- []()
- []()
- []()
**Merge requests merged into the milestone without a release note:**
- []()
- []()
- []()
**Merge requests merged into the milestone without a `CHANGES` entry:**
- []()
- []()
- []()
## Release Checklist
### Before the Code Freeze
- [ ] ***(QA)*** Inform Support and Marketing of impending release (and give estimated release dates).
- [ ] ***(QA)*** Ensure there are no permanent test failures on any platform.
- [ ] ***(QA)*** Check Perflab to ensure there has been no unexplained drop in performance for the versions being released.
- [ ] ***(QA)*** Check whether all issues assigned to the release milestone are resolved[^1].
- [ ] ***(QA)*** Ensure that there are no outstanding merge requests in the private repository[^1] (Subscription Edition only).
- [ ] ***(QA)*** Ensure all merge requests marked for backporting have been indeed backported.
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to disallow merging to them.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is in effect.
### Before the Tagging Deadline
- [ ] ***(QA)*** Ensure release notes are correct, ask Support and Marketing to check them as well.
- [ ] ***(QA)*** Add a release marker to `CHANGES`.
- [ ] ***(QA)*** Add a release marker to `CHANGES.SE` (Subscription Edition only).
- [ ] ***(QA)*** Update BIND 9 version in `configure.ac` (9.18+) or `version` (9.16).
- [ ] ***(QA)*** Rebuild `configure` using Autoconf on `docs.isc.org` (9.16).
- [ ] ***(QA)*** Tag the releases in the private repository (`git tag -s -m "BIND 9.x.y" v9_x_y`).
### Before the ASN Deadline (for ASN Releases) or the Public Release Date (for Regular Releases)
- [ ] ***(QA)*** Check that the formatting is correct for HTML and PDF versions of release notes.
- [ ] ***(QA)*** Check that the formatting of the generated man pages is correct.
- [ ] ***(QA)*** Verify GitLab CI results for the tags created and prepare a QA report for the releases to be published.
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to allow merging to them again.
- [ ] ***(QA)*** Prepare and merge MRs resetting the release notes and updating the version string for each maintained branch.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is over.
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums.
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again.
- [ ] ***(Support)*** Pre-publish ASN and/or Subscription Edition tarballs so that packages can be built.
- [ ] ***(QA)*** Build and test ASN and/or Subscription Edition packages.
- [ ] ***(QA)*** Notify Support that the releases have been prepared.
- [ ] ***(Support)*** Send out ASNs (if applicable).
### On the Day of Public Release
- [ ] ***(Support)*** Wait for clearance from Security Officer to proceed with the public release (if applicable).
- [ ] ***(Support)*** Place tarballs in public location on FTP site.
- [ ] ***(Support)*** Publish links to downloads on ISC website.
- [ ] ***(Support)*** Write release email to *bind-announce*.
- [ ] ***(Support)*** Write email to *bind-users* (if a major release).
- [ ] ***(Support)*** Send eligible customers updated links to the Subscription Edition (update the -S edition delivery tickets, even if those links were provided earlier via an ASN ticket).
- [ ] ***(Support)*** Update tickets in case of waiting support customers.
- [ ] ***(QA)*** Build and test any outstanding private packages.
- [ ] ***(QA)*** Build public RPMs.
- [ ] ***(SwEng)*** Build Debian/Ubuntu packages.
- [ ] ***(SwEng)*** Update Docker images.
- [ ] ***(QA)*** Inform Marketing of the release.
- [ ] ***(Marketing)*** Post short note to Twitter.
- [ ] ***(Marketing)*** Update [Wikipedia entry for BIND](https://en.wikipedia.org/wiki/BIND).
- [ ] ***(Marketing)*** Write blog article (if a major release).
- [ ] ***(QA)*** Ensure all new tags are annotated and signed.
- [ ] ***(QA)*** Push tags for the published releases to the public repository.
- [ ] ***(QA)*** Merge published release tags (non-linearly) back into the their relevant development/maintenance branches.
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to the current release milestone and do not describe a security vulnerability, then make them public.
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to older release milestones and describe security vulnerabilities, then make them public if appropriate[^2].
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Black, PyLint) by modifying the relevant `Dockerfile`.
[^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone.
[^2]: As a rule of thumb, security vulnerabilities which have reproducers merged to the public repository are considered okay for full disclosure.
-139
View File
@@ -1,139 +0,0 @@
### Summary
<!--
Concisely summarize the bug encountered,
preferably in one paragraph or less.
-->
### BIND versions affected
<!--
Make sure you are testing with the **latest** supported version of BIND.
See https://kb.isc.org/docs/supported-platforms for the current list.
The latest source is available from https://www.isc.org/download/#BIND
Paste the output of `named -V` here.
-->
### Preconditions and assumptions
<!--
Is a specific setup needed?
Please check the BIND Security Assumptions chapter in the ARM:
https://bind9.readthedocs.io/en/latest/chapter7.html#security-assumptions
E.g. DNSSEC validation must be disabled, etc.
E.g. Resolver must be configured to forward to attacker's server via DNS-over-TLS, etc.
E.g. Authoritative server must be configured to transfer specific primary zone.
E.g. Attacker must be in posession of a key authorized to modify at least one zone.
E.g. Attacker can affect system clock on the server running BIND.
-->
### Attacker's abilities
<!--
What resources does an attacker need to have under their control to mount this attack?
E.g. If attacking an authoritative server, does the attacked have to have prior
relationship with it? "The authoritative server under attack needs to
transfer a malicious zone from attacker's authoritative server via TLS."
E.g. If attacking a resolver, does the attacker need the ability to send
arbitrary queries to the resolver under attack? Do they need to _also_ control
an authoritative server at the same time?
-->
### Impact
<!--
Who or what is the victim of the attack and what is the impact?
Is a third party receiving many packets generated by a reflection attack?
If the affected party is the BIND server itself, please quantify the impact
on legitimate clients:
E.g. After launching the attack, the answers-per-second metric for legitimate
traffic drops to 1/1000 within the first minute of the attack.
-->
### Steps to reproduce
<!--
This is extremely important! Be precise and use itemized lists, please.
Even if a default configuration is affected, please include the full configuration
files _you were testing with_.
Example:
1. Use the _attached_ configuration file
2. Start the BIND server with command: `named -g -c named.conf ...`
3. Simulate legitimate clients using the command `dnsperf -S1 -d legit-queries ...`
4. Simulate attack traffic using the command `dnsperf -S1 -d attack-queries ...`
-->
1.
2.
3.
### What is the current *bug* behavior?
<!--
Examples:
Legitimate QPS drops 1000x.
Memory consumption increases out of bounds and the server crashes.
The server crashes immediately.
-->
### What is the expected *correct* behavior?
<!--
If the attack causes resource exhaustion, what do you think the correct
behavior should be? Should BIND refuse to process more requests?
What heuristic do you propose to distinguish legitimate and attack traffic?
-->
### Relevant logs
<!--
Please provide log files from your testing. Include full named logs and also
the output from any testing tools (e.g. dnsperf, DNS Shotgun, kxdpgun, etc.)
If multiple log files are needed, make sure all the files have matching timestamps
so we can correlate log events across log files.
In the case of resource exhaustion attacks, please _also_ include system monitoring
data. You can use https://gitlab.isc.org/isc-projects/resource-monitor/ to
gather system-wide statistics.
-->
### Coordination
- Does this issue affect multiple implementations?
<!--
Issues affecting multiple implementations require very careful coordination. We
have to make sure the information does not leak to the public until vendors are ready to
release fixed versions. If it is a multi-vendor issue, we need to know about the situation
as soon as possible to start the (confidential!) coordination process within
DNS-OARC and other suitable fora.
Please list implementations you have tested.
-->
- Have you shared the information with anyone else?
<!--
Have you informed other affected vendors? Or maybe submitted a paper for
review?
-->
- What is your plan to publicize this issue?
<!--
E.g. we plan to go public during conference XYZ on 20XX-XX-XX
-->
### Acknowledgements
<!--
Please specify whether and how you would like to be publicly credited with
discovering the issue. We normally use the format:
First_name Last_name, Company_or_Team.
-->
<!-- DO NOT modify the following two lines. -->
/label ~Bug ~Security
/confidential
+35
View File
@@ -0,0 +1,35 @@
extraction:
cpp:
prepare:
packages:
- "libxml2-dev"
- "libjson-c-dev"
- "libssl-dev"
- "zlib1g-dev"
- "libcmocka-dev"
- "pkg-config"
- "libcap2-dev"
- "libedit-dev"
- "libidn2-dev"
- "libmaxminddb-dev"
- "libuv1-dev"
- "libnghttp2-dev"
configure:
command:
- "autoreconf -fi"
- "CFLAGS=\"-Og -g\" ./configure --enable-developer"
path_classifiers:
test:
- "lib/*/tests/"
- "bin/tests/"
docs:
- "**/*.xml"
- "**/*.docbook"
- "**/*.html"
- "**/*.1"
- "**/*.5"
- "**/*.8"
queries:
- exclude: fuzz/
- exclude: "bin/tests/system/*/ans*/*.py"
- exclude: cpp/use-of-goto
-27
View File
@@ -1,27 +0,0 @@
Alan Clegg <aclegg@isc.org>
Alessio Podda <alessio@isc.org>
Aram Sargsyan <aram@isc.org>
Artem Boldariev <artem@isc.org> <artem@boldariev.com>
Curtis Blackburn <ckb@isc.org> <ckb@freebsd11.local>
Curtis Blackburn <ckb@isc.org> <ckb@isc.org>
Diego Fronza <diego@isc.org>
Evan Hunt <each@isc.org> Evan Hunt <fanf@isc.org>
Håvard Eidnes <he@uninett.no>
Jeremy C. Reed <jreed@isc.org> <jreed@docs.lab.isc.org>
Jeremy C. Reed <jreed@isc.org> <jreed@ISC.org>
Joey Salazar <joey@isc.org>
John H. DuBois III <johnd>
Mark Andrews <marka@isc.org>
Mark Andrews <marka@isc.org> <marka@daemon.lab.isc.org>
Mark Andrews <marka@isc.org> <marka@newdocs.lab.isc.org>
Matthijs Mekking <matthijs@isc.org> <github@pletterpet.nl>
Nicki Křížek <nicki@isc.org> <tkrizek@isc.org>
Ondřej Surý <ondrej@isc.org>
Ondřej Surý <ondrej@isc.org> <ondrej@openbsd-6-9.home.sury.org>
Ondřej Surý <ondrej@isc.org> <ondrej@sury.org>
Petr Menšík <pemensik@redhat.com>
Petr Menšík <pemensik@redhat.com> <pmensik@redhat.com>
Robert Edmonds <edmonds>
Tatuya JINMEI 神明達哉 <jinmei@isc.org>
Witold Kręcicki <wpk@isc.org>
Witold Kręcicki <wpk@isc.org> <wpk@culm.net>
+1 -20
View File
@@ -1,28 +1,9 @@
[IMPORTS]
deprecated-modules=
dns.resolver,
[MESSAGES CONTROL]
[MASTER]
disable=
C0103, # invalid-name
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
C0209, # consider-using-f-string
C0301, # line-too-long, handled better by black
C0302, # too-many-lines
C0415, # import-outside-toplevel
R0801, # duplicate-code
R0901, # too-many-ancestors
R0902, # too-many-instance-attributes
R0903, # too-few-public-methods
R0904, # too-many-public-methods
R0911, # too-many-return-statements
R0912, # too-many-branches
R0913, # too-many-arguments
R0914, # too-many-locals
R0915, # too-many-statements
R0916, # too-many-boolean-expressions
R0917, # too-many-positional-arguments
-18
View File
@@ -1,18 +0,0 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_build:
- python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
# Build documentation in doc/arm/ with Sphinx
sphinx:
configuration: doc/arm/conf.py
# Build all formats
formats: all
+4 -43
View File
@@ -24,8 +24,8 @@ Files: **/*.after*
**/testdata/*
.github/*
.gitlab/*
.mailmap
AUTHORS
CHANGES
COPYRIGHT
Makefile
Makefile.*
@@ -38,31 +38,10 @@ Files: **/*.after*
bin/tests/system/doth/CA/index.txt
bin/tests/system/doth/CA/index.txt.attr
bin/tests/system/doth/CA/serial
bin/tests/system/formerr/badnsec3owner
bin/tests/system/formerr/badrecordname
bin/tests/system/formerr/dupans
bin/tests/system/formerr/dupquestion
bin/tests/system/formerr/keyclass
bin/tests/system/formerr/malformeddeltype
bin/tests/system/formerr/malformedrrsig
bin/tests/system/notify/ns4/named.port.in
bin/tests/system/formerr/nametoolong
bin/tests/system/formerr/noquestions
bin/tests/system/formerr/optwrongname
bin/tests/system/formerr/qtypeasanswer
bin/tests/system/formerr/questionclass
bin/tests/system/formerr/shortquestion
bin/tests/system/formerr/shortrecord
bin/tests/system/formerr/tsignotlast
bin/tests/system/formerr/tsigwrongclass
bin/tests/system/formerr/twoquestionnames
bin/tests/system/formerr/twoquestiontypes
bin/tests/system/formerr/wrongclass
bin/tests/system/forward/CA/CA.cfg
bin/tests/system/forward/CA/README
bin/tests/system/forward/CA/index.txt
bin/tests/system/forward/CA/index.txt.attr
bin/tests/system/forward/CA/serial
bin/tests/system/isctest/vars/.ac_vars/*
bin/tests/system/formerr/twoquestions
bin/tests/system/journal/ns1/managed-keys.bind.in
bin/tests/system/journal/ns1/managed-keys.bind.jnl.in
bin/tests/system/journal/ns2/managed-keys.bind.in
@@ -70,15 +49,6 @@ Files: **/*.after*
bin/tests/system/keepalive/expected
bin/tests/system/legacy/ns6/edns512.db.signed
bin/tests/system/legacy/ns7/edns512-notcp.db.signed
bin/tests/system/masterfile/knowngood.include
bin/tests/system/masterfile/knowngood.ttl1
bin/tests/system/masterfile/knowngood.ttl2
bin/tests/system/notify/CA/CA.cfg
bin/tests/system/notify/CA/README
bin/tests/system/notify/CA/index.txt
bin/tests/system/notify/CA/index.txt.attr
bin/tests/system/notify/CA/serial
bin/tests/system/notify/ns4/named.port.in
bin/tests/system/nsupdate/CA/CA.cfg
bin/tests/system/nsupdate/CA/README
bin/tests/system/nsupdate/CA/index.txt
@@ -106,10 +76,7 @@ Files: **/*.after*
bin/tests/system/unknown/large.out
bin/tests/system/xfer/ans5/badkeydata
bin/tests/system/xfer/ans5/badmessageid
bin/tests/system/xfer/ans5/ednsformerr
bin/tests/system/xfer/ans5/ednsnotimp
bin/tests/system/xfer/ans5/goodaxfr
bin/tests/system/xfer/ans5/ixfrnotimp
bin/tests/system/xfer/ans5/partial
bin/tests/system/xfer/ans5/soamismatch
bin/tests/system/xfer/ans5/unknownkey
@@ -185,23 +152,17 @@ Files: **/.clang-format
.clang-format
.clang-format.headers
.dir-locals.el
.editorconfig
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitlab-ci.yml
.lgtm.yml
.pylintrc
.readthedocs.yaml
.tsan-suppress
.uncrustify.cfg
contrib/gitchangelog/changelog.rc.py
contrib/gitchangelog/relnotes.rc.py
doc/misc/*.zoneopt
doc/misc/options
doc/misc/rndc.grammar
sonar-project.properties
tests/bench/names.csv
tsan-suppressions.txt
Copyright: Internet Systems Consortium, Inc. ("ISC")
License: CC0-1.0
-3
View File
@@ -1,3 +0,0 @@
# Uninstrumented libraries
called_from_lib:libfstrm.so
race:dummyrpz
-1
View File
@@ -51,4 +51,3 @@ Anay Panvalkar
colleen
Robert Edmonds
João Damas
Artem Boldariev (Артем Болдарєв)
+20536
View File
File diff suppressed because it is too large Load Diff
+29 -15
View File
@@ -11,7 +11,7 @@ See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
-->
## BIND 9 Source Access and Contributor Guidelines
*Nov 26, 2024*
*May 28, 2020*
### Contents
@@ -71,14 +71,14 @@ To clone the repository, use:
> $ git clone https://gitlab.isc.org/isc-projects/bind9.git
Release branch names are of the form `bind-9.X`, where X represents the second
number in the BIND 9 version number. So, to check out the BIND 9.20
Release branch names are of the form `v9_X`, where X represents the second
number in the BIND 9 version number. So, to check out the BIND 9.12
branch, use:
> $ git checkout bind-9.20
> $ git checkout v9_12
Whenever a branch is ready for publication, a tag is placed of the
form `v9.X.Y`. The 9.20.0 release, for instance, is tagged as `v9.20.0`.
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
`main`.
@@ -102,7 +102,22 @@ Twitter, or Facebook.
### Reporting possible security issues
See `SECURITY.md`.
If you think you may be seeing a potential security vulnerability in BIND
(for example, a crash with REQUIRE, INSIST, or ASSERT failure), please
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/pgpkey/).
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/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/docs/aa-00340)
### <a name="contrib"></a>Contributing code
@@ -121,9 +136,8 @@ 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 repository for
BIND. Please contact ISC and provide your GitLab username in order to be allowed
to fork the project and submit merge requests.
[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
BIND -- preferably the current top of the `main` branch. Diffs may
@@ -145,8 +159,8 @@ 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 unit and system tests to ensure your change hasn't caused any
functional regressions (these can be checked in the CI pipeline).
* 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.
* In patches that make non-trivial functional changes, include system
@@ -157,12 +171,12 @@ To ensure your patch is acted on as promptly as possible, please:
##### Changes to `configure`
If you need to make changes to `configure`, you should not edit it
directly; instead, edit `configure.ac`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.ac` and run
directly; instead, edit `configure.in`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.in` and run
`autoheader`.
When submitting a patch as a diff, it's fine to omit the `configure`
diffs to save space. Just send the `configure.ac` diffs and we'll
diffs to save space. Just send the `configure.in` diffs and we'll
generate the new `configure` during the review process.
##### Documentation
@@ -174,7 +188,7 @@ of documentation in the BIND source tree:
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 HTML version is automatically generated from
`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.
+26 -26
View File
@@ -1,4 +1,4 @@
Copyright (C) 1996-2023 Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 1996-2022 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
@@ -133,7 +133,7 @@ modification, are permitted provided that the following conditions are met:
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 COPYRIGHT HOLDERS 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
@@ -149,35 +149,35 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
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.
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.
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 Institute nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
-----------------------------------------------------------------------------
+8 -9
View File
@@ -1,26 +1,25 @@
include $(top_srcdir)/Makefile.top
SUBDIRS = . lib doc
SUBDIRS = . lib doc bin fuzz
# build libtest before fuzz/* and bin/tests
if HAVE_CMOCKA
SUBDIRS += tests
endif HAVE_CMOCKA
# run fuzz tests before system tests
SUBDIRS += fuzz bin
BUILT_SOURCES += bind.keys.h
CLEANFILES += bind.keys.h
BUILT_SOURCES = bind.keys.h
CLEANFILES = bind.keys.h
bind.keys.h: bind.keys Makefile
${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@
dist_sysconf_DATA = bind.keys
.PHONY: doc
EXTRA_DIST = \
bind.keys \
util/bindkeys.pl \
util/dtrace.sh \
contrib \
CHANGES \
COPYRIGHT \
LICENSE \
*.md
+4
View File
@@ -14,6 +14,7 @@ LF = \n
RNDC_CONF = .. |rndc_conf| replace:: ``$(sysconfdir)/rndc.conf``
RNDC_KEY = .. |rndc_key| replace:: ``$(sysconfdir)/rndc.key``
NAMED_CONF = .. |named_conf| replace:: ``$(sysconfdir)/named.conf``
BIND_KEYS = .. |bind_keys| replace:: ``$(sysconfdir)/bind.keys``
NAMED_PID = .. |named_pid| replace:: ``$(runstatedir)/named.pid``
SESSION_KEY = .. |session_key| replace:: ``$(runstatedir)/session.key``
@@ -25,8 +26,11 @@ common_SPHINXOPTS = \
-a \
$(SPHINX_V)
# The "today" variable set below is not directly used in the ARM, but its value
# is implicitly inserted on the title page of the PDF file produced by Sphinx.
ALLSPHINXOPTS = \
$(common_SPHINXOPTS) \
-D today="$(RELEASE_DATE)" \
-D rst_epilog="$$(printf "$${RST_EPILOG}")" \
$(SPHINXOPTS) \
$(srcdir)
-20
View File
@@ -1,20 +0,0 @@
# Hey Emacs, this is -*- makefile-automake -*- file!
# vim: filetype=automake
AM_V_DTRACE = $(AM_V_DTRACE_@AM_V@)
AM_V_DTRACE_ = $(AM_V_DTRACE_@AM_DEFAULT_V@)
AM_V_DTRACE_0 = @echo " DTRACE $@";
BUILT_SOURCES += probes.h
CLEANFILES += probes.h probes.o
probes.h: Makefile probes.d
$(AM_V_DTRACE)$(DTRACE) -s $(srcdir)/probes.d -h -o $@
probes.lo: Makefile probes.d $(DTRACE_DEPS)
$(AM_V_DTRACE)$(LIBTOOL) --mode=compile --tag=CC $(DTRACE) -s $(srcdir)/probes.d -G -o $@ $(DTRACE_OBJS)
if HAVE_DTRACE
if !HOST_MACOS
DTRACE_LIBADD = probes.lo
endif
endif
-5
View File
@@ -21,8 +21,3 @@ AM_CPPFLAGS += \
LDADD += \
$(top_builddir)/tests/libtest/libtest.la \
$(CMOCKA_LIBS)
if HAVE_JEMALLOC
AM_CFLAGS += $(JEMALLOC_CFLAGS)
LDADD += $(JEMALLOC_LIBS)
endif
+14 -22
View File
@@ -15,31 +15,17 @@ AM_LDFLAGS = \
$(STD_LDFLAGS)
LDADD =
BUILT_SOURCES =
CLEANFILES =
if HOST_MACOS
AM_LDFLAGS += \
-Wl,-flat_namespace
endif HOST_MACOS
if HAVE_JEMALLOC
LIBISC_CFLAGS = $(JEMALLOC_CFLAGS)
LIBISC_LIBS = $(JEMALLOC_LIBS)
else
LIBISC_CFLAGS =
LIBISC_LIBS =
endif
LIBISC_CFLAGS += \
LIBISC_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/isc/include \
-I$(top_builddir)/lib/isc/include
LIBISC_LIBS += $(top_builddir)/lib/isc/libisc.la
if HAVE_DTRACE
LIBISC_DTRACE = $(top_builddir)/lib/isc/probes.lo
endif
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
LIBDNS_CFLAGS = \
-I$(top_srcdir)/lib/dns/include \
@@ -47,18 +33,18 @@ LIBDNS_CFLAGS = \
LIBDNS_LIBS = \
$(top_builddir)/lib/dns/libdns.la
if HAVE_DTRACE
LIBDNS_DTRACE = $(top_builddir)/lib/dns/probes.lo
endif
LIBNS_CFLAGS = \
-I$(top_srcdir)/lib/ns/include
LIBNS_LIBS = \
$(top_builddir)/lib/ns/libns.la
if HAVE_DTRACE
LIBNS_DTRACE = $(top_builddir)/lib/ns/probes.lo
endif
LIBIRS_CFLAGS = \
-I$(top_srcdir)/lib/irs/include
LIBIRS_LIBS = \
$(top_builddir)/lib/irs/libirs.la
LIBISCCFG_CFLAGS = \
-I$(top_srcdir)/lib/isccfg/include
@@ -71,3 +57,9 @@ LIBISCCC_CFLAGS = \
LIBISCCC_LIBS = \
$(top_builddir)/lib/isccc/libisccc.la
LIBBIND9_CFLAGS = \
-I$(top_srcdir)/lib/bind9/include
LIBBIND9_LIBS = \
$(top_builddir)/lib/bind9/libbind9.la
+1 -1
View File
@@ -1 +1 @@
doc/arm/changelog.rst
CHANGES
+1
View File
@@ -26,3 +26,4 @@ Some of these settings are:
| `-DISC_MEM_TRACKLINES=0` | Don't track memory allocations by file and line number; this improves performance but makes debugging more difficult |
| `-DNAMED_RUN_PID_DIR=0` | Create default PID files in `${localstatedir}/run` rather than `${localstatedir}/run/named/` |
| `-DNS_CLIENT_DROPPORT=0` | Disable dropping queries from particular well-known ports |
| `-DOPENSSL_API_COMPAT=10100` | Build using the deprecated OpenSSL APIs so that the `engine` API is available when building with OpenSSL 3.0.0 for PKCS#11 support |
+46 -16
View File
@@ -20,6 +20,7 @@ information regarding copyright ownership.
1. [Building BIND](#build)
1. [Automated testing](#testing)
1. [Documentation](#doc)
1. [Change log](#changes)
1. [Acknowledgments](#ack)
### <a name="intro"/> Introduction
@@ -48,7 +49,8 @@ ongoing maintenance and improvement. BIND is open source software
licensed under the terms of the Mozilla Public License, version 2.0.
For a detailed list of changes made throughout the history of BIND 9, see
the [changelog](doc/arm/changelog.rst).
the file [CHANGES](CHANGES). See [below](#changes) for details on the
CHANGES file format.
For up-to-date versions and release notes, see
[https://www.isc.org/download/](https://www.isc.org/download/).
@@ -72,9 +74,17 @@ contents of your configuration file in a non-confidential issue, it is
advisable to obscure key secrets; this can be done automatically by
using `named-checkconf -px`.
For information about ISC's Security Vulnerability Disclosure Policy and
information about reporting potential security issues, please see
`SECURITY.md`.
If you are reporting a bug that is a potential security issue, such as an
assertion failure or other crash in `named`, please do *NOT* use GitLab to
report it. Instead, send mail to
[security-officer@isc.org](mailto:security-officer@isc.org) using our
OpenPGP key to secure your message. (Information about OpenPGP and links
to our key can be found at
[https://www.isc.org/pgpkey](https://www.isc.org/pgpkey).) Please do not
discuss the bug on any public mailing list.
For a general overview of ISC security policies, read the Knowledgebase
article at [https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
Professional support and training for BIND are available from
ISC. Contact us at [https://www.isc.org/contact](https://www.isc.org/contact)
@@ -126,7 +136,7 @@ multiple servers to run locally and communicate with each other). These
IP addresses can be configured by running the command
`bin/tests/system/ifconfig.sh up` as root.
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::IP` modules,
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::INET6` modules,
and are skipped if these are not available. Some tests require Python
and the `dnspython` module and are skipped if these are not available.
See bin/tests/system/README for further details.
@@ -139,18 +149,9 @@ parallel test driver; unit tests are also run by `make check`.
The *BIND 9 Administrator Reference Manual* (ARM) is included with the source
distribution, and in .rst format, in the `doc/arm`
directory. The HTML version is automatically generated and can
directory. HTML and PDF versions are automatically generated and can
be viewed at [https://bind9.readthedocs.io/en/latest/index.html](https://bind9.readthedocs.io/en/latest/index.html).
The PDF version can be built by running:
cd doc/arm/
sphinx-build -b latex . pdf/
make -C pdf/ all-pdf
The above requires TeX Live in order to work. The PDF will be written to
`doc/arm/pdf/Bv9ARM.pdf`.
Man pages for some of the programs in the BIND 9 distribution
are also included in the BIND ARM.
@@ -161,9 +162,38 @@ can be found in the ISC Knowledgebase at
Additional information on various subjects can be found in other
`README` files throughout the source tree.
### <a name="changes"/> Change log
A detailed list of all changes that have been made throughout the
development of BIND 9 is included in the file CHANGES, with the most recent
changes listed first. Change notes include tags indicating the category of
the change that was made; these categories are:
|Category |Description |
|-------------- |-----------------------------------------------|
| [func] | New feature |
| [bug] | General bug fix |
| [security] | Fix for a significant security flaw |
| [experimental] | Used for new features when the syntax or other aspects of the design are still in flux and may change |
| [port] | Portability enhancement |
| [maint] | Updates to built-in data such as root server addresses and keys |
| [tuning] | Changes to built-in configuration defaults and constants to improve performance |
| [performance] | Other changes to improve server performance |
| [protocol] | Updates to the DNS protocol such as new RR types |
| [test] | Changes to the automatic tests, not affecting server functionality |
| [cleanup] | Minor corrections and refactoring |
| [doc] | Documentation |
| [contrib] | Changes to the contributed tools and libraries in the 'contrib' subdirectory |
| [placeholder] | Used in the main development branch to reserve change numbers for use in other branches, e.g., when fixing a bug that only exists in older releases |
In general, [func] and [experimental] tags only appear in new-feature
releases (i.e., those with version numbers ending in zero). Some new
functionality may be backported to older releases on a case-by-case basis.
All other change types may be applied to all currently supported releases.
#### Bug report identifiers
Most notes in the ARM Changelog appendix include a reference to a bug report or
Most notes in the CHANGES file include a reference to a bug report or
issue number. Prior to 2018, these were usually of the form `[RT #NNN]`
and referred to entries in the "bind9-bugs" RT database, which was not open
to the public. More recent entries use the form `[GL #NNN]` or, less often,
-35
View File
@@ -1,35 +0,0 @@
<!--
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
SPDX-License-Identifier: MPL-2.0
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 https://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
-->
# Security Policy
ISC's Security Vulnerability Disclosure Policy is documented in the
relevant [ISC Knowledgebase article][1].
## Reporting possible security issues
If you think you may be seeing a potential security vulnerability in
BIND (for example, a crash with a REQUIRE, INSIST, or ASSERT failure),
please report it immediately by [opening a confidential GitLab issue][2]
(preferred) or emailing bind-security@isc.org.
Please 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.
If you have a crash, you may want to consult the Knowledgebase article
entitled ["What to do if your BIND or DHCP server has crashed"][3].
[1]: https://kb.isc.org/docs/aa-00861
[2]: https://gitlab.isc.org/isc-projects/bind9/-/issues/new?issue[confidential]=true&issuable_template=Bug
[3]: https://kb.isc.org/docs/aa-00340
+4 -2
View File
@@ -4,7 +4,8 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS)
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS)
AM_CPPFLAGS += \
-DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
@@ -20,7 +21,8 @@ LDADD += \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS)
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS)
bin_PROGRAMS = named-checkconf named-checkzone
+108 -164
View File
@@ -14,7 +14,6 @@
/*! \file */
#include <inttypes.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
@@ -22,6 +21,8 @@
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/stdio.h>
@@ -33,6 +34,7 @@
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
@@ -42,6 +44,10 @@
#include <dns/types.h>
#include <dns/zone.h>
#include <isccfg/log.h>
#include <ns/log.h>
#include "check-tool.h"
#ifndef CHECK_SIBLING
@@ -68,7 +74,7 @@
#define ERR_IS_MXCNAME 6
#define ERR_IS_SRVCNAME 7
static const char *dbtype[] = { ZONEDB_DEFAULT };
static const char *dbtype[] = { "rbt" };
int debug = 0;
const char *journal = NULL;
@@ -83,15 +89,21 @@ bool dochecksrv = false;
bool docheckns = false;
#endif /* if CHECK_LOCAL */
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF |
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKINTEGRITY |
#if CHECK_SIBLING
DNS_ZONEOPT_CHECKSIBLING |
#endif /* if CHECK_SIBLING */
DNS_ZONEOPT_CHECKSVCB | DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_CHECKWILDCARD |
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_symtab_t *symtab = NULL;
static isc_mem_t *sym_mctx;
@@ -112,7 +124,11 @@ add(char *key, int value) {
}
if (symtab == NULL) {
isc_symtab_create(sym_mctx, freekey, sym_mctx, false, &symtab);
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
false, &symtab);
if (result != ISC_R_SUCCESS) {
return;
}
}
key = isc_mem_strdup(sym_mctx, key);
@@ -130,92 +146,14 @@ logged(char *key, int value) {
isc_result_t result;
if (symtab == NULL) {
return false;
return (false);
}
result = isc_symtab_lookup(symtab, key, value, NULL);
if (result == ISC_R_SUCCESS) {
return true;
}
return false;
}
static bool
checkisservedby(dns_zone_t *zone, dns_rdatatype_t type,
const dns_name_t *name) {
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE + 1];
/*
* Not all getaddrinfo implementations distinguish NODATA
* from NXDOMAIN with PF_INET6 so use PF_UNSPEC and look at
* the returned ai_family values.
*/
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
bool has_type = false;
int eai;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
*/
if (dns_name_countlabels(name) > 1U) {
strlcat(namebuf, ".", sizeof(namebuf));
}
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
switch (eai) {
case 0:
cur = ai;
while (cur != NULL) {
if (cur->ai_family == AF_INET &&
type == dns_rdatatype_a)
{
has_type = true;
break;
}
if (cur->ai_family == AF_INET6 &&
type == dns_rdatatype_aaaa)
{
has_type = true;
break;
}
cur = cur->ai_next;
}
freeaddrinfo(ai);
return has_type;
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
case EAI_NODATA:
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
case EAI_NONAME:
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
dns_name_format(dns_zone_getorigin(zone), ownerbuf,
sizeof(ownerbuf));
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' (out of zone) "
"has no addresses records (A or AAAA)",
ownerbuf, namebuf);
add(namebuf, ERR_NO_ADDRESSES);
}
return false;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_name_format(dns_zone_getorigin(zone), ownerbuf,
sizeof(ownerbuf));
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(eai));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return true;
return (true);
}
return (false);
}
static bool
@@ -223,14 +161,7 @@ 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 *rdataset;
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_result_t result;
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
struct addrinfo hints, *ai, *cur;
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE];
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
@@ -238,7 +169,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
bool match;
const char *type;
void *ptr = NULL;
int eai;
int result;
REQUIRE(a == NULL || !dns_rdataset_isassociated(a) ||
a->type == dns_rdatatype_a);
@@ -246,9 +177,15 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
aaaa->type == dns_rdatatype_aaaa);
if (a == NULL || aaaa == NULL) {
return answer;
return (answer);
}
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
@@ -258,9 +195,9 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
}
dns_name_format(owner, ownerbuf, sizeof(ownerbuf));
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
result = getaddrinfo(namebuf, NULL, &hints, &ai);
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
switch (eai) {
switch (result) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
@@ -268,8 +205,7 @@ 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 &&
@@ -297,16 +233,16 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0 */
return true;
return (true);
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(eai));
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return true;
return (true);
}
/*
@@ -433,27 +369,25 @@ checkmissing:
add(namebuf, ERR_MISSING_GLUE);
}
}
if (ai != NULL) {
freeaddrinfo(ai);
}
return answer;
freeaddrinfo(ai);
return (answer);
}
static bool
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
struct addrinfo hints, *ai, *cur;
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE];
int eai;
int result;
int level = ISC_LOG_ERROR;
bool answer = true;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
@@ -463,9 +397,9 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
dns_name_format(owner, ownerbuf, sizeof(ownerbuf));
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
result = getaddrinfo(namebuf, NULL, &hints, &ai);
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
switch (eai) {
switch (result) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
@@ -473,8 +407,7 @@ 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 &&
@@ -498,10 +431,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
}
}
if (ai != NULL) {
freeaddrinfo(ai);
}
return answer;
freeaddrinfo(ai);
return (answer);
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
@@ -515,34 +446,34 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
return true;
return (true);
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(eai));
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return true;
return (true);
}
}
static bool
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
struct addrinfo hints, *ai, *cur;
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE];
int eai;
int result;
int level = ISC_LOG_ERROR;
bool answer = true;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
@@ -552,9 +483,9 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
dns_name_format(owner, ownerbuf, sizeof(ownerbuf));
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
result = getaddrinfo(namebuf, NULL, &hints, &ai);
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
switch (eai) {
switch (result) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
@@ -562,8 +493,7 @@ 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 &&
@@ -587,10 +517,8 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
}
}
if (ai != NULL) {
freeaddrinfo(ai);
}
return answer;
freeaddrinfo(ai);
return (answer);
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
@@ -604,28 +532,45 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
return true;
return (true);
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(eai));
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return true;
return (true);
}
}
isc_result_t
setup_logging(FILE *errout) {
isc_logconfig_t *logconfig = isc_logconfig_get();
isc_log_createandusechannel(
logconfig, "default_stderr", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC, ISC_LOGDESTINATION_FILE(errout), 0,
ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_DEFAULT);
setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
isc_log_t *log = NULL;
return ISC_R_SUCCESS;
isc_log_create(mctx, &log, &logconfig);
isc_log_registercategories(log, categories);
isc_log_setcontext(log);
dns_log_init(log);
dns_log_setcontext(log);
cfg_log_init(log);
ns_log_init(log);
destination.file.stream = errout;
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
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);
}
/*% load the zone */
@@ -648,7 +593,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
zonename, filename, classname);
}
dns_zone_create(&zone, mctx, 0);
CHECK(dns_zone_create(&zone, mctx, 0));
dns_zone_settype(zone, dns_zone_primary);
@@ -656,20 +601,20 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_buffer_add(&buffer, strlen(zonename));
origin = dns_fixedname_initname(&fixorigin);
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
dns_zone_setorigin(zone, origin);
CHECK(dns_zone_setorigin(zone, origin));
dns_zone_setdbtype(zone, 1, (const char *const *)dbtype);
if (strcmp(filename, "-") == 0) {
dns_zone_setstream(zone, stdin, fileformat,
&dns_master_style_default);
CHECK(dns_zone_setstream(zone, stdin, fileformat,
&dns_master_style_default));
} else {
dns_zone_setfile(zone, filename, fileformat,
&dns_master_style_default);
CHECK(dns_zone_setfile(zone, filename, fileformat,
&dns_master_style_default));
}
if (journal != NULL) {
dns_zone_setjournal(zone, journal);
CHECK(dns_zone_setjournal(zone, journal));
}
region.base = UNCONST(classname);
DE_CONST(classname, region.base);
region.length = strlen(classname);
CHECK(dns_rdataclass_fromtext(&rdclass, &region));
@@ -684,7 +629,6 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
}
if (docheckns) {
dns_zone_setcheckns(zone, checkns);
dns_zone_setcheckisservedby(zone, checkisservedby);
}
if (dochecksrv) {
dns_zone_setchecksrv(zone, checksrv);
@@ -701,7 +645,7 @@ cleanup:
if (zone != NULL) {
dns_zone_detach(&zone);
}
return result;
return (result);
}
/*% dump the zone */
@@ -732,7 +676,7 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
"could not open output "
"file \"%s\" for writing\n",
filename);
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
}
@@ -742,5 +686,5 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
(void)isc_stdio_close(output);
}
return result;
return (result);
}
+6 -1
View File
@@ -18,6 +18,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <isc/lang.h>
#include <isc/stdio.h>
#include <isc/types.h>
@@ -25,8 +26,10 @@
#include <dns/types.h>
#include <dns/zone.h>
ISC_LANG_BEGINDECLS
isc_result_t
setup_logging(FILE *errout);
setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp);
isc_result_t
load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
@@ -45,3 +48,5 @@ extern bool docheckmx;
extern bool docheckns;
extern bool dochecksrv;
extern dns_zoneopt_t zone_options;
ISC_LANG_ENDDECLS
+74 -100
View File
@@ -24,25 +24,32 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rootns.h>
#include <dns/zone.h>
#include <isccfg/check.h>
#include <isccfg/grammar.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include "check-tool.h"
static const char *program = "named-checkconf";
static bool loadplugins = true;
isc_log_t *logc = NULL;
#define CHECK(r) \
do { \
result = (r); \
@@ -51,16 +58,16 @@ static const char *program = "named-checkconf";
} while (0)
/*% usage */
ISC_NORETURN static void
noreturn static void
usage(void);
static void
usage(void) {
fprintf(stderr,
"usage: %s [-achijlvz] [-p [-x]] [-t directory] "
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n",
program);
exit(EXIT_SUCCESS);
exit(1);
}
/*% directory callback */
@@ -80,13 +87,13 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
directory = cfg_obj_asstring(obj);
result = isc_dir_chdir(directory);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(obj, ISC_LOG_ERROR,
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
"change directory to '%s' failed: %s\n", directory,
isc_result_totext(result));
return result;
return (result);
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static bool
@@ -94,10 +101,10 @@ 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) {
return false;
return (false);
}
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return true;
return (true);
}
}
}
@@ -113,7 +120,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
for (i = 0;; i++) {
if (maps[i] == NULL) {
return false;
return (false);
}
checknames = NULL;
result = cfg_map_get(maps[i], "check-names", &checknames);
@@ -122,7 +129,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
}
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return true;
return (true);
}
for (element = cfg_list_first(checknames); element != NULL;
element = cfg_list_next(element))
@@ -136,7 +143,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
continue;
}
*obj = cfg_tuple_get(value, "mode");
return true;
return (true);
}
}
}
@@ -149,23 +156,23 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
isc_textregion_t r;
if (zfile == NULL) {
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
r.base = UNCONST(zclass);
DE_CONST(zclass, r.base);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
result = dns_rootns_create(mctx, rdclass, zfile, &db);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
dns_db_detach(&db);
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
/*% configure the zone */
@@ -221,33 +228,31 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
}
if (inviewobj != NULL) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
cfg_map_get(zoptions, "type", &typeobj);
if (typeobj == NULL) {
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
if (list) {
const char *ztype = cfg_obj_asstring(typeobj);
printf("%s %s %s %s\n", zname, zclass, view, ztype);
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
/*
* Skip checks when using an alternate data source.
*/
cfg_map_get(zoptions, "database", &dbobj);
if (dbobj != NULL &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
{
return ISC_R_SUCCESS;
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0) {
return (ISC_R_SUCCESS);
}
cfg_map_get(zoptions, "dlz", &dlzobj);
if (dlzobj != NULL) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
cfg_map_get(zoptions, "file", &fileobj);
@@ -261,12 +266,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
* master and redirect
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0) {
return configure_hint(zfile, zclass, mctx);
return (configure_hint(zfile, zclass, mctx));
} else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
{
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
/*
@@ -279,12 +284,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
}
if (primariesobj != NULL) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
}
if (zfile == NULL) {
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
obj = NULL;
@@ -396,28 +401,6 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options |= DNS_ZONEOPT_CHECKSPF;
}
obj = NULL;
if (get_maps(maps, "check-svcb", &obj)) {
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
} else {
zone_options &= ~DNS_ZONEOPT_CHECKSVCB;
}
} else {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
}
obj = NULL;
if (get_maps(maps, "check-wildcard", &obj)) {
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
} else {
zone_options &= ~DNS_ZONEOPT_CHECKWILDCARD;
}
} else {
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
}
obj = NULL;
if (get_checknames(maps, &obj)) {
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
@@ -462,7 +445,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
isc_result_totext(result));
}
return result;
return (result);
}
/*% configure a view */
@@ -497,7 +480,7 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
result = tresult;
}
}
return result;
return (result);
}
static isc_result_t
@@ -507,11 +490,11 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
if (!cfg_obj_isstring(classobj)) {
*classp = defclass;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
r.base = UNCONST(cfg_obj_asstring(classobj));
DE_CONST(cfg_obj_asstring(classobj), r.base);
r.length = strlen(r.base);
return dns_rdataclass_fromtext(classp, &r);
return (dns_rdataclass_fromtext(classp, &r));
}
/*% load zones from the configuration */
@@ -569,15 +552,15 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
}
cleanup:
return result;
return (result);
}
static void
output(void *closure, const char *text, int textlen) {
UNUSED(closure);
if (fwrite(text, 1, textlen, stdout) != (size_t)textlen) {
isc_result_t *result = closure;
perror("fwrite");
*result = ISC_R_FAILURE;
exit(1);
}
}
@@ -589,21 +572,20 @@ main(int argc, char **argv) {
cfg_obj_t *config = NULL;
const char *conffile = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result = ISC_R_SUCCESS;
isc_result_t result;
int exit_status = 0;
bool load_zones = false;
bool list_zones = false;
bool print = false;
bool nodeprecate = false;
bool allconfigs = false;
unsigned int flags = 0;
unsigned int checkflags = BIND_CHECK_PLUGINS | BIND_CHECK_ALGORITHMS;
isc_commandline_errprint = false;
/*
* Process memory debugging argument first.
*/
#define CMDLINE_FLAGS "acdhijlm:nt:pvxz"
#define CMDLINE_FLAGS "cdhijlm:t:pvxz"
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (c) {
case 'm':
@@ -630,12 +612,8 @@ main(int argc, char **argv) {
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != EOF) {
switch (c) {
case 'a':
checkflags &= ~BIND_CHECK_ALGORITHMS;
break;
case 'c':
checkflags &= ~BIND_CHECK_PLUGINS;
loadplugins = false;
break;
case 'd':
@@ -657,16 +635,12 @@ main(int argc, char **argv) {
case 'm':
break;
case 'n':
allconfigs = true;
break;
case 't':
result = isc_dir_chroot(isc_commandline_argument);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chroot: %s\n",
isc_result_totext(result));
CHECK(result);
exit(1);
}
break;
@@ -676,8 +650,7 @@ main(int argc, char **argv) {
case 'v':
printf("%s\n", PACKAGE_VERSION);
result = ISC_R_SUCCESS;
goto cleanup;
exit(0);
case 'x':
flags |= CFG_PRINTER_XKEY;
@@ -697,27 +670,25 @@ main(int argc, char **argv) {
}
FALLTHROUGH;
case 'h':
isc_mem_detach(&mctx);
usage();
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
CHECK(ISC_R_FAILURE);
exit(1);
}
}
if (((flags & CFG_PRINTER_XKEY) != 0) && !print) {
fprintf(stderr, "%s: -x cannot be used without -p\n", program);
CHECK(ISC_R_FAILURE);
exit(1);
}
if (print && list_zones) {
fprintf(stderr, "%s: -l cannot be used with -p\n", program);
CHECK(ISC_R_FAILURE);
exit(1);
}
if (isc_commandline_index + 1 < argc) {
isc_mem_detach(&mctx);
usage();
}
if (argv[isc_commandline_index] != NULL) {
@@ -727,40 +698,43 @@ main(int argc, char **argv) {
conffile = NAMED_CONFFILE;
}
CHECK(setup_logging(stdout));
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
CHECK(cfg_parser_create(mctx, &parser));
RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS);
if (nodeprecate) {
cfg_parser_setflags(parser, CFG_PCTX_NODEPRECATED, true);
}
if (allconfigs) {
cfg_parser_setflags(parser, CFG_PCTX_ALLCONFIGS, true);
}
cfg_parser_setcallback(parser, directory_callback, NULL);
CHECK(cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config));
CHECK(isccfg_check_namedconf(config, checkflags, mctx));
if (load_zones || list_zones) {
CHECK(load_zones_fromconfig(config, mctx, list_zones));
if (cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config) !=
ISC_R_SUCCESS)
{
exit(1);
}
if (print) {
cfg_printx(config, flags, output, &result);
result = bind9_check_namedconf(config, loadplugins, logc, mctx);
if (result != ISC_R_SUCCESS) {
exit_status = 1;
}
cleanup:
if (config != NULL) {
cfg_obj_destroy(parser, &config);
if (result == ISC_R_SUCCESS && (load_zones || list_zones)) {
result = load_zones_fromconfig(config, mctx, list_zones);
if (result != ISC_R_SUCCESS) {
exit_status = 1;
}
}
if (parser != NULL) {
cfg_parser_destroy(&parser);
if (print && exit_status == 0) {
cfg_printx(config, flags, output, NULL);
}
cfg_obj_destroy(parser, &config);
if (mctx != NULL) {
isc_mem_destroy(&mctx);
}
cfg_parser_destroy(&parser);
return result == ISC_R_SUCCESS ? 0 : 1;
isc_log_destroy(&logc);
isc_mem_destroy(&mctx);
return (exit_status);
}
+5 -19
View File
@@ -21,7 +21,7 @@ named-checkconf - named configuration file syntax checking tool
Synopsis
~~~~~~~~
:program:`named-checkconf` [**-achjlnvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
:program:`named-checkconf` [**-chjlvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
Description
~~~~~~~~~~~
@@ -32,22 +32,14 @@ errors. If no file is specified,
|named_conf| is read by default.
Note: files that :iscman:`named` reads in separate parser contexts, such as
``rndc.conf`` or ``rndc.key``, are not automatically read by
:program:`named-checkconf`. Configuration errors in these files may cause
:iscman:`named` to fail to run, even if :program:`named-checkconf` was
successful. However, :program:`named-checkconf` can be run on these files
explicitly.
``rndc.key`` and ``bind.keys``, are not automatically read by
:program:`named-checkconf`. Configuration errors in these files may cause
:iscman:`named` to fail to run, even if :program:`named-checkconf` was successful.
However, :program:`named-checkconf` can be run on these files explicitly.
Options
~~~~~~~
.. option:: -a
Don't check the `dnssec-policy`'s DNSSEC key algorithms against
those supported by the crypto provider. This is useful when checking
a `named.conf` intended to be run on another machine with possibly a
different set of supported DNSSEC key algorithms.
.. option:: -h
This option prints the usage summary and exits.
@@ -71,12 +63,6 @@ Options
This option ignores warnings on deprecated options.
.. option:: -n
Do not print errors when encountering options that are disabled in
this build. This allows checking of configuration files for other
builds, in which those options are enabled.
.. option:: -p
This option prints out the :iscman:`named.conf` and included files in canonical form if
+42 -57
View File
@@ -24,13 +24,16 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/name.h>
@@ -61,7 +64,7 @@ static enum { progmode_check, progmode_compile } progmode;
} \
} while (0)
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -78,7 +81,7 @@ usage(void) {
"%s zonename [ (filename|-) ]\n",
prog_name,
progmode == progmode_check ? "[-o filename]" : "-o filename");
exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -94,6 +97,7 @@ main(int argc, char **argv) {
int c;
char *origin = NULL;
const char *filename = NULL;
isc_log_t *lctx = NULL;
isc_result_t result;
char classname_in[] = "IN";
char *classname = classname_in;
@@ -145,12 +149,15 @@ main(int argc, char **argv) {
UNREACHABLE();
}
/* When compiling, disable checks by default */
/* Compilation specific defaults */
if (progmode == progmode_compile) {
zone_options = 0;
docheckmx = false;
docheckns = false;
dochecksrv = false;
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);
}
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
@@ -158,8 +165,8 @@ main(int argc, char **argv) {
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:C:"
"DF:M:R: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':
@@ -204,7 +211,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -i: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -238,7 +245,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -k: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -249,7 +256,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "source serial number "
"must be numeric");
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -260,7 +267,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "maximum TTL "
"must be numeric");
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -277,7 +284,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -n: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -294,7 +301,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -m: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -319,19 +326,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -r: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
}
break;
case 'R':
if (ARGCMP("fail")) {
zone_options |= DNS_ZONEOPT_LOGREPORTS;
} else if (ARGCMP("ignore")) {
zone_options &= ~DNS_ZONEOPT_LOGREPORTS;
} else {
fprintf(stderr, "invalid argument to -R: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -344,7 +339,7 @@ main(int argc, char **argv) {
fprintf(stderr,
"unknown or unsupported style: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -354,30 +349,18 @@ main(int argc, char **argv) {
fprintf(stderr, "isc_dir_chroot: %s: %s\n",
isc_commandline_argument,
isc_result_totext(result));
exit(EXIT_FAILURE);
exit(1);
}
break;
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(EXIT_SUCCESS);
exit(0);
case 'w':
workdir = isc_commandline_argument;
break;
case 'C':
if (ARGCMP("check-svcb:fail")) {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
} else if (ARGCMP("check-svcb:ignore")) {
zone_options &= ~DNS_ZONEOPT_CHECKSVCB;
} else {
fprintf(stderr, "invalid argument to -C: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
}
break;
case 'D':
dumpzone++;
break;
@@ -395,7 +378,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -M: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -412,7 +395,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -S: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -424,7 +407,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -T: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -448,7 +431,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -457,7 +440,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
isc_result_totext(result));
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -473,7 +456,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "unknown file format: %s\n",
inputformatstr);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -488,15 +471,14 @@ main(int argc, char **argv) {
outputformat = dns_masterformat_raw;
rawversion = strtol(outputformatstr + 4, &end, 10);
if (end == outputformatstr + 4 || *end != '\0' ||
rawversion > 1U)
{
rawversion > 1U) {
fprintf(stderr, "unknown raw format version\n");
exit(EXIT_FAILURE);
exit(1);
}
} else {
fprintf(stderr, "unknown file format: %s\n",
outputformatstr);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -528,14 +510,14 @@ main(int argc, char **argv) {
}
if (argc - isc_commandline_index < 1 ||
argc - isc_commandline_index > 2)
{
argc - isc_commandline_index > 2) {
usage();
}
isc_mem_create(&mctx);
if (!quiet) {
RUNTIME_CHECK(setup_logging(errout) == ISC_R_SUCCESS);
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) ==
ISC_R_SUCCESS);
}
origin = argv[isc_commandline_index++];
@@ -575,7 +557,10 @@ main(int argc, char **argv) {
fprintf(errout, "OK\n");
}
destroy();
if (lctx != NULL) {
isc_log_destroy(&lctx);
}
isc_mem_destroy(&mctx);
return (result == ISC_R_SUCCESS) ? 0 : 1;
return ((result == ISC_R_SUCCESS) ? 0 : 1);
}
+1 -20
View File
@@ -23,7 +23,7 @@ named-checkzone - zone file validation tool
Synopsis
~~~~~~~~
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-R** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
: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}
Description
~~~~~~~~~~~
@@ -68,15 +68,6 @@ Options
This option specifies the class of the zone. If not specified, ``IN`` is assumed.
.. option:: -C mode
This option controls check mode on zone files when loading.
Possible modes are ``check-svcb:fail`` and ``check-svcb:ignore``.
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:fail``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
@@ -91,13 +82,9 @@ Options
(both in-zone and out-of-zone hostnames). Mode ``local`` only
checks SRV records which refer to in-zone hostnames.
Mode ``full`` checks that a zone that has A or AAAA records it is served
by a server with the same type of address records.
Mode ``full`` checks that delegation NS records refer to A or AAAA
records (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 verifies that some required glue exists, i.e., when the
name server is in a child zone.
@@ -170,12 +157,6 @@ Options
semantically equal in plain DNS. Possible modes are ``fail``,
``warn`` (the default), and ``ignore``.
.. option:: -R mode
This option checks whether a TXT wildcard record exists that
matches the name format for RFC 9567 error-reporting queries: ``*._er``.
Possible modes are ``fail`` and ``ignore`` (the default).
.. option:: -s style
This option specifies the style of the dumped zone file. Possible styles are
+18 -39
View File
@@ -23,23 +23,17 @@ named-compilezone - zone file converting tool
Synopsis
~~~~~~~~
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-R** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
:program:`named-compilezone` [**-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] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
Description
~~~~~~~~~~~
:program:`named-compilezone` checks the syntax and integrity of a zone file,
and dumps the zone contents to a specified file in a specified format.
Unlike :program:`named-checkzone`, zone contents are not strictly checked
by default. If the output is to be used as an actual zone file to be loaded
by :iscman:`named`, then the check levels should be manually configured to
be at least as strict as those specified in the :iscman:`named` configuration
file.
Running :program:`named-checkzone` on the input prior to compiling will
ensure that the zone compiles with the default requirements of
:iscman:`named`.
It applies strict check levels by default, since the
dump output is used as an actual zone file loaded by :iscman:`named`.
When manually specified otherwise, the check levels must at least be as
strict as those specified in the :iscman:`named` configuration file.
Options
~~~~~~~
@@ -76,20 +70,11 @@ Options
This option specifies the class of the zone. If not specified, ``IN`` is assumed.
.. option:: -C mode
This option controls check mode on zone files when loading.
Possible modes are ``check-svcb:fail`` and ``check-svcb:ignore``.
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:ignore``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
``full``, ``full-sibling``, ``local``,
``local-sibling``, and ``none`` (the default).
``full`` (the default), ``full-sibling``, ``local``,
``local-sibling``, and ``none``.
Mode ``full`` checks that MX records refer to A or AAAA records
(both in-zone and out-of-zone hostnames). Mode ``local`` only
@@ -133,7 +118,7 @@ Options
.. option:: -k mode
This option performs ``check-names`` checks with the specified failure mode.
Possible modes are ``fail``, ``warn``, and ``ignore`` (the default).
Possible modes are ``fail`` (the default), ``warn``, and ``ignore``.
.. option:: -l ttl
@@ -150,19 +135,19 @@ Options
.. option:: -m mode
This option specifies whether MX records should be checked to see if they are
addresses. Possible modes are ``fail``, ``warn``, and
``ignore`` (the default).
addresses. Possible modes are ``fail``, ``warn`` (the default), and
``ignore``.
.. option:: -M mode
This option checks whether a MX record refers to a CNAME. Possible modes are
``fail``, ``warn``, and ``ignore`` (the default).
``fail``, ``warn`` (the default), and ``ignore``.
.. option:: -n mode
This option specifies whether NS records should be checked to see if they are
addresses. Possible modes are ``fail``, ``warn``, and
``ignore`` (the default).
addresses. Possible modes are ``fail`` (the default), ``warn``, and
``ignore``.
.. option:: -o filename
@@ -173,13 +158,7 @@ Options
This option checks for records that are treated as different by DNSSEC but are
semantically equal in plain DNS. Possible modes are ``fail``,
``warn``, and ``ignore`` (the default).
.. option:: -R mode
This option checks whether a TXT wildcard record exists that
matches the name format for RFC 9567 error-reporting queries: ``*._er``.
Possible modes are ``fail`` and ``ignore`` (the default).
``warn`` (the default), and ``ignore``.
.. option:: -s style
@@ -192,7 +171,7 @@ Options
.. option:: -S mode
This option checks whether an SRV record refers to a CNAME. Possible modes are
``fail``, ``warn``, and ``ignore`` (the default).
``fail``, ``warn`` (the default), and ``ignore``.
.. option:: -t directory
@@ -204,7 +183,7 @@ Options
This option checks whether Sender Policy Framework (SPF) records exist and issues a
warning if an SPF-formatted TXT record is not also present. Possible
modes are ``warn`` and ``ignore`` (the default).
modes are ``warn`` (the default) and ``ignore``.
.. option:: -w directory
@@ -222,7 +201,7 @@ Options
This option specifies 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:`4592`). Possible modes are ``warn``
and ``ignore`` (the default).
(the default) and ``ignore``.
.. option:: zonename
@@ -241,5 +220,5 @@ and 0 otherwise.
See Also
~~~~~~~~
:iscman:`named(8) <named>`, :iscman:`named-checkconf(8) <named-checkconf>`, :iscman:`named-checkzone(8) <named-checkzone>`, :rfc:`1035`,
:iscman:`named(8) <named>`, :iscman:`named-checkconf(8) <named-checkconf>`, :iscman:`named-checkzone(8) <named-checkzone>`, `:rfc:`1035`,
BIND 9 Administrator Reference Manual.
+6
View File
@@ -17,6 +17,10 @@
#include <stdio.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
int
set_user(FILE *fd, const char *user);
/*%<
@@ -25,3 +29,5 @@ set_user(FILE *fd, const char *user);
* 0 success
* -1 insufficient permissions, or 'user' does not exist.
*/
ISC_LANG_ENDDECLS
+21 -16
View File
@@ -21,6 +21,7 @@
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -44,24 +45,24 @@ alg_fromtext(const char *name) {
}
if (strcasecmp(p, "md5") == 0) {
return DST_ALG_HMACMD5;
return (DST_ALG_HMACMD5);
}
if (strcasecmp(p, "sha1") == 0) {
return DST_ALG_HMACSHA1;
return (DST_ALG_HMACSHA1);
}
if (strcasecmp(p, "sha224") == 0) {
return DST_ALG_HMACSHA224;
return (DST_ALG_HMACSHA224);
}
if (strcasecmp(p, "sha256") == 0) {
return DST_ALG_HMACSHA256;
return (DST_ALG_HMACSHA256);
}
if (strcasecmp(p, "sha384") == 0) {
return DST_ALG_HMACSHA384;
return (DST_ALG_HMACSHA384);
}
if (strcasecmp(p, "sha512") == 0) {
return DST_ALG_HMACSHA512;
return (DST_ALG_HMACSHA512);
}
return DST_ALG_UNKNOWN;
return (DST_ALG_UNKNOWN);
}
/*%
@@ -71,19 +72,19 @@ int
alg_bits(dns_secalg_t alg) {
switch (alg) {
case DST_ALG_HMACMD5:
return 128;
return (128);
case DST_ALG_HMACSHA1:
return 160;
return (160);
case DST_ALG_HMACSHA224:
return 224;
return (224);
case DST_ALG_HMACSHA256:
return 256;
return (256);
case DST_ALG_HMACSHA384:
return 384;
return (384);
case DST_ALG_HMACSHA512:
return 512;
return (512);
default:
return 0;
return (0);
}
}
@@ -120,9 +121,11 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
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, NULL, mctx, &key, NULL));
dns_rdataclass_in, mctx, &key, NULL));
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
@@ -130,12 +133,14 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
isc_buffer_usedregion(&key_rawbuffer, &key_rawregion);
DO("base64 encode secret",
DO("bsse64 encode secret",
isc_base64_totext(&key_rawregion, -1, "", key_txtbuffer));
if (key != NULL) {
dst_key_free(&key);
}
dst_lib_destroy();
}
/*%
+5
View File
@@ -16,10 +16,13 @@
/*! \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);
@@ -34,3 +37,5 @@ dns_secalg_t
alg_fromtext(const char *name);
int
alg_bits(dns_secalg_t alg);
ISC_LANG_ENDDECLS
+2 -2
View File
@@ -30,7 +30,7 @@ set_user(FILE *fd, const char *user) {
pw = getpwnam(user);
if (pw == NULL) {
errno = EINVAL;
return -1;
return (-1);
}
return fchown(fileno(fd), pw->pw_uid, -1);
return (fchown(fileno(fd), pw->pw_uid, -1));
}
+8 -8
View File
@@ -34,6 +34,7 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -60,7 +61,7 @@ bool verbose = false;
const char *keyfile, *keydef;
ISC_NORETURN static void
noreturn static void
usage(int status);
static void
@@ -146,8 +147,7 @@ main(int argc, char **argv) {
keyfile = isc_commandline_argument;
break;
case 'h':
usage(EXIT_SUCCESS);
break;
usage(0);
case 'k':
case 'y': /* Compatible with rndc -y. */
keyname = isc_commandline_argument;
@@ -193,15 +193,15 @@ main(int argc, char **argv) {
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(EXIT_FAILURE);
usage(1);
} else {
usage(EXIT_SUCCESS);
usage(0);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -210,7 +210,7 @@ main(int argc, char **argv) {
POST(argv);
if (argc > 0) {
usage(EXIT_FAILURE);
usage(1);
}
if (alg == DST_ALG_HMACMD5) {
@@ -290,5 +290,5 @@ options {\n\
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+14 -14
View File
@@ -30,6 +30,7 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -53,7 +54,7 @@ const char *progname;
static enum { progmode_keygen, progmode_confgen } progmode;
bool verbose = false; /* needed by util.c but not used here */
ISC_NORETURN static void
noreturn static void
usage(int status);
static void
@@ -126,8 +127,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
while ((ch = isc_commandline_parse(argc, argv, "a:hk:Mmr:qs:y:z:")) !=
-1)
{
-1) {
switch (ch) {
case 'a':
algname = isc_commandline_argument;
@@ -138,13 +138,13 @@ main(int argc, char **argv) {
keysize = alg_bits(alg);
break;
case 'h':
usage(EXIT_SUCCESS);
usage(0);
case 'k':
case 'y':
if (progmode == progmode_confgen) {
keyname = isc_commandline_argument;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case 'M':
@@ -157,7 +157,7 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
quiet = true;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case 'r':
@@ -167,29 +167,29 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
self_domain = isc_commandline_argument;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case 'z':
if (progmode == progmode_confgen) {
zone = isc_commandline_argument;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(EXIT_FAILURE);
usage(1);
} else {
usage(EXIT_SUCCESS);
usage(0);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -200,11 +200,11 @@ main(int argc, char **argv) {
POST(argv);
if (self_domain != NULL && zone != NULL) {
usage(EXIT_FAILURE); /* -s and -z cannot coexist */
usage(1); /* -s and -z cannot coexist */
}
if (argc > isc_commandline_index) {
usage(EXIT_FAILURE);
usage(1);
}
/* Use canonical algorithm name */
@@ -296,5 +296,5 @@ nsupdate -k <keyfile>\n");
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+3 -4
View File
@@ -27,10 +27,9 @@ Synopsis
Description
~~~~~~~~~~~
:program:`tsig-keygen` is an utility that generates keys for use with TSIG
(Transaction Signatures) as defined in :rfc:`2845`. The resulting keys can be used,
for example, to secure dynamic DNS updates to a zone, or for the :iscman:`rndc`
command channel.
:program:`tsig-keygen` is an 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 :iscman:`rndc` command channel.
A domain name can be specified on the command line to be used as the name
of the generated key. If no name is specified, the default is ``tsig-key``.
+3 -5
View File
@@ -13,15 +13,13 @@
/*! \file */
#include "util.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/tls.h>
#include "util.h"
#include <isc/print.h>
extern bool verbose;
extern const char *progname;
@@ -47,5 +45,5 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
_exit(EXIT_FAILURE);
exit(1);
}
+6 -1
View File
@@ -17,6 +17,7 @@
#include <isc/attributes.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#define NS_CONTROL_PORT 953
@@ -30,8 +31,12 @@
notify("%s", name); \
} while (0)
ISC_LANG_BEGINDECLS
void
notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_NORETURN void
noreturn void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_LANG_ENDDECLS
+2 -5
View File
@@ -4,9 +4,8 @@ AM_CPPFLAGS += \
-I$(top_builddir)/include \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(OPENSSL_CFLAGS)
$(LIBIRS_CFLAGS)
AM_CPPFLAGS += \
-DSYSCONFDIR=\"${sysconfdir}\"
@@ -15,10 +14,8 @@ bin_PROGRAMS = delv
delv_SOURCES = \
delv.c
delv_LDADD = \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS)
$(LIBIRS_LIBS)
+256 -705
View File
File diff suppressed because it is too large Load Diff
+23 -85
View File
@@ -21,7 +21,7 @@ delv - DNS lookup and validation utility
Synopsis
~~~~~~~~
:program:`delv` [@server] [ [**-4**] | [**-6**] ] [**-a** anchor-file] [**-b** address] [**-c** class] [**-d** level] [**-F**] [**-i**] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-x** addr] [name] [type] [class] [queryopt...]
: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**]
@@ -102,21 +102,20 @@ Options
.. option:: -a anchor-file
This option specifies a file from which to read an alternate
DNSSEC root zone trust anchor.
This option specifies a file from which to read DNSSEC trust anchors. The default
is |bind_keys|, which is included with BIND 9 and contains one
or more trust anchors for the root zone (".").
By default, keys that do not match the root zone name (`.`) are
ignored. If an alternate key name is desired, it can be
specified using the :option:`+root` option.
Keys that do not match the root zone name are ignored. An alternate
key name can be specified using the :option:`+root` option.
Note: When reading trust anchors, :program:`delv` treats
``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. :program:`delv` does not
consult the managed-keys database maintained by :iscman:`named`. This
means that if the default key built in to :program:`delv` is revoked,
:program:`delv` must be updated to a newer version in order to continue
validating.
Note: When reading the trust anchor file, :program:`delv` treats ``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. :program:`delv` does not consult the managed-keys database maintained by
:iscman:`named`, which means that if either of the keys in |bind_keys| is
revoked and rolled over, |bind_keys| must be updated to
use DNSSEC validation in :program:`delv`.
.. option:: -b address
@@ -138,10 +137,6 @@ Options
:option:`+mtrace`, :option:`+rtrace`, and :option:`+vtrace` options below for
additional debugging details.
.. option:: -F
This option enables FIPS mode if supported by the cryptographic library in use.
.. option:: -h
This option displays the :program:`delv` help usage output and exits.
@@ -234,36 +229,6 @@ assign values to options like the timeout interval. They have the form
This option controls whether to display the CLASS when printing a record. The
default is to display the CLASS.
.. option:: +hint=FILE, +nohint
This option specifies a filename from which to load root hints;
this will be used to find the root name servers when name server
mode (``delv +ns``) is in use. If the option is not specified,
built-in root hints will be used.
.. option:: +ns, +nons
This option toggles name server mode. When this option is in use,
the ``delv`` process instantiates a full recursive resolver, and uses
that to look up the requested query name and type. Turning on this
option also activates ``+mtrace``, ``+strace`` and ``+rtrace``, so that
every iterative query will be logged, including the full response messages
from each authoritatve server. These logged messages will be written
to ``stdout`` rather than ``stderr`` as usual, so that the full trace
can be captured more easily.
This is intended to be similar to the behavior of ``dig +trace``, but
because it uses the same code as ``named``, it much more accurately
replicates the behavior of a recursive name server with a cold cache
that is processing a recursive query.
.. option:: +qmin[=MODE], +noqmin
When used with ``+ns``, this option enables QNAME minimization mode.
Valid options of MODE are ``relaxed`` and ``strict``. By default,
QNAME minimization is disabled. If ``+qmin`` is specified but MODE
is omitted, then ``relaxed`` mode will be used.
.. option:: +ttl, +nottl
This option controls whether to display the TTL when printing a record. The
@@ -271,11 +236,11 @@ assign values to options like the timeout interval. They have the form
.. option:: +rtrace, +nortrace
This option toggles resolver fetch logging. This reports the name and
type of each query sent by :program:`delv` in the process of carrying
out the resolution and validation process, including the original query
and all subsequent queries to follow CNAMEs and to establish a chain of
trust for DNSSEC validation.
This option toggles resolver fetch logging. This reports the name and type of each
query sent by :program:`delv` in the process of carrying out the resolution
and validation process, 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
@@ -284,27 +249,15 @@ assign values to options like the timeout interval. They have the form
.. option:: +mtrace, +nomtrace
This option toggles logging of messages received. This produces
a detailed dump of the responses received by :program:`delv` in the
process of carrying out the resolution and validation process.
This option toggles message logging. This produces a detailed dump of the
responses received by :program:`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 :option:`-d` option produces the same
output, but affects other logging categories as well.
.. option:: +strace, +nostrace
This option toggles logging of messages sent. This produces a detailed
dump of the queries sent by :program:`delv` in the process of carrying
out the resolution and validation process. Turning on this option
also activates ``+mtrace``.
This is equivalent to setting the debug level to 11 for the "packets"
module of the "resolver" logging category. Setting the systemwide
debug level to 11 using the :option:`-d` option produces the same
output, but affects other logging categories as well.
.. option:: +vtrace, +novtrace
This option toggles validation logging. This shows the internal process of the
@@ -341,23 +294,6 @@ assign values to options like the timeout interval. They have the form
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 ]``.
.. option:: +restarts
When name server mode (``delv +ns``) is in use, this option sets the
maximum number of CNAME queries to follow before terminating resolution.
This prevents ``delv`` from hanging in the event of a CNAME loop.
The default is 11.
.. option:: +maxqueries
This option specifies the maximum number of queries to send to resolve
a name before giving up. The default is 50.
.. option:: +maxtotalqueries
This option specifies the maximum number of queries to send to resolve
a client request before giving up. The default is 200.
.. option:: +trust, +notrust
This option controls whether to display the trust level when printing a record.
@@ -418,6 +354,8 @@ assign values to options like the timeout interval. They have the form
Files
~~~~~
|bind_keys|
``/etc/resolv.conf``
See Also
+5 -4
View File
@@ -4,17 +4,18 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(LIBIDN2_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(LIBUV_CFLAGS) \
$(OPENSSL_CFLAGS)
$(LIBUV_CFLAGS)
LDADD += \
libdighost.la \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS) \
$(LIBIRS_LIBS) \
$(LIBBIND9_LIBS) \
$(LIBIDN2_LIBS)
noinst_LTLIBRARIES = libdighost.la
+129 -539
View File
File diff suppressed because it is too large Load Diff
+35 -68
View File
@@ -20,7 +20,7 @@ dig - DNS lookup utility
Synopsis
~~~~~~~~
:program:`dig` [@server] [**-b** address] [**-c** class] [**-f** filename] [**-F**] [**-k** filename] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-v**] [**-x** addr] [**-y** [hmac:]name:key] [ [**-4**] | [**-6**] ] [name] [type] [class] [queryopt...]
: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**]
@@ -126,10 +126,6 @@ Options
same way it would be presented as a query to :program:`dig` using the
command-line interface.
.. option:: -F
This option enables FIPS mode if supported by the cryptographic library in use.
.. option:: -h
Print a usage summary.
@@ -351,6 +347,12 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
enables search list processing as if the :option:`+search` option were
given.
.. option:: +dscp=value
This option sets 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.
.. option:: +edns[=#], +noedns
This option specifies the EDNS version to query with. Valid values are 0 to 255.
@@ -511,44 +513,6 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
mandatory. Responses to padded queries may also be padded, but only
if the query uses TCP or DNS COOKIE.
.. option:: +proxy[=src_addr[#src_port]-dst_addr[#dst_port]], +noproxy
When this option is set, :program:`dig` adds PROXYv2 headers to the
queries. When source and destination addresses are specified, the
headers contain them and use the ``PROXY`` command. It means for
the remote peer that the queries were sent on behalf of another
node and that the PROXYv2 header reflects the original connection
endpoints. The default source port is ``0`` and destination port is
`53`.
For encrypted DNS transports, to prevent accidental information
leakage, encryption is applied to the PROXYv2 headers: the headers
are sent right after the handshake process has been completed.
For plain DNS transports, no encryption is applied to the PROXYv2
headers.
If the addressees are omitted, PROXYv2 headers, that use the
``LOCAL`` command set, are added instead. For the remote peer, that
means that the queries were sent on purpose without being relayed,
so the real connection endpoint addresses must be used.
.. option:: +proxy-plain[=src_addr[#src_port]-dst_addr[#dst_port], +noproxy-plain
The same as ``+[no]proxy``, but instructs ``dig`` to send PROXYv2
headers ahead of any encryption, before any handshake messages are
sent. That makes :program:`dig` behave exactly how it is described
in the PROXY protocol specification, but not all software expects
such behaviour.
Please consult the software documentation to find out if you need
this option. (for example, ``dnsdist`` expects encrypted PROXYv2
headers sent over TLS when encryption is used, while ``HAProxy``
and many other software packages expect plain ones).
For plain DNS transports the option is effectively an alias for the
``+[no]proxy`` described above.
.. option:: +qid=value
This option specifies the query ID to use when sending queries.
@@ -618,6 +582,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
This option performs [or does not perform] a search showing intermediate results.
.. option:: +sigchase, +nosigchase
This feature is now obsolete and has been removed; use :iscman:`delv`
instead.
.. option:: +split=W
This option splits long hex- or base64-formatted fields in resource records into
@@ -642,14 +611,6 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
prefix-length of zero, which signals a resolver that the client's
address information must *not* be used when resolving this query.
.. option:: +svcparamkeycompat, +nosvcparamkeycompat
This option sets [or does not set] the backward-compatible representation of
the Service Parameter Keys (SvcParamKeys) for SVCB records, in which case
the keys, which were not defined initially in :rfc:`9460` are represented
in their opaque "keyN"-like format, where "N" is their numerical value. The
default is ``+nosvcparamkeycompat``.
.. option:: +tcflag, +notcflag
This option sets [or does not set] the TC (TrunCation) bit in the query. The default is
@@ -657,11 +618,10 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
.. option:: +tcp, +notcp
This option indicates whether to 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. To prevent retry over TCP when
TC=1 is returned from a UDP query, use ``+ignore``.
This option indicates whether to 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.
.. option:: +timeout=T
@@ -695,23 +655,25 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
server TLS certificate verification. Otherwise, the DNS server name
is used. This option has no effect if :option:`+tls-ca` is not specified.
.. option:: +topdown, +notopdown
This feature is related to :option:`dig +sigchase`, which is obsolete and
has been removed. Use :iscman:`delv` instead.
.. option:: +trace, +notrace
This option toggles 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, :program:`dig` makes iterative queries to
resolve the name being looked up. It follows referrals from the root
servers, showing the answer from each server that was used to resolve
the lookup.
This option toggles 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, :program:`dig` makes iterative queries to resolve the
name being looked up. It follows 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.
:option:`+dnssec` is set when :option:`+trace` is set, to better
emulate the default queries from a name server.
Note that the ``delv +ns`` option can also be used for tracing the
resolution of a name from the root (see :iscman:`delv`).
:option:`+dnssec` is also set when :option:`+trace` is set, to better emulate the
default queries from a name server.
.. option:: +tries=T
@@ -719,6 +681,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
instead of the default, 3. If ``T`` is less than or equal to zero,
the number of tries is silently rounded up to 1.
.. option:: +trusted-key=####
This option formerly specified trusted keys for use with :option:`dig +sigchase`. This
feature is now obsolete and has been removed; use :iscman:`delv` instead.
.. option:: +ttlid, +nottlid
This option displays [or does not display] the TTL when printing the record.
@@ -780,7 +747,7 @@ shows how :program:`dig` can 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
:option:`+qr` is applied, so that :program:`dig` shows the initial query it made for
each lookup. The final query has a local query option of :option:`+noqr` which
each lookup. The final query has a local query option of :option:`+qr` which
means that :program:`dig` does not print the initial query when it looks up the
NS records for ``isc.org``.
+254 -311
View File
File diff suppressed because it is too large Load Diff
+21 -16
View File
@@ -21,11 +21,13 @@
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/list.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/print.h>
#include <isc/refcount.h>
#include <isc/sockaddr.h>
#include <isc/time.h>
@@ -84,6 +86,8 @@
* in a tight loop of constant lookups. It's value is arbitrary.
*/
ISC_LANG_BEGINDECLS
typedef struct dig_lookup dig_lookup_t;
typedef struct dig_query dig_query_t;
typedef struct dig_server dig_server_t;
@@ -104,8 +108,9 @@ struct dig_lookup {
isc_refcount_t references;
bool aaonly, adflag, badcookie, besteffort, cdflag, cleared, comments,
dns64prefix, dnssec, doing_xfr, done_as_is, ednsneg, expandaaaa,
svcparamkeycompat, expire, fuzzing, header_only,
identify, /*%< Append an "on server <foo>" message */
expire, fuzzing, header_only, identify, /*%< Append an "on
server <foo>" message
*/
identify_previous_line, /*% Prepend a "Nameserver <foo>:"
message, with newline and tab */
idnin, idnout, ignore, multiline, need_search, new_search,
@@ -162,6 +167,7 @@ struct dig_lookup {
char *cookie;
dns_ednsopt_t *ednsopts;
unsigned int ednsoptscnt;
isc_dscp_t dscp;
unsigned int ednsflags;
dns_opcode_t opcode;
int rrcomments;
@@ -183,13 +189,6 @@ struct dig_lookup {
char *tls_key_file;
isc_tlsctx_cache_t *tls_ctx_cache;
};
struct {
bool proxy_mode;
bool proxy_plain;
bool proxy_local;
isc_sockaddr_t proxy_src_addr;
isc_sockaddr_t proxy_dst_addr;
};
isc_stdtime_t fuzztime;
};
@@ -262,10 +261,11 @@ extern isc_sockaddr_t localaddr;
extern char keynametext[MXNAME];
extern char keyfile[MXNAME];
extern char keysecret[MXNAME];
extern dst_algorithm_t hmac_alg;
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_loopmgr_t *loopmgr;
extern isc_loop_t *mainloop;
extern bool free_now;
@@ -289,18 +289,15 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp);
isc_result_t
get_reverse(char *reverse, size_t len, char *value, bool strict);
ISC_NORETURN void
noreturn void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
void
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_NORETURN void
noreturn void
digexit(void);
void
cleanup_openssl_refs(void);
void
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
@@ -344,7 +341,7 @@ isc_result_t
parse_netprefix(isc_sockaddr_t **sap, const char *value);
void
parse_hmac(const char *algname);
parse_hmac(const char *hmacstr);
dig_lookup_t *
requeue_lookup(dig_lookup_t *lookold, bool servers);
@@ -448,6 +445,12 @@ dig_query_setup(bool, bool, int argc, char **argv);
void
dig_startup(void);
/*%
* Initiates the next lookup cycle
*/
void
dig_query_start(void);
/*%
* Activate/deactivate IDN filtering of output.
*/
@@ -462,3 +465,5 @@ dig_shutdown(void);
bool
dig_lookup_is_tls(const dig_lookup_t *lookup);
ISC_LANG_ENDDECLS
+30 -48
View File
@@ -23,7 +23,9 @@
#include <isc/commandline.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
@@ -80,7 +82,6 @@ struct rtype rtypes[] = { { 1, "has address" },
{ 25, "has key" },
{ 28, "has IPv6 address" },
{ 29, "location" },
{ dns_rdatatype_https, "has HTTP service bindings" },
{ 0, NULL } };
static char *
@@ -97,10 +98,10 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return totext.deconsttext;
return (totext.deconsttext);
}
ISC_NORETURN static void
noreturn static void
show_usage(void);
static void
@@ -133,7 +134,7 @@ show_usage(void) {
" -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n");
exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -150,9 +151,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));
if (query->lookup->use_usec) {
now = isc_time_now_hires();
TIME_NOW_HIRES(&now);
} else {
now = isc_time_now();
TIME_NOW(&now);
}
diff = (int)isc_time_microdiff(&now, &query->time_sent);
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
@@ -184,7 +185,6 @@ retry:
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_NOSPACE) {
isc_buffer_free(&b);
INSIST(bufsize <= (UINT_MAX / 2));
bufsize *= 2;
goto retry;
}
@@ -223,9 +223,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
result = dns_message_firstname(msg, sectionid);
if (result == ISC_R_NOMORE) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
} else if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
for (;;) {
@@ -263,7 +263,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
print_name, false,
no_rdata, &target);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
#ifdef USEINITALWS
if (first) {
@@ -318,11 +318,11 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static isc_result_t
@@ -342,12 +342,12 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base);
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static void
@@ -424,7 +424,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
: query->lookup->textname,
msg->rcode, rcode_totext(msg->rcode));
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
@@ -458,16 +458,6 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
lookup->retries = tries;
ISC_LIST_APPEND(lookup_list, lookup, link);
}
lookup = clone_lookup(query->lookup, false);
if (lookup != NULL) {
strlcpy(lookup->textname, namestr,
sizeof(lookup->textname));
lookup->rdtype = dns_rdatatype_https;
lookup->rdtypeset = true;
lookup->origin = NULL;
lookup->retries = tries;
ISC_LIST_APPEND(lookup_list, lookup, link);
}
}
if (!short_form) {
@@ -528,7 +518,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
true, query);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
@@ -538,28 +528,26 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
!short_form, query);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
!short_form)
{
!short_form) {
printf("\n");
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
true, query);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
!short_form)
{
!short_form) {
printf("\n");
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
true, query);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
if ((tsig != NULL) && !short_form) {
@@ -567,7 +555,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
true);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
if (!short_form) {
@@ -585,7 +573,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printf("%s has no %s record\n", namestr, typestr);
}
seen_error = force_error;
return result;
return (result);
}
static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
@@ -602,12 +590,10 @@ pre_parse_args(int argc, char **argv) {
{
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
} else if (strcasecmp("record",
isc_commandline_argument) == 0)
{
isc_commandline_argument) == 0) {
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
} else if (strcasecmp("usage",
isc_commandline_argument) == 0)
{
isc_commandline_argument) == 0) {
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
}
break;
@@ -666,7 +652,7 @@ pre_parse_args(int argc, char **argv) {
break;
case 'V':
printf("host %s\n", PACKAGE_VERSION);
exit(EXIT_SUCCESS);
exit(0);
break;
case 'w':
break;
@@ -718,8 +704,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 't':
if (strncasecmp(isc_commandline_argument, "ixfr=", 5) ==
0)
{
0) {
rdtype = dns_rdatatype_ixfr;
/* XXXMPA add error checking */
serial = strtoul(isc_commandline_argument + 5,
@@ -738,8 +723,7 @@ 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;
@@ -783,8 +767,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
FALLTHROUGH;
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;
@@ -858,7 +841,6 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 'p':
port = atoi(isc_commandline_argument);
port_set = true;
break;
}
}
@@ -928,5 +910,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return (seen_error == 0) ? 0 : 1;
return ((seen_error == 0) ? 0 : 1);
}
+1 -1
View File
@@ -122,7 +122,7 @@ Options
CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
When no query type is specified, :program:`host` automatically selects an
appropriate query type. By default, it looks for A, AAAA, MX, and HTTPS
appropriate query type. By default, it looks for A, AAAA, and MX
records. If the :option:`-C` option is given, queries are made for SOA
records. If ``name`` is a dotted-decimal IPv4 address or
colon-delimited IPv6 address, :program:`host` queries for PTR records.
+25 -25
View File
@@ -16,15 +16,18 @@
#include <stdlib.h>
#include <unistd.h>
#include <isc/async.h>
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/job.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <isc/work.h>
@@ -128,7 +131,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return totext.deconsttext;
return (totext.deconsttext);
}
static void
@@ -189,7 +192,6 @@ printrdata(dns_rdata_t *rdata) {
check_result(result, "dns_rdata_totext");
}
isc_buffer_free(&b);
INSIST(size <= (UINT_MAX / 2));
size *= 2;
}
}
@@ -210,9 +212,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
} else if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
for (;;) {
name = NULL;
@@ -256,10 +258,10 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static isc_result_t
@@ -294,9 +296,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
} else if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
for (;;) {
name = NULL;
@@ -338,10 +340,10 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static void
@@ -424,7 +426,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
/* the lookup failed */
print_error |= 1;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
@@ -478,7 +480,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static void
@@ -537,10 +539,10 @@ testtype(char *typetext) {
tr.length = strlen(typetext);
result = dns_rdatatype_fromtext(&rdtype, &tr);
if (result == ISC_R_SUCCESS) {
return true;
return (true);
} else {
printf("unknown query type: %s\n", typetext);
return false;
return (false);
}
}
@@ -554,10 +556,10 @@ testclass(char *typetext) {
tr.length = strlen(typetext);
result = dns_rdataclass_fromtext(&rdclass, &tr);
if (result == ISC_R_SUCCESS) {
return true;
return (true);
} else {
printf("unknown query class: %s\n", typetext);
return false;
return (false);
}
}
@@ -567,7 +569,6 @@ set_port(const char *value) {
isc_result_t result = parse_uint(&n, value, 65535, "port");
if (result == ISC_R_SUCCESS) {
port = (uint16_t)n;
port_set = true;
}
}
@@ -836,7 +837,7 @@ fgets_next_command(void *arg) {
cmdline = fgets(cmdlinebuf, COMMSIZE, stdin);
}
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -850,7 +851,7 @@ usage(void) {
"'host' using default server\n");
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
"'host' using 'server'\n");
exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -863,7 +864,7 @@ parse_args(int argc, char **argv) {
if (argv[0][0] == '-') {
if (strncasecmp(argv[0], "-ver", 4) == 0) {
printf("nslookup %s\n", PACKAGE_VERSION);
exit(EXIT_SUCCESS);
exit(0);
} else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
} else {
@@ -889,14 +890,13 @@ static void
start_next_command(void);
static void
process_next_command(void *arg ISC_ATTR_UNUSED) {
isc_loop_t *loop = isc_loop_main(loopmgr);
process_next_command(void *arg __attribute__((__unused__))) {
if (cmdline == NULL) {
in_use = false;
} else {
do_next_command(cmdline);
if (ISC_LIST_HEAD(lookup_list) != NULL) {
isc_async_run(loop, run_loop, NULL);
isc_job_run(loopmgr, run_loop, NULL);
return;
}
}
@@ -975,5 +975,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return query_error | print_error;
return (query_error | print_error);
}
+3 -3
View File
@@ -48,10 +48,10 @@ readline(const char *prompt) {
line = fgets(buf, RL_MAXCMD, stdin);
if (line == NULL) {
free(buf);
return NULL;
return (NULL);
}
return buf;
}
return (buf);
};
#define add_history(line)
-1
View File
@@ -2,7 +2,6 @@ dnssec-cds
dnssec-dsfromkey
dnssec-keyfromlabel
dnssec-keygen
dnssec-ksr
dnssec-makekeyset
dnssec-revoke
dnssec-settime
+3 -15
View File
@@ -2,7 +2,6 @@ include $(top_srcdir)/Makefile.top
AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBDNS_CFLAGS)
AM_CPPFLAGS += \
@@ -13,9 +12,7 @@ noinst_LTLIBRARIES = libdnssectool.la
LDADD += \
libdnssectool.la \
$(LIBISC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBDNS_LIBS) \
$(OPENSSL_LIBS)
$(LIBDNS_LIBS)
bin_PROGRAMS = \
dnssec-cds \
@@ -23,7 +20,6 @@ bin_PROGRAMS = \
dnssec-importkey \
dnssec-keyfromlabel \
dnssec-keygen \
dnssec-ksr \
dnssec-revoke \
dnssec-settime \
dnssec-signzone \
@@ -35,16 +31,8 @@ libdnssectool_la_SOURCES = \
dnssec_keygen_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(OPENSSL_CFLAGS)
$(LIBISCCFG_CFLAGS)
dnssec_keygen_LDADD = \
$(LDADD) \
$(OPENSSL_LIBS)
dnssec_signzone_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(OPENSSL_CFLAGS)
dnssec_signzone_LDADD = \
$(LDADD) \
$(OPENSSL_LIBS)
$(LIBISCCFG_LIBS)
+105 -133
View File
@@ -29,8 +29,8 @@
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/serial.h>
#include <isc/string.h>
@@ -44,6 +44,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -63,6 +64,7 @@ const char *program = "dnssec-cds";
/*
* Infrastructure
*/
static isc_log_t *lctx = NULL;
static isc_mem_t *mctx = NULL;
/*
@@ -123,28 +125,15 @@ typedef isc_result_t
ds_maker_func_t(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
dns_rdata_t *crdata);
static dns_rdataset_t cdnskey_set = DNS_RDATASET_INIT;
static dns_rdataset_t cdnskey_sig = DNS_RDATASET_INIT;
static dns_rdataset_t cds_set = DNS_RDATASET_INIT;
static dns_rdataset_t cds_sig = DNS_RDATASET_INIT;
static dns_rdataset_t dnskey_set = DNS_RDATASET_INIT;
static dns_rdataset_t dnskey_sig = DNS_RDATASET_INIT;
static dns_rdataset_t old_ds_set = DNS_RDATASET_INIT;
static dns_rdataset_t new_ds_set = DNS_RDATASET_INIT;
static dns_rdataset_t cdnskey_set, cdnskey_sig;
static dns_rdataset_t cds_set, cds_sig;
static dns_rdataset_t dnskey_set, dnskey_sig;
static dns_rdataset_t old_ds_set, new_ds_set;
static keyinfo_t *old_key_tbl = NULL, *new_key_tbl = NULL;
static keyinfo_t *old_key_tbl, *new_key_tbl;
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
static dns_db_t *child_db = NULL;
static dns_dbnode_t *child_node = NULL;
static dns_db_t *parent_db = NULL;
static dns_dbnode_t *parent_node = NULL;
static dns_db_t *update_db = NULL;
static dns_dbnode_t *update_node = NULL;
static dns_dbversion_t *update_version = NULL;
static bool print_mem_stats = false;
static void
verbose_time(int level, const char *msg, isc_stdtime_t time) {
isc_result_t result;
@@ -245,8 +234,8 @@ static void
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
isc_result_t result;
result = dns_db_create(mctx, ZONEDB_DEFAULT, 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,
@@ -262,27 +251,21 @@ load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
}
static void
free_db(dns_db_t **dbp, dns_dbnode_t **nodep, dns_dbversion_t **versionp) {
if (*dbp != NULL) {
if (*nodep != NULL) {
dns_db_detachnode(*dbp, nodep);
}
if (versionp != NULL && *versionp != NULL) {
dns_db_closeversion(*dbp, versionp, false);
}
dns_db_detach(dbp);
}
free_db(dns_db_t **dbp, dns_dbnode_t **nodep) {
dns_db_detachnode(*dbp, nodep);
dns_db_detach(dbp);
}
static void
load_child_sets(const char *file) {
load_db(file, &child_db, &child_node);
findset(child_db, child_node, dns_rdatatype_dnskey, &dnskey_set,
&dnskey_sig);
findset(child_db, child_node, dns_rdatatype_cdnskey, &cdnskey_set,
&cdnskey_sig);
findset(child_db, child_node, dns_rdatatype_cds, &cds_set, &cds_sig);
free_db(&child_db, &child_node, NULL);
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
load_db(file, &db, &node);
findset(db, node, dns_rdatatype_dnskey, &dnskey_set, &dnskey_sig);
findset(db, node, dns_rdatatype_cdnskey, &cdnskey_set, &cdnskey_sig);
findset(db, node, dns_rdatatype_cds, &cds_set, &cds_sig);
free_db(&db, &node);
}
static void
@@ -331,6 +314,8 @@ get_dsset_name(char *filename, size_t size, const char *path,
static void
load_parent_set(const char *path) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_time_t modtime;
char filename[PATH_MAX + 1];
@@ -343,20 +328,21 @@ load_parent_set(const char *path) {
}
notbefore = isc_time_seconds(&modtime);
if (startstr != NULL) {
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
isc_stdtime_get(&now);
notbefore = strtotime(startstr, now, notbefore, NULL);
}
verbose_time(1, "child records must not be signed before", notbefore);
load_db(filename, &parent_db, &parent_node);
findset(parent_db, parent_node, dns_rdatatype_ds, &old_ds_set, NULL);
load_db(filename, &db, &node);
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);
}
free_db(&parent_db, &parent_node, NULL);
free_db(&db, &node);
}
#define MAX_CDS_RDATA_TEXT_SIZE DNS_RDATA_MAXLENGTH * 2
@@ -381,19 +367,18 @@ formatset(dns_rdataset_t *rdataset) {
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
dns_master_styledestroy(&style, mctx);
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
result = ISC_R_NOSPACE;
}
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&buf);
check_result(result, "dns_rdataset_totext()");
}
check_result(result, "dns_rdataset_totext()");
isc_buffer_putuint8(buf, 0);
return buf;
dns_master_styledestroy(&style, mctx);
return (buf);
}
static void
@@ -435,7 +420,6 @@ write_parent_set(const char *path, const char *inplace, bool nsupdate,
result = isc_file_openunique(tmpname, &fp);
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&buf);
fatal("open %s: %s", tmpname, isc_result_totext(result));
}
fprintf(fp, "%s", (char *)r.base);
@@ -503,14 +487,14 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
vbprintf(1, "found matching %s %d %d %d\n",
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return true;
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);
return false;
return (false);
}
}
@@ -519,7 +503,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
ki->tag, ki->algo);
return false;
return (false);
}
/*
@@ -530,22 +514,23 @@ static keyinfo_t *
match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
strictness_t strictness) {
isc_result_t result;
keyinfo_t *keytable, *ki;
keyinfo_t *keytable;
int i;
nkey = dns_rdataset_count(keyset);
keytable = isc_mem_cget(mctx, nkey, sizeof(keytable[0]));
keytable = isc_mem_getx(mctx, sizeof(keytable[0]) * nkey, ISC_MEM_ZERO);
for (result = dns_rdataset_first(keyset), i = 0, ki = keytable;
result == ISC_R_SUCCESS;
result = dns_rdataset_next(keyset), i++, ki++)
for (result = dns_rdataset_first(keyset), i = 0;
result == ISC_R_SUCCESS; result = dns_rdataset_next(keyset), i++)
{
keyinfo_t *ki;
dns_rdata_dnskey_t dnskey;
dns_rdata_t *keyrdata;
isc_region_t r;
INSIST(i < nkey);
ki = &keytable[i];
keyrdata = &ki->rdata;
dns_rdata_init(keyrdata);
@@ -573,7 +558,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
}
}
return keytable;
return (keytable);
}
static void
@@ -583,15 +568,14 @@ free_keytable(keyinfo_t **keytable_p) {
keyinfo_t *ki;
int i;
REQUIRE(keytable != NULL);
for (i = 0, ki = keytable; i < nkey; i++, ki++) {
for (i = 0; i < nkey; i++) {
ki = &keytable[i];
if (ki->dst != NULL) {
dst_key_free(&ki->dst);
}
}
isc_mem_cput(mctx, keytable, nkey, sizeof(keytable[0]));
isc_mem_put(mctx, keytable, sizeof(keytable[0]) * nkey);
}
/*
@@ -610,9 +594,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
dns_secalg_t *algo;
int i;
REQUIRE(keytbl != NULL);
algo = isc_mem_cget(mctx, nkey, sizeof(algo[0]));
algo = isc_mem_getx(mctx, nkey * sizeof(algo[0]), ISC_MEM_ZERO);
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(sigset))
@@ -653,8 +635,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
NULL);
if (result != ISC_R_SUCCESS &&
result != DNS_R_FROMWILDCARD)
{
result != DNS_R_FROMWILDCARD) {
vbprintf(1,
"skip RRSIG by key %d:"
" verification failed: %s\n",
@@ -679,7 +660,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
}
}
return algo;
return (algo);
}
/*
@@ -695,8 +676,8 @@ signed_loose(dns_secalg_t *algo) {
ok = true;
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return ok;
isc_mem_put(mctx, algo, nkey * sizeof(algo[0]));
return (ok);
}
/*
@@ -737,8 +718,8 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return all_ok;
isc_mem_put(mctx, algo, nkey);
return (all_ok);
}
/*
@@ -759,10 +740,10 @@ ds_from_cds(isc_buffer_t *buf, dns_rdata_t *rds, dns_dsdigest_t dt,
ds.common.rdtype = dns_rdatatype_ds;
if (ds.digest_type != dt) {
return ISC_R_IGNORE;
return (ISC_R_IGNORE);
}
return dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf);
return (dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf));
}
static isc_result_t
@@ -775,7 +756,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
isc_buffer_availableregion(buf, &r);
if (r.length < DNS_DS_BUFFERSIZE) {
return ISC_R_NOSPACE;
return (ISC_R_NOSPACE);
}
result = dns_ds_buildrdata(name, cdnskey, dt, r.base, ds);
@@ -783,7 +764,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
isc_buffer_add(buf, DNS_DS_BUFFERSIZE);
}
return result;
return (result);
}
static isc_result_t
@@ -814,14 +795,13 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf,
continue;
case ISC_R_NOSPACE:
isc_mem_put(mctx, ds, sizeof(*ds));
return result;
return (result);
default:
isc_mem_put(mctx, ds, sizeof(*ds));
check_result(result, "ds_from_rdata()");
}
}
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static void
@@ -866,8 +846,8 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
static int
rdata_cmp(const void *rdata1, const void *rdata2) {
return dns_rdata_compare((const dns_rdata_t *)rdata1,
(const dns_rdata_t *)rdata2);
return (dns_rdata_compare((const dns_rdata_t *)rdata1,
(const dns_rdata_t *)rdata2));
}
/*
@@ -892,7 +872,7 @@ consistent_digests(dns_rdataset_t *dsset) {
n = dns_rdataset_count(dsset);
arrdata = isc_mem_cget(mctx, n, sizeof(dns_rdata_t));
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
result = dns_rdataset_next(dsset), i++)
@@ -906,7 +886,7 @@ consistent_digests(dns_rdataset_t *dsset) {
/*
* Convert sorted arrdata to more accessible format
*/
ds = isc_mem_cget(mctx, n, sizeof(dns_rdata_ds_t));
ds = isc_mem_get(mctx, n * sizeof(dns_rdata_ds_t));
for (i = 0; i < n; i++) {
result = dns_rdata_tostruct(&arrdata[i], &ds[i], NULL);
@@ -945,10 +925,10 @@ consistent_digests(dns_rdataset_t *dsset) {
/*
* Done!
*/
isc_mem_cput(mctx, ds, n, sizeof(dns_rdata_ds_t));
isc_mem_cput(mctx, arrdata, n, sizeof(dns_rdata_t));
isc_mem_put(mctx, ds, n * sizeof(dns_rdata_ds_t));
isc_mem_put(mctx, arrdata, n * sizeof(dns_rdata_t));
return match;
return (match);
}
static void
@@ -974,27 +954,32 @@ static void
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;
dns_dbversion_t *ver;
dns_rdataset_t diffset;
uint32_t save;
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &update_db);
db = NULL;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
check_result(result, "dns_db_create()");
result = dns_db_newversion(update_db, &update_version);
ver = NULL;
result = dns_db_newversion(db, &ver);
check_result(result, "dns_db_newversion()");
result = dns_db_findnode(update_db, name, true, &update_node);
node = NULL;
result = dns_db_findnode(db, name, true, &node);
check_result(result, "dns_db_findnode()");
dns_rdataset_init(&diffset);
result = dns_db_addrdataset(update_db, update_node, update_version, 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(update_db, update_node, update_version,
delset, 0, &diffset);
result = dns_db_subtractrdataset(db, node, ver, delset, 0, &diffset);
if (result == DNS_R_UNCHANGED) {
save = addset->ttl;
addset->ttl = ttl;
@@ -1007,7 +992,9 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_disassociate(&diffset);
}
free_db(&update_db, &update_node, &update_version);
dns_db_detachnode(db, &node);
dns_db_closeversion(db, &ver, false);
dns_db_detach(&db);
}
static void
@@ -1027,7 +1014,7 @@ nsdiff(uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) {
}
}
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -1054,27 +1041,7 @@ usage(void) {
" -T <ttl> TTL of DS records\n"
" -V print version\n"
" -v <verbosity>\n");
exit(EXIT_FAILURE);
}
static void
cleanup(void) {
free_db(&child_db, &child_node, NULL);
free_db(&parent_db, &parent_node, NULL);
free_db(&update_db, &update_node, &update_version);
if (old_key_tbl != NULL) {
free_keytable(&old_key_tbl);
}
if (new_key_tbl != NULL) {
free_keytable(&new_key_tbl);
}
free_all_sets();
if (mctx != NULL) {
if (print_mem_stats && verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
}
exit(1);
}
int
@@ -1082,14 +1049,13 @@ main(int argc, char *argv[]) {
const char *child_path = NULL;
const char *ds_path = NULL;
const char *inplace = NULL;
isc_result_t result;
bool prefer_cdnskey = false;
bool nsupdate = false;
uint32_t ttl = 0;
int ch;
char *endp;
setfatalcallback(cleanup);
isc_mem_create(&mctx);
isc_commandline_errprint = false;
@@ -1118,8 +1084,7 @@ main(int argc, char *argv[]) {
* optional, 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 {
@@ -1169,7 +1134,13 @@ main(int argc, char *argv[]) {
dtype[0] = DNS_DSDIGEST_SHA256;
}
setup_logging();
setup_logging(mctx, &lctx);
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
if (ds_path == NULL) {
fatal("missing -d DS pathname");
@@ -1205,8 +1176,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);
}
@@ -1229,8 +1199,7 @@ 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)))
{
&cdnskey_sig))) {
fatal("could not validate child CDNSKEY RRset for %s",
namestr);
}
@@ -1238,8 +1207,7 @@ main(int argc, char *argv[]) {
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)))
{
matching_sigs(old_key_tbl, &cds_set, &cds_sig))) {
fatal("could not validate child CDS RRset for %s",
namestr);
}
@@ -1269,7 +1237,7 @@ main(int argc, char *argv[]) {
vbprintf(1, "%s has neither CDS nor CDNSKEY records\n",
namestr);
write_parent_set(ds_path, inplace, nsupdate, &old_ds_set);
goto cleanup;
exit(0);
}
/*
@@ -1335,9 +1303,13 @@ main(int argc, char *argv[]) {
write_parent_set(ds_path, inplace, nsupdate, &new_ds_set);
cleanup:
print_mem_stats = true;
cleanup();
free_all_sets();
cleanup_logging(&lctx);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
return 0;
exit(0);
}
+32 -24
View File
@@ -22,8 +22,8 @@
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -34,6 +34,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -54,7 +55,6 @@ static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static uint32_t ttl;
static bool emitttl = false;
static unsigned int split_width = 0;
static isc_result_t
initname(char *setname) {
@@ -66,7 +66,7 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return result;
return (result);
}
static void
@@ -101,8 +101,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
@@ -138,7 +138,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return result;
return (result);
}
static isc_result_t
@@ -153,7 +153,7 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
if (dirname != NULL) {
/* allow room for a trailing slash */
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
return ISC_R_NOSPACE;
return (ISC_R_NOSPACE);
}
isc_buffer_putstr(&buf, dirname);
if (dirname[strlen(dirname) - 1] != '/') {
@@ -162,18 +162,18 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
}
if (isc_buffer_availablelength(&buf) < 7) {
return ISC_R_NOSPACE;
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) {
return ISC_R_NOSPACE;
return (ISC_R_NOSPACE);
}
isc_buffer_putuint8(&buf, 0);
return loadset(filename, rdataset);
return (loadset(filename, rdataset));
}
static void
@@ -275,13 +275,13 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
fatal("can't build record");
}
result = dns_name_totext(name, 0, &nameb);
result = dns_name_totext(name, false, &nameb);
if (result != ISC_R_SUCCESS) {
fatal("can't print name");
}
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, split_width,
"", &textb);
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
&textb);
if (result != ISC_R_SUCCESS) {
fatal("can't print rdata");
@@ -324,7 +324,7 @@ emits(bool showall, bool cds, dns_rdata_t *rdata) {
}
}
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -348,14 +348,13 @@ usage(void) {
" -f zonefile: read keys from a zone file\n"
" -h: print help information\n"
" -K directory: where to find key or keyset files\n"
" -w split base64 rdata text into chunks\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(EXIT_FAILURE);
exit(-1);
}
int
@@ -368,6 +367,7 @@ main(int argc, char **argv) {
bool usekeyset = false;
bool showall = false;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
@@ -381,7 +381,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define OPTIONS "12Aa:Cc:d:Ff:K:sT:v:whV"
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
switch (ch) {
case '1':
@@ -417,6 +417,9 @@ main(int argc, char **argv) {
case 'f':
filename = isc_commandline_argument;
break;
case 'l':
fatal("-l option (DLV lookaside) is obsolete");
break;
case 's':
usekeyset = true;
break;
@@ -430,9 +433,6 @@ main(int argc, char **argv) {
fatal("-v must be followed by a number");
}
break;
case 'w':
split_width = UINT_MAX;
break;
case 'F':
/* Reserved for FIPS mode */
FALLTHROUGH;
@@ -453,7 +453,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -485,7 +485,13 @@ main(int argc, char **argv) {
fatal("extraneous arguments");
}
setup_logging();
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
setup_logging(mctx, &log);
dns_rdataset_init(&rdataset);
@@ -538,6 +544,8 @@ main(int argc, char **argv) {
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
@@ -546,8 +554,8 @@ main(int argc, char **argv) {
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return 1;
return (1);
} else {
return 0;
return (0);
}
}
+23 -12
View File
@@ -20,8 +20,8 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -32,6 +32,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -68,7 +69,7 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return result;
return (result);
}
static void
@@ -103,8 +104,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
@@ -141,7 +142,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return result;
return (result);
}
static void
@@ -262,7 +263,7 @@ emit(const char *dir, dns_rdata_t *rdata) {
dst_key_free(&key);
}
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -289,7 +290,7 @@ usage(void) {
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
@@ -299,11 +300,13 @@ main(int argc, char **argv) {
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 = isc_stdtime_now();
isc_stdtime_t now;
dns_rdata_init(&rdata);
isc_stdtime_get(&now);
if (argc == 1) {
usage();
@@ -394,7 +397,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -407,7 +410,13 @@ main(int argc, char **argv) {
fatal("extraneous arguments");
}
setup_logging();
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
setup_logging(mctx, &log);
dns_rdataset_init(&rdataset);
@@ -451,6 +460,8 @@ main(int argc, char **argv) {
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
@@ -459,8 +470,8 @@ main(int argc, char **argv) {
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return 1;
return (1);
} else {
return 0;
return (0);
}
}
+40 -36
View File
@@ -21,8 +21,8 @@
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -31,6 +31,7 @@
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/secalg.h>
@@ -43,9 +44,7 @@
const char *program = "dnssec-keyfromlabel";
static uint16_t tag_min = 0, tag_max = 0xffff;
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -58,19 +57,20 @@ usage(void) {
fprintf(stderr, " name: owner of the key\n");
fprintf(stderr, "Other options:\n");
fprintf(stderr, " -a algorithm: \n"
" RSASHA1 |\n"
" DH | RSASHA1 |\n"
" NSEC3RSASHA1 |\n"
" RSASHA256 | RSASHA512 |\n"
" ECDSAP256SHA256 | ECDSAP384SHA384 |\n"
" ED25519 | ED448\n");
fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
fprintf(stderr, " -c class (default: IN)\n");
fprintf(stderr, " -E <engine>:\n");
fprintf(stderr, " name of an OpenSSL engine to use\n");
fprintf(stderr, " -f keyflag: KSK | REVOKE\n");
fprintf(stderr, " -K directory: directory in which to place "
"key files\n");
fprintf(stderr, " -k: generate a TYPE=KEY key\n");
fprintf(stderr, " -L ttl: default key TTL\n");
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | "
"OTHER\n");
fprintf(stderr, " (DNSKEY generation defaults to ZONE\n");
@@ -103,7 +103,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
@@ -113,6 +113,7 @@ main(int argc, char **argv) {
const char *directory = NULL;
const char *predecessor = NULL;
dst_key_t *prevkey = NULL;
const char *engine = NULL;
char *classname = NULL;
char *endp;
dst_key_t *key = NULL;
@@ -128,12 +129,14 @@ main(int argc, char **argv) {
isc_textregion_t r;
char filename[255];
isc_buffer_t buf;
isc_log_t *log = NULL;
dns_rdataclass_t rdclass;
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
char *label = NULL;
dns_ttl_t ttl = 0;
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
bool setpub = false, setact = false;
bool setrev = false, setinact = false;
@@ -149,7 +152,6 @@ main(int argc, char **argv) {
isc_stdtime_t syncadd = 0, syncdel = 0;
bool unsetsyncadd = false, setsyncadd = false;
bool unsetsyncdel = false, setsyncdel = false;
isc_stdtime_t now = isc_stdtime_now();
if (argc == 1) {
usage();
@@ -159,7 +161,9 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:M:n:P:p:R:S:t:v:Vy"
isc_stdtime_get(&now);
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:n:P:p:R:S:t:v:Vy"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case '3':
@@ -175,7 +179,7 @@ main(int argc, char **argv) {
classname = isc_commandline_argument;
break;
case 'E':
fatal("%s", isc_result_totext(DST_R_NOENGINE));
engine = isc_commandline_argument;
break;
case 'f':
c = (unsigned char)(isc_commandline_argument[0]);
@@ -206,20 +210,6 @@ main(int argc, char **argv) {
case 'l':
label = isc_mem_strdup(mctx, isc_commandline_argument);
break;
case 'M': {
unsigned long ul;
tag_min = ul = strtoul(isc_commandline_argument, &endp,
10);
if (*endp != ':' || ul > 0xffff) {
fatal("-M range invalid");
}
tag_max = ul = strtoul(endp + 1, &endp, 10);
if (*endp != '\0' || ul > 0xffff || tag_max <= tag_min)
{
fatal("-M range invalid");
}
break;
}
case 'n':
nametype = isc_commandline_argument;
break;
@@ -344,11 +334,16 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
setup_logging();
ret = dst_lib_init(mctx, engine);
if (ret != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s", isc_result_totext(ret));
}
setup_logging(mctx, &log);
if (predecessor == NULL) {
if (label == NULL) {
@@ -393,6 +388,9 @@ main(int argc, char **argv) {
if (ret != ISC_R_SUCCESS) {
fatal("unknown algorithm %s", algname);
}
if (alg == DST_ALG_DH) {
options |= DST_TYPE_KEY;
}
if (use_nsec3) {
switch (alg) {
@@ -561,8 +559,7 @@ main(int argc, char **argv) {
flags |= DNS_KEYOWNER_ZONE;
} else if ((options & DST_TYPE_KEY) != 0) { /* KEY */
if (strcasecmp(nametype, "host") == 0 ||
strcasecmp(nametype, "entity") == 0)
{
strcasecmp(nametype, "entity") == 0) {
flags |= DNS_KEYOWNER_ENTITY;
} else if (strcasecmp(nametype, "user") == 0) {
flags |= DNS_KEYOWNER_USER;
@@ -589,8 +586,7 @@ main(int argc, char **argv) {
if (protocol == -1) {
protocol = DNS_KEYPROTO_DNSSEC;
} else if ((options & DST_TYPE_KEY) == 0 &&
protocol != DNS_KEYPROTO_DNSSEC)
{
protocol != DNS_KEYPROTO_DNSSEC) {
fatal("invalid DNSKEY protocol: %d", protocol);
}
@@ -600,11 +596,18 @@ main(int argc, char **argv) {
}
}
if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
alg == DNS_KEYALG_DH)
{
fatal("a key with algorithm '%s' cannot be a zone key",
algname);
}
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
/* associate the key */
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass, label,
NULL, mctx, &key);
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass, engine,
label, NULL, mctx, &key);
if (ret != ISC_R_SUCCESS) {
char namestr[DNS_NAME_FORMATSIZE];
@@ -614,7 +617,7 @@ main(int argc, char **argv) {
fatal("failed to get key %s/%s: %s", namestr, algstr,
isc_result_totext(ret));
UNREACHABLE();
exit(EXIT_FAILURE);
exit(-1);
}
/*
@@ -694,8 +697,7 @@ main(int argc, char **argv) {
* is a risk of ID collision due to this key or another key
* being revoked.
*/
if (key_collision(key, name, directory, mctx, tag_min, tag_max, &exact))
{
if (key_collision(key, name, directory, mctx, &exact)) {
isc_buffer_clear(&buf);
ret = dst_key_buildfilename(key, 0, directory, &buf);
if (ret != ISC_R_SUCCESS) {
@@ -740,6 +742,8 @@ main(int argc, char **argv) {
dst_key_free(&prevkey);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
@@ -750,5 +754,5 @@ main(int argc, char **argv) {
free(freeit);
}
return 0;
return (0);
}
+12 -14
View File
@@ -21,7 +21,7 @@ dnssec-keyfromlabel - DNSSEC key generation tool
Synopsis
~~~~~~~~
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-M** tag_min:tag_max] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
Description
~~~~~~~~~~~
@@ -63,12 +63,22 @@ Options
versions, then the NSEC3 version is used; for example,
``dnssec-keygen -3a RSASHA1`` specifies the NSEC3RSASHA1 algorithm.
.. option:: -E engine
This option specifies the cryptographic hardware to use.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -l label
This option specifies the label for a key pair in the crypto hardware.
When BIND 9 is built with OpenSSL-based PKCS#11 support, the label is
an arbitrary string that identifies a particular key.
an arbitrary string that identifies a particular key. It may be
preceded by an optional OpenSSL engine name, followed by a colon, as
in ``pkcs11:keylabel``.
.. option:: -n nametype
@@ -123,18 +133,6 @@ Options
place, in which case the existing TTL would take precedence. Setting
the default TTL to ``0`` or ``none`` removes it.
.. option:: -M tag_min:tag_max
This option sets the range of key tag values
that ``dnssec-keyfromlabel`` will accept. If the key tag of the new
key or the key tag of the revoked version of the new key is
outside this range, the new key will be rejected. This is
designed to be used when generating keys in a multi-signer
scenario, where each operator is given a range of key tags to
prevent collisions among different operators. The valid
values for ``tag_min`` and ``tag_max`` are [0..65535]. The
default allows all key tag values to be accepted.
.. option:: -p protocol
This option sets the protocol value for the key. The protocol is a number between
+158 -195
View File
@@ -33,14 +33,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <openssl/opensslv.h>
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/fips.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -50,29 +47,27 @@
#include <dns/fixedname.h>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/secalg.h>
#include <dst/dst.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#include "dnssectool.h"
#define MAX_RSA 4096 /* should be long enough... */
const char *program = "dnssec-keygen";
/*
* These are are set here for backwards compatibility. They are
* raised to 2048 in FIPS mode.
*/
static int min_rsa = 1024;
static int min_dh = 128;
isc_log_t *lctx = NULL;
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -83,22 +78,19 @@ struct keygen_ctx {
const char *policy;
const char *configfile;
const char *directory;
dns_keystore_t *keystore;
char *algname;
char *nametype;
char *type;
int generator;
int protocol;
int size;
uint16_t tag_min;
uint16_t tag_max;
int signatory;
dns_rdataclass_t rdclass;
int options;
int dbits;
dns_ttl_t ttl;
bool wantzsk;
bool wantksk;
bool wantrev;
uint16_t kskflag;
uint16_t revflag;
dns_secalg_t alg;
/* timing data */
int prepub;
@@ -149,22 +141,17 @@ usage(void) {
fprintf(stderr, " -l <file>: configuration file with dnssec-policy "
"statement\n");
fprintf(stderr, " -a <algorithm>:\n");
if (!isc_fips_mode()) {
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
}
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
fprintf(stderr, " RSASHA256 | RSASHA512 |\n");
fprintf(stderr, " ECDSAP256SHA256 | ECDSAP384SHA384 |\n");
fprintf(stderr, " ED25519 | ED448\n");
fprintf(stderr, " ED25519 | ED448 | DH\n");
fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
fprintf(stderr, " -b <key size in bits>:\n");
if (!isc_fips_mode()) {
fprintf(stderr, " RSASHA1:\t[%d..%d]\n", min_rsa,
MAX_RSA);
fprintf(stderr, " NSEC3RSASHA1:\t[%d..%d]\n", min_rsa,
MAX_RSA);
}
fprintf(stderr, " RSASHA256:\t[%d..%d]\n", min_rsa, MAX_RSA);
fprintf(stderr, " RSASHA512:\t[%d..%d]\n", min_rsa, MAX_RSA);
fprintf(stderr, " RSASHA1:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " NSEC3RSASHA1:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " RSASHA256:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " RSASHA512:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " DH:\t\t[128..4096]\n");
fprintf(stderr, " ECDSAP256SHA256:\tignored\n");
fprintf(stderr, " ECDSAP384SHA384:\tignored\n");
fprintf(stderr, " ED25519:\tignored\n");
@@ -176,10 +163,12 @@ usage(void) {
fprintf(stderr, " (DNSKEY generation defaults to ZONE)\n");
fprintf(stderr, " -c <class>: (default: IN)\n");
fprintf(stderr, " -d <digest bits> (0 => max, default)\n");
fprintf(stderr, " -f <keyflag>: ZSK | KSK | REVOKE\n");
fprintf(stderr, " -F: FIPS mode\n");
fprintf(stderr, " -E <engine>:\n");
fprintf(stderr, " name of an OpenSSL engine to use\n");
fprintf(stderr, " -f <keyflag>: KSK | REVOKE\n");
fprintf(stderr, " -g <generator>: use specified generator "
"(DH only)\n");
fprintf(stderr, " -L <ttl>: default key TTL\n");
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
fprintf(stderr, " -p <protocol>: (default: 3 [dnssec])\n");
fprintf(stderr, " -s <strength>: strength value this key signs DNS "
"records with (default: 0)\n");
@@ -190,7 +179,7 @@ usage(void) {
"(default: AUTHCONF)\n");
fprintf(stderr, " -h: print usage and exit\n");
fprintf(stderr, " -m <memory debugging mode>:\n");
fprintf(stderr, " usage | trace | record\n");
fprintf(stderr, " usage | trace | record | size | mctx\n");
fprintf(stderr, " -v <level>: set verbosity level (0 - 10)\n");
fprintf(stderr, " -V: print version information\n");
fprintf(stderr, "Timing options:\n");
@@ -220,7 +209,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
static void
@@ -247,11 +236,58 @@ progress(int p) {
(void)fflush(stderr);
}
static void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
dns_kasp_t **kaspp) {
const cfg_listelt_t *element;
const cfg_obj_t *kasps = NULL;
dns_kasp_t *kasp = NULL, *kasp_next;
isc_result_t result = ISC_R_NOTFOUND;
dns_kasplist_t kasplist;
ISC_LIST_INIT(kasplist);
(void)cfg_map_get(config, "dnssec-policy", &kasps);
for (element = cfg_list_first(kasps); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
kasp = NULL;
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
name) != 0) {
continue;
}
result = cfg_kasp_fromconfig(kconfig, NULL, mctx, lctx,
&kasplist, &kasp);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure dnssec-policy '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
INSIST(kasp != NULL);
dns_kasp_freeze(kasp);
break;
}
*kaspp = kasp;
/*
* Cleanup kasp list.
*/
for (kasp = ISC_LIST_HEAD(kasplist); kasp != NULL; kasp = kasp_next) {
kasp_next = ISC_LIST_NEXT(kasp, link);
ISC_LIST_UNLINK(kasplist, kasp, link);
dns_kasp_detach(&kasp);
}
}
static void
keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
char filename[255];
char algstr[DNS_SECALG_FORMATSIZE];
uint16_t flags = 0;
int param = 0;
bool null_key = false;
bool conflict = false;
bool show_progress = false;
@@ -286,15 +322,8 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
fatal("unsupported algorithm: %s", algstr);
}
if (isc_fips_mode()) {
/* verify only in FIPS mode */
switch (ctx->alg) {
case DST_ALG_RSASHA1:
case DST_ALG_NSEC3RSASHA1:
fatal("unsupported algorithm: %s", algstr);
default:
break;
}
if (ctx->alg == DST_ALG_DH) {
ctx->options |= DST_TYPE_KEY;
}
if (ctx->use_nsec3) {
@@ -339,11 +368,6 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
switch (ctx->alg) {
case DST_ALG_RSASHA1:
case DST_ALG_NSEC3RSASHA1:
if (isc_fips_mode()) {
fatal("key size not specified (-b "
"option)");
}
FALLTHROUGH;
case DST_ALG_RSASHA256:
case DST_ALG_RSASHA512:
ctx->size = 2048;
@@ -367,8 +391,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (!ctx->oldstyle && ctx->prepub > 0) {
if (ctx->setpub && ctx->setact &&
(ctx->activate - ctx->prepub) < ctx->publish)
{
(ctx->activate - ctx->prepub) < ctx->publish) {
fatal("Activation and publication dates "
"are closer together than the\n\t"
"prepublication interval.");
@@ -499,18 +522,23 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
switch (ctx->alg) {
case DNS_KEYALG_RSASHA1:
case DNS_KEYALG_NSEC3RSASHA1:
if (isc_fips_mode()) {
fatal("SHA1 based keys not supported in FIPS mode");
}
FALLTHROUGH;
case DNS_KEYALG_RSASHA256:
case DNS_KEYALG_RSASHA512:
if (ctx->size != 0 &&
(ctx->size < min_rsa || ctx->size > MAX_RSA))
if (ctx->size != 0 && (ctx->size < 1024 || ctx->size > MAX_RSA))
{
fatal("RSA key size %d out of range", ctx->size);
}
break;
case DNS_KEYALG_RSASHA512:
if (ctx->size != 0 && (ctx->size < 1024 || ctx->size > MAX_RSA))
{
fatal("RSA key size %d out of range", ctx->size);
}
break;
case DNS_KEYALG_DH:
if (ctx->size != 0 && (ctx->size < 128 || ctx->size > 4096)) {
fatal("DH key size %d out of range", ctx->size);
}
break;
case DST_ALG_ECDSA256:
ctx->size = 256;
break;
@@ -525,6 +553,10 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
break;
}
if (ctx->alg != DNS_KEYALG_DH && ctx->generator != 0) {
fatal("specified DH generator for a non-DH key");
}
if (ctx->nametype == NULL) {
if ((ctx->options & DST_TYPE_KEY) != 0) { /* KEY */
fatal("no nametype specified");
@@ -553,12 +585,8 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if ((ctx->options & DST_TYPE_KEY) != 0) { /* KEY */
flags |= ctx->signatory;
} else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
if (ctx->ksk || ctx->wantksk) {
flags |= DNS_KEYFLAG_KSK;
}
if (ctx->wantrev) {
flags |= DNS_KEYFLAG_REVOKE;
}
flags |= ctx->kskflag;
flags |= ctx->revflag;
}
if (ctx->protocol == -1) {
@@ -578,6 +606,12 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
}
if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
ctx->alg == DNS_KEYALG_DH)
{
fatal("a key with algorithm %s cannot be a zone key", algstr);
}
switch (ctx->alg) {
case DNS_KEYALG_RSASHA1:
case DNS_KEYALG_NSEC3RSASHA1:
@@ -586,6 +620,10 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
show_progress = true;
break;
case DNS_KEYALG_DH:
param = ctx->generator;
break;
case DST_ALG_ECDSA256:
case DST_ALG_ECDSA384:
case DST_ALG_ED25519:
@@ -605,27 +643,16 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (!ctx->quiet && show_progress) {
fprintf(stderr, "Generating key pair.");
}
if (ctx->keystore != NULL && ctx->policy != NULL) {
ret = dns_keystore_keygen(
ctx->keystore, name, ctx->policy, ctx->rdclass,
mctx, ctx->alg, ctx->size, flags, &key);
} else if (!ctx->quiet && show_progress) {
ret = dst_key_generate(name, ctx->alg, ctx->size, 0,
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
flags, ctx->protocol,
ctx->rdclass, NULL, mctx, &key,
ctx->rdclass, mctx, &key,
&progress);
} else {
ret = dst_key_generate(name, ctx->alg, ctx->size, 0,
flags, ctx->protocol,
ctx->rdclass, NULL, mctx, &key,
NULL);
}
if (!ctx->quiet && show_progress) {
putc('\n', stderr);
fflush(stderr);
} else {
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
flags, ctx->protocol,
ctx->rdclass, mctx, &key, NULL);
}
if (ret != ISC_R_SUCCESS) {
@@ -681,7 +708,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
if (ctx->setrev) {
if (!ctx->wantksk) {
if (ctx->kskflag == 0) {
fprintf(stderr,
"%s: warning: Key is "
"not flagged as a KSK, but -R "
@@ -700,8 +727,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (ctx->setdel) {
if (ctx->setinact &&
ctx->deltime < ctx->inactive)
{
ctx->deltime < ctx->inactive) {
fprintf(stderr,
"%s: warning: Key is "
"scheduled to be deleted "
@@ -756,9 +782,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
* if there is a risk of ID collision due to this key
* or another key being revoked.
*/
if (key_collision(key, name, ctx->directory, mctx, ctx->tag_min,
ctx->tag_max, NULL))
{
if (key_collision(key, name, ctx->directory, mctx, NULL)) {
conflict = true;
if (null_key) {
dst_key_free(&key);
@@ -823,18 +847,6 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
}
static void
check_keystore_options(keygen_ctx_t *ctx) {
ctx->directory = dns_keystore_directory(ctx->keystore, NULL);
if (ctx->directory != NULL) {
isc_result_t ret = try_dir(ctx->directory);
if (ret != ISC_R_SUCCESS) {
fatal("cannot open directory %s: %s", ctx->directory,
isc_result_totext(ret));
}
}
}
int
main(int argc, char **argv) {
char *algname = NULL, *freeit = NULL;
@@ -843,19 +855,15 @@ main(int argc, char **argv) {
isc_mem_t *mctx = NULL;
isc_result_t ret;
isc_textregion_t r;
const char *engine = NULL;
unsigned char c;
int ch;
bool set_fips_mode = false;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
OSSL_PROVIDER *fips = NULL, *base = NULL;
#endif
keygen_ctx_t ctx = {
.options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC,
.prepub = -1,
.protocol = -1,
.size = -1,
.now = isc_stdtime_now(),
};
if (argc == 1) {
@@ -867,8 +875,8 @@ main(int argc, char **argv) {
/*
* Process memory debugging argument first.
*/
#define CMDLINE_FLAGS \
"3A:a:b:Cc:D:d:E:Ff:GhI:i:K:k:L:l:M:m:n:P:p:qR:r:S:s:" \
#define CMDLINE_FLAGS \
"3A:a:b:Cc:D:d:E:eFf:Gg:hI:i:K:k:L:l:m:n:P:p:qR:r:S:s:" \
"T:t:v:V"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -893,6 +901,7 @@ main(int argc, char **argv) {
isc_commandline_reset = true;
isc_mem_create(&mctx);
isc_stdtime_get(&ctx.now);
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -921,21 +930,30 @@ main(int argc, char **argv) {
}
break;
case 'E':
fatal("%s", isc_result_totext(DST_R_NOENGINE));
engine = isc_commandline_argument;
break;
case 'e':
fprintf(stderr, "phased-out option -e "
"(was 'use (RSA) large exponent')\n");
break;
case 'f':
c = (unsigned char)(isc_commandline_argument[0]);
if (toupper(c) == 'K') {
ctx.wantksk = true;
} else if (toupper(c) == 'Z') {
ctx.wantzsk = true;
ctx.kskflag = DNS_KEYFLAG_KSK;
} else if (toupper(c) == 'R') {
ctx.wantrev = true;
ctx.revflag = DNS_KEYFLAG_REVOKE;
} else {
fatal("unknown flag '%s'",
isc_commandline_argument);
}
break;
case 'g':
ctx.generator = strtol(isc_commandline_argument, &endp,
10);
if (*endp != '\0' || ctx.generator <= 0) {
fatal("-g requires a positive number");
}
break;
case 'K':
ctx.directory = isc_commandline_argument;
ret = try_dir(ctx.directory);
@@ -957,29 +975,13 @@ main(int argc, char **argv) {
case 'n':
ctx.nametype = isc_commandline_argument;
break;
case 'M': {
unsigned long ul;
ctx.tag_min = ul = strtoul(isc_commandline_argument,
&endp, 10);
if (*endp != ':' || ul > 0xffff) {
fatal("-M range invalid");
}
ctx.tag_max = ul = strtoul(endp + 1, &endp, 10);
if (*endp != '\0' || ul > 0xffff ||
ctx.tag_max <= ctx.tag_min)
{
fatal("-M range invalid");
}
break;
}
case 'm':
break;
case 'p':
ctx.protocol = strtol(isc_commandline_argument, &endp,
10);
if (*endp != '\0' || ctx.protocol < 0 ||
ctx.protocol > 255)
{
ctx.protocol > 255) {
fatal("-p must be followed by a number "
"[0..255]");
}
@@ -995,8 +997,7 @@ main(int argc, char **argv) {
ctx.signatory = strtol(isc_commandline_argument, &endp,
10);
if (*endp != '\0' || ctx.signatory < 0 ||
ctx.signatory > 15)
{
ctx.signatory > 15) {
fatal("-s must be followed by a number "
"[0..15]");
}
@@ -1107,8 +1108,8 @@ main(int argc, char **argv) {
ctx.prepub = strtottl(isc_commandline_argument);
break;
case 'F':
set_fips_mode = true;
break;
/* Reserved for FIPS mode */
FALLTHROUGH;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
@@ -1126,7 +1127,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -1134,36 +1135,12 @@ main(int argc, char **argv) {
ctx.quiet = true;
}
if (set_fips_mode) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
fips = OSSL_PROVIDER_load(NULL, "fips");
if (fips == NULL) {
ERR_clear_error();
fatal("Failed to load FIPS provider");
}
base = OSSL_PROVIDER_load(NULL, "base");
if (base == NULL) {
OSSL_PROVIDER_unload(fips);
ERR_clear_error();
fatal("Failed to load base provider");
}
#endif
if (!isc_fips_mode()) {
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
fatal("setting FIPS mode failed");
}
}
ret = dst_lib_init(mctx, engine);
if (ret != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s", isc_result_totext(ret));
}
/*
* The DST subsystem will set FIPS mode if requested at build time.
* The minimum sizes are both raised to 2048.
*/
if (isc_fips_mode()) {
min_rsa = min_dh = 2048;
}
setup_logging();
setup_logging(mctx, &lctx);
ctx.rdclass = strtoclass(classname);
@@ -1214,8 +1191,8 @@ main(int argc, char **argv) {
if (ctx.size != -1) {
fatal("-k and -b cannot be used together");
}
if (ctx.wantrev) {
fatal("-k and -fR cannot be used together");
if (ctx.kskflag || ctx.revflag) {
fatal("-k and -f cannot be used together");
}
if (ctx.options & DST_TYPE_KEY) {
fatal("-k and -T KEY cannot be used together");
@@ -1230,13 +1207,12 @@ main(int argc, char **argv) {
ctx.use_nsec3 = false;
ctx.alg = DST_ALG_ECDSA256;
ctx.size = 0;
ctx.kskflag = DNS_KEYFLAG_KSK;
ctx.ttl = 3600;
ctx.setttl = true;
ctx.ksk = true;
ctx.zsk = true;
ctx.lifetime = 0;
ctx.tag_min = 0;
ctx.tag_max = 0xffff;
keygen(&ctx, mctx, argc, argv);
} else {
@@ -1245,7 +1221,7 @@ main(int argc, char **argv) {
dns_kasp_t *kasp = NULL;
dns_kasp_key_t *kaspkey = NULL;
RUNTIME_CHECK(cfg_parser_create(mctx, &parser) ==
RUNTIME_CHECK(cfg_parser_create(mctx, lctx, &parser) ==
ISC_R_SUCCESS);
if (cfg_parse_file(parser, ctx.configfile,
&cfg_type_namedconf,
@@ -1256,8 +1232,7 @@ main(int argc, char **argv) {
ctx.policy, ctx.configfile);
}
kasp_from_conf(config, mctx, ctx.policy, ctx.directory,
&kasp);
kasp_from_conf(config, mctx, ctx.policy, &kasp);
if (kasp == NULL) {
fatal("failed to load dnssec-policy '%s'",
ctx.policy);
@@ -1271,28 +1246,22 @@ main(int argc, char **argv) {
ctx.ttl = dns_kasp_dnskeyttl(kasp);
ctx.setttl = true;
for (kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
kaspkey != NULL;
kaspkey = ISC_LIST_NEXT(kaspkey, link))
{
kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
while (kaspkey != NULL) {
ctx.use_nsec3 = false;
ctx.alg = dns_kasp_key_algorithm(kaspkey);
ctx.size = dns_kasp_key_size(kaspkey);
ctx.kskflag = dns_kasp_key_ksk(kaspkey)
? DNS_KEYFLAG_KSK
: 0;
ctx.ksk = dns_kasp_key_ksk(kaspkey);
ctx.zsk = dns_kasp_key_zsk(kaspkey);
ctx.lifetime = dns_kasp_key_lifetime(kaspkey);
ctx.keystore = dns_kasp_key_keystore(kaspkey);
if (ctx.keystore != NULL) {
check_keystore_options(&ctx);
}
ctx.tag_min = dns_kasp_key_tagmin(kaspkey);
ctx.tag_max = dns_kasp_key_tagmax(kaspkey);
if ((ctx.ksk && !ctx.wantksk && ctx.wantzsk) ||
(ctx.zsk && !ctx.wantzsk && ctx.wantksk))
{
continue;
}
keygen(&ctx, mctx, argc, argv);
kaspkey = ISC_LIST_NEXT(kaspkey, link);
}
dns_kasp_detach(&kasp);
@@ -1303,22 +1272,16 @@ main(int argc, char **argv) {
keygen(&ctx, mctx, argc, argv);
}
cleanup_logging(&lctx);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
if (freeit != NULL) {
free(freeit);
}
return 0;
return (0);
}
+22 -29
View File
@@ -21,13 +21,15 @@ dnssec-keygen: DNSSEC key generation tool
Synopsis
~~~~~~~~
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-f** flag] [**-F**] [**-G**] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-M** tag_min:tag_max] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-q**] [**-R** date/offset] [**-S** key] [**-s** strength] [**-T** rrtype] [**-t** type] [**-V**] [**-v** level] {name}
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-g** generator] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-q**] [**-R** date/offset] [**-S** key] [**-s** strength] [**-T** rrtype] [**-t** type] [**-V**] [**-v** level] {name}
Description
~~~~~~~~~~~
:program:`dnssec-keygen` generates keys for DNSSEC (Secure DNS), as defined in
:rfc:`2535` and :rfc:`4034`.
:rfc:`2535` and :rfc:`4034`. It can also generate keys for use with TSIG
(Transaction Signatures) as defined in :rfc:`2845`, or TKEY (Transaction
Key) as defined in :rfc:`2930`.
The ``name`` of the key is specified on the command line. For DNSSEC
keys, this must match the name of the zone for which the key is being
@@ -47,7 +49,9 @@ Options
This option selects the cryptographic algorithm. For DNSSEC keys, the value of
``algorithm`` must be one of RSASHA1, NSEC3RSASHA1, RSASHA256,
RSASHA512, ECDSAP256SHA256, ECDSAP384SHA384, ED25519, or ED448.
RSASHA512, ECDSAP256SHA256, ECDSAP384SHA384, ED25519, or ED448. For
TKEY, the value must be DH (Diffie-Hellman); specifying this value
automatically sets the :option:`-T KEY <-T>` option as well.
These values are case-insensitive. In some cases, abbreviations are
supported, such as ECDSA256 for ECDSAP256SHA256 and ECDSA384 for
@@ -94,28 +98,30 @@ Options
and 4096 bits. This option is ignored for algorithms ECDSAP256SHA256,
ECDSAP384SHA384, ED25519, and ED448.
.. option:: -E engine
This option specifies the cryptographic hardware to use, when applicable.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -f flag
This option sets the specified flag in the flag field of the KEY/DNSKEY record.
The only recognized flags are ZSK (Zone-Signing Key), KSK (Key-Signing Key)
and REVOKE.
Note that ZSK is not a physical flag in the DNSKEY record, it is merely used
to explicitly tell that you want to create a ZSK. Setting :option:`-f` in
conjunction with :option:`-k` will result in generating keys that only
match the given role set with this option.
.. option:: -F
This options turns on FIPS (US Federal Information Processing Standards)
mode if the underlying crytographic library supports running in FIPS
mode.
The only recognized flags are KSK (Key-Signing Key) and REVOKE.
.. option:: -G
This option generates a key, but does not publish it or sign with it. This option is
incompatible with :option:`-P` and :option:`-A`.
.. option:: -g generator
This option indicates the generator to use if generating a Diffie-Hellman key. Allowed
values are 2 and 5. If no generator is specified, a known prime from
:rfc:`2539` is used if possible; otherwise the default is 2.
.. option:: -h
This option prints a short summary of the options and arguments to
@@ -150,19 +156,6 @@ Options
This option provides a configuration file that contains a ``dnssec-policy`` statement
(matching the policy set with :option:`-k`).
.. option:: -M tag_min:tag_max
This option sets the range of acceptable key tag values that ``dnssec-keygen``
will produce. If the key tag of the new key or the key tag of
the revoked version of the new key is outside this range,
the new key will be rejected and another new key will be generated.
This is designed to be used when generating keys in a multi-signer
scenario, where each operator is given a range of key tags to
prevent collisions among different operators. The valid values
for ``tag_min`` and ``tag_max`` are [0..65535]. The default allows all
key tag values to be produced. This option is ignored when ``-k policy``
is specified.
.. option:: -n nametype
This option specifies the owner type of the key. The value of ``nametype`` must
File diff suppressed because it is too large Load Diff
-164
View File
@@ -1,164 +0,0 @@
.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
..
.. SPDX-License-Identifier: MPL-2.0
..
.. 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 https://mozilla.org/MPL/2.0/.
..
.. See the COPYRIGHT file distributed with this work for additional
.. information regarding copyright ownership.
.. highlight: console
.. iscman:: dnssec-ksr
.. program:: dnssec-ksr
.. _man_dnssec-ksr:
dnssec-ksr - Create signed key response (SKR) files for offline KSK setups
--------------------------------------------------------------------------
Synopsis
~~~~~~~~
:program:`dnssec-ksr` [**-e** date/offset] [**-F**] [**-f** file] [**-h**] [**-i** date/offset] [**-K** directory] [**-k** policy] [**-l** file] [**-o**] [**-V**] [**-v** level] {command} {zone}
Description
~~~~~~~~~~~
The :program:`dnssec-ksr` can be used to issue several commands that are needed
to generate presigned RRsets for a zone where the private key file of the Key
Signing Key (KSK) is typically offline. This requires Zone Signing Keys
(ZSKs) to be pregenerated, and the DNSKEY, CDNSKEY, and CDS RRsets to be
already signed in advance.
The latter is done by creating Key Signing Requests (KSRs) that can be imported
to the environment where the KSK is available. Once there, this program can
create Signed Key Responses (SKRs) that can be loaded by an authoritative DNS
server.
Options
~~~~~~~
.. option:: -e date/offset
This option sets the end date for which keys or SKRs need to be generated
(depending on the command).
.. option:: -F
This options turns on FIPS (US Federal Information Processing Standards)
mode if the underlying crytographic library supports running in FIPS
mode.
.. option:: -f
This option sets the SKR file to be signed when issuing a ``sign`` command.
.. option:: -h
This option prints a short summary of the options and arguments to
:program:`dnssec-ksr`.
.. option:: -i date/offset
This option sets the start date for which keys or SKRs need to be generated
(depending on the command).
.. option:: -K directory
This option sets the directory in which the key files are to be read or
written (depending on the command).
.. option:: -k policy
This option sets the specific ``dnssec-policy`` for which keys need to
be generated, or signed.
.. option:: -l file
This option provides a configuration file that contains a ``dnssec-policy``
statement (matching the policy set with :option:`-k`).
.. option:: -o
Normally when pregenerating keys, ZSKs are created. When this option is
set, create KSKs instead.
.. option:: -V
This option prints version information.
.. option:: -v level
This option sets the debugging level. Level 1 is intended to be usefully
verbose for general users; higher levels are intended for developers.
``command``
The KSR command to be executed. See below for the available commands.
``zone``
The name of the zone for which the KSR command is being executed.
Commands
~~~~~~~~
.. option:: keygen
Pregenerate a number of keys, given a DNSSEC policy and an interval. The
number of generated keys depends on the interval and the key lifetime.
.. option:: request
Create a Key Signing Request (KSR), given a DNSSEC policy and an interval.
This will generate a file with a number of key bundles, where each bundle
contains the currently published ZSKs (according to the timing metadata).
.. option:: sign
Sign a Key Signing Request (KSR), given a DNSSEC policy and an interval,
creating a Signed Key Response (SKR). This will add the corresponding DNSKEY,
CDS, and CDNSKEY records for the KSK that is being used for signing.
Exit Status
~~~~~~~~~~~
The :program:`dnssec-ksr` command exits 0 on success, or non-zero if an error
occurred.
Examples
~~~~~~~~
When you need to generate ZSKs for the zone "example.com" for the next year,
given a ``dnssec-policy`` named "mypolicy":
::
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf keygen example.com
Creating a KSR for the same zone and period can be done with:
::
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf request example.com > ksr.txt
Typically you would now transfer the KSR to the system that has access to
the KSK.
Signing the KSR created above can be done with:
::
dnssec-ksr -i now -e +1y -k kskpolicy -l named.conf -f ksr.txt sign example.com
Make sure that the DNSSEC parameters in ``kskpolicy`` match those
in ``mypolicy``.
See Also
~~~~~~~~
:iscman:`dnssec-keygen(8) <dnssec-keygen>`,
:iscman:`dnssec-signzone(8) <dnssec-signzone>`,
BIND 9 Administrator Reference Manual.
+18 -8
View File
@@ -24,6 +24,7 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -38,7 +39,7 @@ const char *program = "dnssec-revoke";
static isc_mem_t *mctx = NULL;
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -46,6 +47,7 @@ usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
fprintf(stderr, " -f: force overwrite\n");
fprintf(stderr, " -h: help\n");
fprintf(stderr, " -K directory: use directory for key files\n");
@@ -57,12 +59,13 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
main(int argc, char **argv) {
isc_result_t result;
const char *engine = NULL;
char const *filename = NULL;
char *dir = NULL;
char newname[1024], oldname[1024];
@@ -87,7 +90,7 @@ main(int argc, char **argv) {
while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) {
switch (ch) {
case 'E':
fatal("%s", isc_result_totext(DST_R_NOENGINE));
engine = isc_commandline_argument;
break;
case 'f':
force = true;
@@ -128,13 +131,12 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
if (argc < isc_commandline_index + 1 ||
argv[isc_commandline_index] == NULL)
{
argv[isc_commandline_index] == NULL) {
fatal("The key file name was not specified");
}
if (argc > isc_commandline_index + 1) {
@@ -157,6 +159,12 @@ main(int argc, char **argv) {
}
}
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("Could not initialize dst: %s",
isc_result_totext(result));
}
result = dst_key_fromnamedfile(
filename, dir, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, mctx, &key);
if (result != ISC_R_SUCCESS) {
@@ -182,7 +190,7 @@ main(int argc, char **argv) {
flags = dst_key_flags(key);
if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
if ((flags & DNS_KEYFLAG_KSK) == 0) {
fprintf(stderr,
@@ -192,6 +200,7 @@ main(int argc, char **argv) {
program);
}
isc_stdtime_get(&now);
dst_key_settime(key, DST_TIME_REVOKE, now);
dst_key_setflags(key, flags | DNS_KEYFLAG_REVOKE);
@@ -240,6 +249,7 @@ main(int argc, char **argv) {
cleanup:
dst_key_free(&key);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
@@ -248,5 +258,5 @@ cleanup:
}
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+9 -1
View File
@@ -21,7 +21,7 @@ dnssec-revoke - set the REVOKED bit on a DNSSEC key
Synopsis
~~~~~~~~
:program:`dnssec-revoke` [**-hr**] [**-v** level] [**-V**] [**-K** directory] [**-f**] [**-R**] {keyfile}
:program:`dnssec-revoke` [**-hr**] [**-v** level] [**-V**] [**-K** directory] [**-E** engine] [**-f**] [**-R**] {keyfile}
Description
~~~~~~~~~~~
@@ -53,6 +53,14 @@ Options
This option prints version information.
.. option:: -E engine
This option specifies the cryptographic hardware to use, when applicable.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -f
This option indicates a forced overwrite and causes :program:`dnssec-revoke` to write the new key pair,
+24 -12
View File
@@ -25,14 +25,15 @@
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
#include <isc/util.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dst/dst.h>
@@ -42,7 +43,7 @@ const char *program = "dnssec-settime";
static isc_mem_t *mctx = NULL;
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -51,6 +52,7 @@ usage(void) {
fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
fprintf(stderr, "General options:\n");
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
fprintf(stderr, " -f: force update of old-style "
"keys\n");
fprintf(stderr, " -K directory: set key file location\n");
@@ -100,7 +102,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
static void
@@ -185,6 +187,7 @@ writekey(dst_key_t *key, const char *directory, bool write_state) {
int
main(int argc, char **argv) {
isc_result_t result;
const char *engine = NULL;
const char *filename = NULL;
char *directory = NULL;
char keystr[DST_KEY_FORMATSIZE];
@@ -200,6 +203,7 @@ main(int argc, char **argv) {
int prepub = -1;
int options;
dns_ttl_t ttl = 0;
isc_stdtime_t now;
isc_stdtime_t dstime = 0, dnskeytime = 0;
isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
@@ -226,6 +230,7 @@ main(int argc, char **argv) {
bool epoch = false;
bool changed = false;
bool write_state = false;
isc_log_t *log = NULL;
isc_stdtime_t syncadd = 0, syncdel = 0;
bool unsetsyncadd = false, setsyncadd = false;
bool unsetsyncdel = false, setsyncdel = false;
@@ -234,7 +239,6 @@ main(int argc, char **argv) {
bool unsetdsadd = false, setdsadd = false;
bool unsetdsdel = false, setdsdel = false;
bool printdsadd = false, printdsdel = false;
isc_stdtime_t now = isc_stdtime_now();
options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE | DST_TYPE_STATE;
@@ -244,10 +248,12 @@ main(int argc, char **argv) {
isc_mem_create(&mctx);
setup_logging();
setup_logging(mctx, &log);
isc_commandline_errprint = false;
isc_stdtime_get(&now);
#define CMDLINE_FLAGS "A:D:d:E:fg:hI:i:K:k:L:P:p:R:r:S:suv:Vz:"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -311,7 +317,7 @@ main(int argc, char **argv) {
&setdstime);
break;
case 'E':
fatal("%s", isc_result_totext(DST_R_NOENGINE));
engine = isc_commandline_argument;
break;
case 'f':
force = true;
@@ -533,13 +539,12 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
if (argc < isc_commandline_index + 1 ||
argv[isc_commandline_index] == NULL)
{
argv[isc_commandline_index] == NULL) {
fatal("The key file name was not specified");
}
if (argc > isc_commandline_index + 1) {
@@ -547,11 +552,16 @@ main(int argc, char **argv) {
}
if ((setgoal || setds || setdnskey || setkrrsig || setzrrsig) &&
!write_state)
{
!write_state) {
fatal("Options -g, -d, -k, -r and -z require -s to be set");
}
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("Could not initialize dst: %s",
isc_result_totext(result));
}
if (predecessor != NULL) {
int major, minor;
@@ -943,11 +953,13 @@ main(int argc, char **argv) {
dst_key_free(&prevkey);
}
dst_key_free(&key);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
cleanup_logging(&log);
isc_mem_free(mctx, directory);
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+10 -2
View File
@@ -21,7 +21,7 @@ dnssec-settime: set the key timing metadata for a DNSSEC key
Synopsis
~~~~~~~~
:program:`dnssec-settime` [**-f**] [**-K** directory] [**-L** ttl] [**-P** date/offset] [**-P** ds date/offset] [**-P** sync date/offset] [**-A** date/offset] [**-R** date/offset] [**-I** date/offset] [**-D** date/offset] [**-D** ds date/offset] [**-D** sync date/offset] [**-S** key] [**-i** interval] [**-h**] [**-V**] [**-v** level] {keyfile} [**-s**] [**-g** state] [**-d** state date/offset] [**-k** state date/offset] [**-r** state date/offset] [**-z** state date/offset]
:program:`dnssec-settime` [**-f**] [**-K** directory] [**-L** ttl] [**-P** date/offset] [**-P** ds date/offset] [**-P** sync date/offset] [**-A** date/offset] [**-R** date/offset] [**-I** date/offset] [**-D** date/offset] [**-D** ds date/offset] [**-D** sync date/offset] [**-S** key] [**-i** interval] [**-h**] [**-V**] [**-v** level] [**-E** engine] {keyfile} [**-s**] [**-g** state] [**-d** state date/offset] [**-k** state date/offset] [**-r** state date/offset] [**-z** state date/offset]
Description
~~~~~~~~~~~
@@ -97,6 +97,14 @@ Options
This option sets the debugging level.
.. option:: -E engine
This option specifies the cryptographic hardware to use, when applicable.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
Timing Options
~~~~~~~~~~~~~~
@@ -140,7 +148,7 @@ All these formats are case-insensitive.
.. option:: -A date/offset
This option sets the date on which the key is to be activated. After that date,
the key is included in the zone and used to sign it.
the key is included in the zone and used to sign it.
.. option:: -R date/offset
File diff suppressed because it is too large Load Diff
+15 -29
View File
@@ -21,7 +21,7 @@ dnssec-signzone - DNSSEC zone signing tool
Synopsis
~~~~~~~~
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-e** end-time] [**-f** output-file] [**-F**] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-J** filename] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-g**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
Description
~~~~~~~~~~~
@@ -62,29 +62,20 @@ Options
``$INCLUDE``. This option cannot be combined with :option:`-O raw <-O>`
or serial-number updating.
.. option:: -F
.. option:: -E engine
This options turns on FIPS (US Federal Information Processing Standards)
mode if the underlying crytographic library supports running in FIPS
mode.
This option specifies the hardware to use for cryptographic
operations, such as a secure key store used for signing, when applicable.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -g
This option indicates that DS records for child zones should be generated from a ``dsset-`` or ``keyset-``
file. Existing DS records are removed.
.. option:: -G sync-records
This option indicates which CDS and CDNSKEY records should be generated. ``sync-records`` is a
comma-separated string with the following allowed items: ``cdnskey``, and ``cds:<digest-type>``,
where ``digest-type`` is an allowed algorithm such as SHA-256 (2), or SHA-384 (4).
Only works in combination with smart signing (``-S``).
.. option:: -J filename
This option tells :program:`dnssec-signzone` to read the journal from the given file
when loading the zone file.
.. option:: -K directory
This option specifies the directory to search for DNSSEC keys. If not
@@ -174,11 +165,6 @@ Options
days. Therefore, if any existing RRSIG records are due to expire in
less than 7.5 days, they are replaced.
Note that the calculation of cycle interval is based upon the validity
period of the replacement signatures that would be generated by
``dnssec-signzone``, not on the valid lifetimes of the input RRSIGs being
considered for pre-expiry replacement.
.. option:: -I input-format
This option sets the format of the input zone file. Possible formats are
@@ -274,7 +260,7 @@ Options
with cached copies of the old DNSKEY RRset. The :option:`-Q` option forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
active. This enables ZSK rollover using the procedure described in
:rfc:`6781#section-4.1.1.1` ("Pre-Publish Zone Signing Key Rollover").
:rfc:`4641#4.2.1.1` ("Pre-Publish Key Rollover").
.. option:: -q
@@ -291,7 +277,7 @@ Options
This option is similar to :option:`-Q`, except it forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
published. This enables ZSK rollover using the procedure described in
:rfc:`6781#section-4.1.1.2` ("Double Signature Zone Signing Key
:rfc:`4641#4.2.1.2` ("Double Signature Zone Signing Key
Rollover").
.. option:: -S
@@ -360,12 +346,15 @@ Options
.. option:: -x
This option indicates that BIND 9 should only sign the DNSKEY, CDNSKEY, and CDS RRsets with key-signing keys,
and should omit signatures from zone-signing keys.
and should omit signatures from zone-signing keys. (This is similar to the
``dnssec-dnskey-kskonly yes;`` zone option in :iscman:`named`.)
.. option:: -z
This option indicates that BIND 9 should ignore the KSK flag on keys when determining what to sign. This causes
KSK-flagged keys to sign all records, not just the DNSKEY RRset.
(This is similar to the ``update-check-ksk no;`` zone option in
:iscman:`named`.)
.. option:: -3 salt
@@ -375,7 +364,6 @@ Options
.. note::
``-3 -`` is the recommended configuration. Adding salt provides no practical benefits.
See :rfc:`9276`.
.. option:: -H iterations
@@ -384,7 +372,6 @@ Options
.. warning::
Values greater than 0 cause interoperability issues and also increase the risk of CPU-exhausting DoS attacks.
See :rfc:`9276`.
.. option:: -A
@@ -393,7 +380,6 @@ Options
.. warning::
Do not use this option unless all its implications are fully understood. This option is intended only for extremely large zones (comparable to ``com.``) with sparse secure delegations.
See :rfc:`9276`.
.. option:: -AA
@@ -447,4 +433,4 @@ See Also
~~~~~~~~
:iscman:`dnssec-keygen(8) <dnssec-keygen>`, BIND 9 Administrator Reference Manual, :rfc:`4033`,
:rfc:`6781`.
:rfc:`4641`.
+24 -10
View File
@@ -20,13 +20,14 @@
#include <isc/attributes.h>
#include <isc/base32.h>
#include <isc/commandline.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/rwlock.h>
@@ -43,6 +44,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/nsec.h>
@@ -109,8 +111,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_result_totext(result));
}
result = dns_db_create(mctx, ZONEDB_DEFAULT, 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()");
result = dns_db_load(*db, file, inputformat, 0);
@@ -136,7 +138,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
}
}
ISC_NORETURN static void
noreturn static void
usage(void);
static void
@@ -157,10 +159,12 @@ usage(void) {
fprintf(stderr, "\t-I format:\n");
fprintf(stderr, "\t\tfile format of input zonefile (text)\n");
fprintf(stderr, "\t-c class (IN)\n");
fprintf(stderr, "\t-E engine:\n");
fprintf(stderr, "\t\tname of an OpenSSL engine to use\n");
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
"not ZSKs\n");
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
exit(EXIT_SUCCESS);
exit(0);
}
int
@@ -168,6 +172,8 @@ main(int argc, char *argv[]) {
char *origin = NULL, *file = NULL;
char *inputformatstr = NULL;
isc_result_t result;
isc_log_t *log = NULL;
const char *engine = NULL;
char *classname = NULL;
dns_rdataclass_t rdclass;
char *endp;
@@ -211,7 +217,7 @@ main(int argc, char *argv[]) {
break;
case 'E':
fatal("%s", isc_result_totext(DST_R_NOENGINE));
engine = isc_commandline_argument;
break;
case 'I':
@@ -267,15 +273,21 @@ main(int argc, char *argv[]) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
now = isc_stdtime_now();
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
isc_stdtime_get(&now);
rdclass = strtoclass(classname);
setup_logging();
setup_logging(mctx, &log);
argc -= isc_commandline_index;
argv += isc_commandline_index;
@@ -325,10 +337,12 @@ main(int argc, char *argv[]) {
dns_db_closeversion(gdb, &gversion, false);
dns_db_detach(&gdb);
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
return result == ISC_R_SUCCESS ? 0 : 1;
return (result == ISC_R_SUCCESS ? 0 : 1);
}
+9 -6
View File
@@ -21,7 +21,7 @@ dnssec-verify - DNSSEC zone verification tool
Synopsis
~~~~~~~~
:program:`dnssec-verify` [**-c** class] [**-I** input-format] [**-J** filename] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
Description
~~~~~~~~~~~
@@ -37,6 +37,14 @@ Options
This option specifies the DNS class of the zone.
.. option:: -E engine
This option specifies the cryptographic hardware to use, when applicable.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -I input-format
This option sets the format of the input zone file. Possible formats are ``text``
@@ -45,11 +53,6 @@ Options
format containing updates can be verified independently.
This option is not useful for non-dynamic zones.
.. option:: -J filename
This option tells :program:`dnssec-verify` to read the journal from the given file
when loading the zone file.
.. option:: -o origin
This option indicates the zone origin. If not specified, the name of the zone file is
+102 -150
View File
@@ -20,7 +20,6 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/base32.h>
#include <isc/buffer.h>
@@ -29,12 +28,11 @@
#include <isc/file.h>
#include <isc/heap.h>
#include <isc/list.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
#include <isc/tls.h>
#include <isc/tm.h>
#include <isc/util.h>
@@ -44,6 +42,7 @@
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/nsec.h>
#include <dns/nsec3.h>
@@ -84,7 +83,7 @@ fatal(const char *format, ...) {
if (fatalcallback != NULL) {
(*fatalcallback)();
}
_exit(EXIT_FAILURE);
exit(1);
}
void
@@ -114,7 +113,7 @@ vbprintf(int level, const char *fmt, ...) {
void
version(const char *name) {
printf("%s %s\n", name, PACKAGE_VERSION);
exit(EXIT_SUCCESS);
exit(0);
}
void
@@ -128,8 +127,10 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
}
void
setup_logging(void) {
setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
isc_log_t *log = NULL;
int level;
if (verbose < 0) {
@@ -151,8 +152,10 @@ setup_logging(void) {
break;
}
logconfig = isc_logconfig_get();
isc_log_create(mctx, &log, &logconfig);
isc_log_setcontext(log);
dns_log_init(log);
dns_log_setcontext(log);
isc_log_settag(logconfig, program);
/*
@@ -161,11 +164,36 @@ setup_logging(void) {
* - the program name and logging level are printed
* - no time stamp is printed
*/
isc_log_createandusechannel(
logconfig, "default_stderr", ISC_LOG_TOFILEDESC, level,
ISC_LOGDESTINATION_STDERR,
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL, ISC_LOGCATEGORY_DEFAULT,
ISC_LOGMODULE_DEFAULT);
destination.file.stream = stderr;
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC, level,
&destination,
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
ISC_R_SUCCESS);
*logp = log;
}
void
cleanup_logging(isc_log_t **logp) {
isc_log_t *log;
REQUIRE(logp != NULL);
log = *logp;
*logp = NULL;
if (log == NULL) {
return;
}
isc_log_destroy(&log);
isc_log_setcontext(NULL);
dns_log_setcontext(NULL);
}
static isc_stdtime_t
@@ -173,16 +201,16 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
switch (suffix[0]) {
case 'Y':
case 'y':
return offset * (365 * 24 * 3600);
return (offset * (365 * 24 * 3600));
case 'M':
case 'm':
switch (suffix[1]) {
case 'O':
case 'o':
return offset * (30 * 24 * 3600);
return (offset * (30 * 24 * 3600));
case 'I':
case 'i':
return offset * 60;
return (offset * 60);
case '\0':
fatal("'%s' ambiguous: use 'mi' for minutes "
"or 'mo' for months",
@@ -194,29 +222,29 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
break;
case 'W':
case 'w':
return offset * (7 * 24 * 3600);
return (offset * (7 * 24 * 3600));
case 'D':
case 'd':
return offset * (24 * 3600);
return (offset * (24 * 3600));
case 'H':
case 'h':
return offset * 3600;
return (offset * 3600);
case 'S':
case 's':
case '\0':
return offset;
return (offset);
default:
fatal("time value %s is invalid", str);
}
UNREACHABLE();
return 0; /* silence compiler warning */
return (0); /* silence compiler warning */
}
static bool
isnone(const char *str) {
return (strcasecmp(str, "none") == 0) ||
(strcasecmp(str, "never") == 0) ||
(strcasecmp(str, "unset") == 0);
return ((strcasecmp(str, "none") == 0) ||
(strcasecmp(str, "never") == 0) ||
(strcasecmp(str, "unset") == 0));
}
dns_ttl_t
@@ -226,7 +254,7 @@ strtottl(const char *str) {
char *endp;
if (isnone(str)) {
return (dns_ttl_t)0;
return ((dns_ttl_t)0);
}
ttl = strtol(str, &endp, 0);
@@ -234,19 +262,19 @@ strtottl(const char *str) {
fatal("TTL must be numeric");
}
ttl = time_units(ttl, endp, orig);
return ttl;
return (ttl);
}
dst_key_state_t
strtokeystate(const char *str) {
if (isnone(str)) {
return DST_KEY_STATE_NA;
return (DST_KEY_STATE_NA);
}
for (int i = 0; i < KEYSTATES_NVALUES; i++) {
if (keystates[i] != NULL && strcasecmp(str, keystates[i]) == 0)
{
return (dst_key_state_t)i;
return ((dst_key_state_t)i);
}
}
fatal("unknown key state %s", str);
@@ -262,14 +290,18 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
struct tm tm;
if (isnone(str)) {
SET_IF_NOT_NULL(setp, false);
return (isc_stdtime_t)0;
if (setp != NULL) {
*setp = false;
}
return ((isc_stdtime_t)0);
}
SET_IF_NOT_NULL(setp, true);
if (setp != NULL) {
*setp = true;
}
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
return (isc_stdtime_t)0;
return ((isc_stdtime_t)0);
}
/*
@@ -283,8 +315,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
*/
n = strspn(str, "0123456789");
if ((n == 8u || n == 14u) &&
(str[n] == '\0' || str[n] == '-' || str[n] == '+'))
{
(str[n] == '\0' || str[n] == '-' || str[n] == '+')) {
char timestr[15];
strlcpy(timestr, str, sizeof(timestr));
@@ -300,8 +331,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
base = val;
str += n;
} else if (n == 10u &&
(str[n] == '\0' || str[n] == '-' || str[n] == '+'))
{
(str[n] == '\0' || str[n] == '-' || str[n] == '+')) {
base = strtoll(str, &endp, 0);
str += 10;
} else if (strncmp(str, "now", 3) == 0) {
@@ -318,7 +348,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
}
if (str[0] == '\0') {
return (isc_stdtime_t)base;
return ((isc_stdtime_t)base);
} else if (str[0] == '+') {
offset = strtol(str + 1, &endp, 0);
offset = time_units((isc_stdtime_t)offset, endp, orig);
@@ -331,7 +361,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
fatal("time value %s is invalid", orig);
}
return (isc_stdtime_t)val;
return ((isc_stdtime_t)val);
}
dns_rdataclass_t
@@ -341,15 +371,15 @@ strtoclass(const char *str) {
isc_result_t result;
if (str == NULL) {
return dns_rdataclass_in;
return (dns_rdataclass_in);
}
r.base = UNCONST(str);
DE_CONST(str, r.base);
r.length = strlen(str);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
fatal("unknown class %s", str);
}
return rdclass;
return (rdclass);
}
unsigned int
@@ -358,20 +388,20 @@ strtodsdigest(const char *str) {
dns_dsdigest_t alg;
isc_result_t result;
r.base = UNCONST(str);
DE_CONST(str, r.base);
r.length = strlen(str);
result = dns_dsdigest_fromtext(&alg, &r);
if (result != ISC_R_SUCCESS) {
fatal("unknown DS algorithm %s", str);
}
return alg;
return (alg);
}
static int
cmp_dtype(const void *ap, const void *bp) {
int a = *(const uint8_t *)ap;
int b = *(const uint8_t *)bp;
return a - b;
return (a - b);
}
void
@@ -403,7 +433,7 @@ try_dir(const char *dirname) {
if (result == ISC_R_SUCCESS) {
isc_dir_close(&d);
}
return result;
return (result);
}
/*
@@ -443,14 +473,15 @@ set_keyversion(dst_key_t *key) {
* set the creation date
*/
if (major < 1 || (major == 1 && minor <= 2)) {
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
isc_stdtime_get(&now);
dst_key_settime(key, DST_TIME_CREATED, now);
}
}
bool
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact) {
isc_mem_t *mctx, bool *exact) {
isc_result_t result;
bool conflict = false;
dns_dnsseckeylist_t matchkeys;
@@ -458,34 +489,38 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
uint16_t id, oldid;
uint32_t rid, roldid;
dns_secalg_t alg;
isc_stdtime_t now = isc_stdtime_now();
char filename[NAME_MAX];
isc_buffer_t fileb;
isc_stdtime_t now;
SET_IF_NOT_NULL(exact, false);
if (exact != NULL) {
*exact = false;
}
id = dst_key_id(dstkey);
rid = dst_key_rid(dstkey);
alg = dst_key_alg(dstkey);
if (min != max) {
if (id < min || id > max) {
fprintf(stderr, "Key ID %d outside of [%u..%u]\n", id,
min, max);
return true;
}
if (rid < min || rid > max) {
fprintf(stderr,
"Revoked Key ID %d (for tag %d) outside of "
"[%u..%u]\n",
rid, id, min, max);
return true;
/*
* For Diffie Hellman just check if there is a direct collision as
* they can't be revoked. Additionally dns_dnssec_findmatchingkeys
* only handles DNSKEY which is not used for HMAC.
*/
if (alg == DST_ALG_DH) {
isc_buffer_init(&fileb, filename, sizeof(filename));
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE, dir,
&fileb);
if (result != ISC_R_SUCCESS) {
return (true);
}
return (isc_file_exists(filename));
}
ISC_LIST_INIT(matchkeys);
result = dns_dnssec_findmatchingkeys(name, NULL, dir, NULL, now, mctx,
&matchkeys);
isc_stdtime_get(&now);
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
if (result == ISC_R_NOTFOUND) {
return false;
return (false);
}
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
@@ -529,7 +564,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_dnsseckey_destroy(mctx, &key);
}
return conflict;
return (conflict);
}
bool
@@ -544,9 +579,9 @@ isoptarg(const char *arg, char **argv, void (*usage)(void)) {
isc_commandline_argument = argv[isc_commandline_index];
/* skip to next argument */
isc_commandline_index++;
return true;
return (true);
}
return false;
return (false);
}
void
@@ -586,86 +621,3 @@ loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *file) {
cleanup:
dns_journal_destroy(&jnl);
}
void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
const char *keydir, dns_kasp_t **kaspp) {
isc_result_t result = ISC_R_NOTFOUND;
const cfg_listelt_t *element;
const cfg_obj_t *kasps = NULL;
dns_kasp_t *kasp = NULL, *kasp_next;
dns_kasplist_t kasplist;
const cfg_obj_t *keystores = NULL;
dns_keystore_t *ks = NULL, *ks_next;
dns_keystorelist_t kslist;
ISC_LIST_INIT(kasplist);
ISC_LIST_INIT(kslist);
(void)cfg_map_get(config, "key-store", &keystores);
for (element = cfg_list_first(keystores); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
ks = NULL;
result = cfg_keystore_fromconfig(kconfig, mctx, &kslist, NULL);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure key-store '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
}
/* Default key-directory key store. */
ks = NULL;
(void)cfg_keystore_fromconfig(NULL, mctx, &kslist, &ks);
INSIST(ks != NULL);
if (keydir != NULL) {
/* '-K keydir' takes priority */
dns_keystore_setdirectory(ks, keydir);
}
dns_keystore_detach(&ks);
(void)cfg_map_get(config, "dnssec-policy", &kasps);
for (element = cfg_list_first(kasps); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
kasp = NULL;
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
name) != 0)
{
continue;
}
result = cfg_kasp_fromconfig(kconfig, NULL, true, mctx, &kslist,
&kasplist, &kasp);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure dnssec-policy '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
INSIST(kasp != NULL);
dns_kasp_freeze(kasp);
break;
}
*kaspp = kasp;
/*
* Cleanup kasp list.
*/
for (kasp = ISC_LIST_HEAD(kasplist); kasp != NULL; kasp = kasp_next) {
kasp_next = ISC_LIST_NEXT(kasp, link);
ISC_LIST_UNLINK(kasplist, kasp, link);
dns_kasp_detach(&kasp);
}
/*
* Cleanup keystore list.
*/
for (ks = ISC_LIST_HEAD(kslist); ks != NULL; ks = ks_next) {
ks_next = ISC_LIST_NEXT(ks, link);
ISC_LIST_UNLINK(kslist, ks, link);
dns_keystore_detach(&ks);
}
}
+7 -16
View File
@@ -20,18 +20,10 @@
#include <isc/log.h>
#include <isc/stdtime.h>
#include <dns/kasp.h>
#include <dns/rdatastruct.h>
#include <dst/dst.h>
#include <isccfg/cfg.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#define MAX_RSA 4096 /* should be long enough... */
#define MAX_DH 4096 /* should be long enough... */
/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
*/
extern int verbose;
@@ -54,7 +46,7 @@ extern uint8_t dtype[8];
typedef void(fatalcallback_t)(void);
ISC_NORETURN void
noreturn void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
void
@@ -66,7 +58,7 @@ check_result(isc_result_t result, const char *message);
void
vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
ISC_NORETURN void
noreturn void
version(const char *program);
void
@@ -75,7 +67,10 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
(DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
void
setup_logging(void);
setup_logging(isc_mem_t *mctx, isc_log_t **logp);
void
cleanup_logging(isc_log_t **logp);
dns_ttl_t
strtottl(const char *str);
@@ -106,14 +101,10 @@ set_keyversion(dst_key_t *key);
bool
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact);
isc_mem_t *mctx, bool *exact);
bool
isoptarg(const char *arg, char **argv, void (*usage)(void));
void
loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *journal);
void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
const char *keydir, dns_kasp_t **kaspp);
+4 -2
View File
@@ -7,6 +7,7 @@ AM_CPPFLAGS += \
$(LIBNS_CFLAGS) \
$(LIBISCCC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(LIBCAP_CFLAGS) \
$(LMDB_CFLAGS) \
@@ -38,8 +39,8 @@ AM_CPPFLAGS += \
sbin_PROGRAMS = named
nodist_named_SOURCES = xsl.c
BUILT_SOURCES += xsl.c
CLEANFILES += xsl.c
BUILT_SOURCES = xsl.c
CLEANFILES = xsl.c
EXTRA_DIST = bind9.xsl
@@ -102,6 +103,7 @@ named_LDADD = \
$(LIBNS_LIBS) \
$(LIBISCCC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS) \
$(OPENSSL_LIBS) \
$(LIBCAP_LIBS) \
$(LMDB_LIBS) \
+123 -58
View File
@@ -15,7 +15,7 @@
<xsl:output method="html" indent="yes" version="4.0"/>
<!-- the version number **below** must match version in bin/named/statschannel.c -->
<!-- don't forget to update "/xml/v<STATS_XML_VERSION_MAJOR>" in the HTTP endpoints listed below -->
<xsl:template match="statistics[@version=&quot;3.14&quot;]">
<xsl:template match="statistics[@version=&quot;3.12&quot;]">
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
@@ -156,6 +156,29 @@
background-color: #99ddff;
}
table.tasks {
border: 1px solid grey;
width: 500px;
}
table.tasks th {
text-align: center;
border: 1px solid grey;
width: 150px;
}
table.tasks td {
text-align: right;
font-family: monospace;
}
table.tasks td:nth-child(2) {
text-align: center;
}
table.tasks td:nth-child(4) {
text-align: center;
}
table.tasks tr:hover{
background-color: #99ddff;
}
table.netstat {
border: 1px solid grey;
width: 500px;
@@ -303,8 +326,8 @@
<a href="/xml/v3/status">Status</a>,
<a href="/xml/v3/server">Server</a>,
<a href="/xml/v3/zones">Zones</a>,
<a href="/xml/v3/xfrins">Incoming Zone Transfers</a>,
<a href="/xml/v3/net">Network</a>,
<a href="/xml/v3/tasks">Tasks</a>,
<a href="/xml/v3/mem">Memory</a> and
<a href="/xml/v3/traffic">Traffic Size</a></p>
<hr/>
@@ -908,62 +931,84 @@
</xsl:for-each>
</xsl:for-each>
</xsl:if>
<xsl:if test="views/view/xfrins/xfrin">
<xsl:for-each select="views/view">
<h3>Incoming Zone Transfers for View <xsl:value-of select="@name"/></h3>
<table class="xfrins">
<thead>
<tr>
<th>Zone Name</th>
<th>Zone Type</th>
<th>Local Serial</th>
<th>Remote Serial</th>
<th>IXFR</th>
<th>First Refresh</th>
<th>State</th>
<th>Additional Refresh Queued</th>
<th>Local Address</th>
<th>Remote Address</th>
<th>SOA Transport</th>
<th>Transport</th>
<th>TSIG Key Name</th>
<th>Duration (s)</th>
<th>Messages Received</th>
<th>Records Received</th>
<th>Bytes Received</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="xfrins/xfrin">
<xsl:variable name="css-class16">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$css-class16}">
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="serial"/></td>
<td><xsl:value-of select="remoteserial"/></td>
<td><xsl:value-of select="ixfr"/></td>
<td><xsl:value-of select="firstrefresh"/></td>
<td><xsl:value-of select="state"/></td>
<td><xsl:value-of select="refreshqueued"/></td>
<td><xsl:value-of select="localaddr"/></td>
<td><xsl:value-of select="remoteaddr"/></td>
<td><xsl:value-of select="soatransport"/></td>
<td><xsl:value-of select="transport"/></td>
<td><xsl:value-of select="tsigkeyname"/></td>
<td><xsl:value-of select="duration"/></td>
<td><xsl:value-of select="nmsg"/></td>
<td><xsl:value-of select="nrecs"/></td>
<td><xsl:value-of select="nbytes"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
<xsl:if test="taskmgr/thread-model/type">
<h2>Task Manager Configuration</h2>
<table class="counters">
<tr>
<th class="even">Thread-Model</th>
<td>
<xsl:value-of select="taskmgr/thread-model/type"/>
</td>
</tr>
<tr class="odd">
<th>Worker Threads</th>
<td>
<xsl:value-of select="taskmgr/thread-model/worker-threads"/>
</td>
</tr>
<tr class="even">
<th>Default Quantum</th>
<td>
<xsl:value-of select="taskmgr/thread-model/default-quantum"/>
</td>
</tr>
<tr class="odd">
<th>Tasks Running</th>
<td>
<xsl:value-of select="taskmgr/thread-model/tasks-running"/>
</td>
</tr>
<tr class="even">
<th>Tasks Ready</th>
<td>
<xsl:value-of select="taskmgr/thread-model/tasks-ready"/>
</td>
</tr>
</table>
<br/>
</xsl:if>
<xsl:if test="taskmgr/tasks/task">
<h2>Tasks</h2>
<table class="tasks">
<tr>
<th>ID</th>
<th>Name</th>
<th>References</th>
<th>State</th>
<th>Quantum</th>
<th>Events</th>
</tr>
<xsl:for-each select="taskmgr/tasks/task">
<xsl:sort select="name"/>
<xsl:variable name="css-class14">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$css-class14}">
<td>
<xsl:value-of select="id"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="references"/>
</td>
<td>
<xsl:value-of select="state"/>
</td>
<td>
<xsl:value-of select="quantum"/>
</td>
<td>
<xsl:value-of select="events"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
</xsl:if>
<xsl:if test="memory/summary">
<h2>Memory Usage Summary</h2>
@@ -994,7 +1039,12 @@
<th>ID</th>
<th>Name</th>
<th>References</th>
<th>TotalUse</th>
<th>InUse</th>
<th>MaxUse</th>
<th>Malloced</th>
<th>MaxMalloced</th>
<th>BlockSize</th>
<th>Pools</th>
<th>HiWater</th>
<th>LoWater</th>
@@ -1017,9 +1067,24 @@
<td>
<xsl:value-of select="references"/>
</td>
<td>
<xsl:value-of select="total"/>
</td>
<td>
<xsl:value-of select="inuse"/>
</td>
<td>
<xsl:value-of select="maxinuse"/>
</td>
<td>
<xsl:value-of select="malloced"/>
</td>
<td>
<xsl:value-of select="maxmalloced"/>
</td>
<td>
<xsl:value-of select="blocksize"/>
</td>
<td>
<xsl:value-of select="pools"/>
</td>
+284 -924
View File
File diff suppressed because it is too large Load Diff
+336 -178
View File
@@ -49,12 +49,17 @@ static char defaultconf[] = "\
options {\n\
answer-cookie true;\n\
automatic-interface-scan yes;\n\
# blackhole {none;};\n\
cookie-algorithm siphash24;\n\
bindkeys-file \"" NAMED_SYSCONFDIR "/bind.keys\";\n\
# blackhole {none;};\n"
" cookie-algorithm siphash24;\n"
" coresize default;\n\
datasize default;\n"
"\
# directory <none>\n\
dnssec-policy \"none\";\n\
dump-file \"named_dump.db\";\n\
edns-udp-size 1232;\n"
edns-udp-size 1232;\n\
files unlimited;\n"
#if defined(HAVE_GEOIP2)
"\
geoip-directory \"" MAXMINDDB_PREFIX "/share/GeoIP\";\n"
@@ -63,9 +68,11 @@ options {\n\
geoip-directory \".\";\n"
#endif /* if defined(HAVE_GEOIP2) */
"\
heartbeat-interval 60;\n\
interface-interval 60;\n\
listen-on {any;};\n\
listen-on-v6 {any;};\n\
# lock-file \"" NAMED_LOCALSTATEDIR "/run/named/named.lock\";\n\
match-mapped-addresses no;\n\
max-ixfr-ratio 100%;\n\
max-rsa-exponent-size 0; /* no limit */\n\
@@ -95,12 +102,11 @@ options {\n\
#endif
"\
prefetch 2 9;\n\
# querylog <boolean>;\n\
recursing-file \"named.recursing\";\n\
recursive-clients 1000;\n\
request-nsid false;\n\
reserved-sockets 512;\n\
resolver-query-timeout 10;\n\
# responselog <boolean>;\n\
rrset-order { order random; };\n\
secroots-file \"named.secroots\";\n\
send-cookie true;\n\
@@ -109,8 +115,8 @@ options {\n\
session-keyalg hmac-sha256;\n\
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
session-keyname local-ddns;\n\
stacksize default;\n\
startup-notify-rate 20;\n\
sig0checks-quota 1;\n\
statistics-file \"named.stats\";\n\
tcp-advertised-timeout 300;\n\
tcp-clients 150;\n\
@@ -120,6 +126,7 @@ options {\n\
tcp-listen-queue 10;\n\
tcp-receive-buffer 0;\n\
tcp-send-buffer 0;\n\
# tkey-dhkey <none>\n\
# tkey-domain <none>\n\
# tkey-gssapi-credential <none>\n\
transfer-message-size 20480;\n\
@@ -129,13 +136,10 @@ options {\n\
trust-anchor-telemetry yes;\n\
udp-receive-buffer 0;\n\
udp-send-buffer 0;\n\
update-quota 100;\n\
\n\
/* view */\n\
allow-new-zones no;\n\
allow-notify {none;};\n\
allow-proxy {none;};\n\
allow-proxy-on {any;};\n\
allow-query-cache { localnets; localhost; };\n\
allow-query-cache-on { any; };\n\
allow-recursion { localnets; localhost; };\n\
@@ -148,7 +152,6 @@ options {\n\
check-names response ignore;\n\
check-names secondary warn;\n\
check-spf warn;\n\
check-svcb yes;\n\
clients-per-query 10;\n\
dnssec-accept-expired no;\n\
dnssec-validation " VALIDATION_DEFAULT "; \n"
@@ -168,9 +171,7 @@ options {\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
max-recursion-queries 50;\n\
max-query-count 200;\n\
max-query-restarts 11;\n\
max-recursion-queries 100;\n\
max-stale-ttl 86400; /* 1 day */\n\
message-compression yes;\n\
min-ncache-ttl 0; /* 0 hours */\n\
@@ -189,10 +190,12 @@ options {\n\
recursion true;\n\
request-expire true;\n\
request-ixfr true;\n\
request-ixfr-max-diffs 0;\n\
require-server-cookie no;\n\
resolver-nonbackoff-tries 3;\n\
resolver-retry-interval 800; /* in milliseconds */\n\
root-key-sentinel yes;\n\
servfail-ttl 1;\n\
# sortlist <none>\n\
stale-answer-client-timeout off;\n\
stale-answer-enable false;\n\
stale-answer-ttl 30; /* 30 seconds */\n\
@@ -201,31 +204,34 @@ options {\n\
synth-from-dnssec yes;\n\
# topology <none>\n\
transfer-format many-answers;\n\
resolver-use-dns64 false;\n\
v6-bias 50;\n\
zero-no-soa-ttl-cache no;\n\
\n\
/* zone */\n\
allow-query {any;};\n\
allow-query-on {any;};\n\
allow-transfer {none;};\n\
allow-transfer {any;};\n\
# also-notify <none>\n\
alt-transfer-source *;\n\
alt-transfer-source-v6 *;\n\
check-integrity yes;\n\
check-mx-cname warn;\n\
check-sibling yes;\n\
check-srv-cname warn;\n\
check-wildcard yes;\n\
dialup no;\n\
dnssec-dnskey-kskonly yes;\n\
dnssec-loadkeys-interval 60;\n\
dnssec-secure-to-insecure no;\n\
dnssec-update-mode maintain;\n\
# forward <none>\n\
# forwarders <none>\n\
# inline-signing no;\n\
ixfr-from-differences false;\n\
max-journal-size default;\n\
max-records 0;\n\
max-records-per-type 100;\n\
max-refresh-time 2419200; /* 4 weeks */\n\
max-retry-time 1209600; /* 2 weeks */\n\
max-types-per-name 100;\n\
max-transfer-idle-in 60;\n\
max-transfer-idle-out 60;\n\
max-transfer-time-in 120;\n\
@@ -236,14 +242,16 @@ options {\n\
notify yes;\n\
notify-delay 5;\n\
notify-to-soa no;\n\
send-report-channel .;\n\
serial-update-method increment;\n\
sig-signing-nodes 100;\n\
sig-signing-signatures 10;\n\
sig-signing-type 65534;\n\
sig-validity-interval 30; /* days */\n\
dnskey-sig-validity 0; /* default: sig-validity-interval */\n\
transfer-source *;\n\
transfer-source-v6 *;\n\
try-tcp-refresh yes; /* BIND 8 compat */\n\
update-check-ksk yes;\n\
zero-no-soa-ttl yes;\n\
zone-statistics terse;\n\
};\n\
@@ -294,15 +302,10 @@ dnssec-policy \"default\" {\n\
csk key-directory lifetime unlimited algorithm 13;\n\
};\n\
\n\
cdnskey yes;\n\
cds-digest-types { 2; };\n\
dnskey-ttl " DNS_KASP_KEY_TTL ";\n\
inline-signing yes;\n\
offline-ksk no;\n\
publish-safety " DNS_KASP_PUBLISH_SAFETY "; \n\
retire-safety " DNS_KASP_RETIRE_SAFETY "; \n\
purge-keys " DNS_KASP_PURGE_KEYS "; \n\
signatures-jitter " DNS_KASP_SIG_JITTER "; \n\
signatures-refresh " DNS_KASP_SIG_REFRESH "; \n\
signatures-validity " DNS_KASP_SIG_VALIDITY "; \n\
signatures-validity-dnskey " DNS_KASP_SIG_VALIDITY_DNSKEY "; \n\
@@ -313,9 +316,7 @@ dnssec-policy \"default\" {\n\
};\n\
\n\
dnssec-policy \"insecure\" {\n\
max-zone-ttl 0; \n\
keys { };\n\
inline-signing yes;\n\
};\n\
\n\
"
@@ -331,15 +332,15 @@ dnssec-policy \"insecure\" {\n\
"# END TRUST ANCHORS\n\
\n\
remote-servers " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
2801:1b8:10::b; # b.root-servers.net\n\
primaries " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
2001:500:200::b; # b.root-servers.net\n\
2001:500:2::c; # c.root-servers.net\n\
2001:500:2f::f; # f.root-servers.net\n\
2001:500:12::d0d; # g.root-servers.net\n\
2001:7fd::1; # k.root-servers.net\n\
2620:0:2830:202::132; # xfr.cjr.dns.icann.org\n\
2620:0:2d0:202::132; # xfr.lax.dns.icann.org\n\
170.247.170.2; # b.root-servers.net\n\
199.9.14.201; # b.root-servers.net\n\
192.33.4.12; # c.root-servers.net\n\
192.5.5.241; # f.root-servers.net\n\
192.112.36.4; # g.root-servers.net\n\
@@ -355,15 +356,13 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
isc_buffer_add(&b, sizeof(defaultconf) - 1);
return cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
CFG_PCTX_NOEXPERIMENTAL,
conf);
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED, conf));
}
const char *
named_config_getdefault(void) {
return defaultconf;
return (defaultconf);
}
isc_result_t
@@ -373,10 +372,10 @@ named_config_get(cfg_obj_t const *const *maps, const char *name,
for (i = 0; maps[i] != NULL; i++) {
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
}
return ISC_R_NOTFOUND;
return (ISC_R_NOTFOUND);
}
isc_result_t
@@ -395,14 +394,13 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
for (i = 0; maps[i] != NULL; i++) {
checknames = NULL;
if (cfg_map_get(maps[i], "check-names", &checknames) ==
ISC_R_SUCCESS)
{
ISC_R_SUCCESS) {
/*
* Zone map entry is not a list.
*/
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
for (element = cfg_list_first(checknames);
element != NULL; element = cfg_list_next(element))
@@ -412,17 +410,16 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
for (size_t j = 0; names[j] != NULL; j++) {
if (strcasecmp(cfg_obj_asstring(type),
names[j]) == 0)
{
names[j]) == 0) {
*obj = cfg_tuple_get(value,
"mode");
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
}
}
}
}
return ISC_R_NOTFOUND;
return (ISC_R_NOTFOUND);
}
int
@@ -434,7 +431,7 @@ named_config_listcount(const cfg_obj_t *list) {
i++;
}
return i;
return (i);
}
isc_result_t
@@ -445,16 +442,16 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
if (!cfg_obj_isstring(classobj)) {
*classp = defclass;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
r.base = UNCONST(cfg_obj_asstring(classobj));
DE_CONST(cfg_obj_asstring(classobj), r.base);
r.length = strlen(r.base);
result = dns_rdataclass_fromtext(classp, &r);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(classobj, ISC_LOG_ERROR, "unknown class '%s'",
r.base);
cfg_obj_log(classobj, named_g_lctx, ISC_LOG_ERROR,
"unknown class '%s'", r.base);
}
return result;
return (result);
}
isc_result_t
@@ -465,16 +462,16 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
if (!cfg_obj_isstring(typeobj)) {
*typep = deftype;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
r.base = UNCONST(cfg_obj_asstring(typeobj));
DE_CONST(cfg_obj_asstring(typeobj), r.base);
r.length = strlen(r.base);
result = dns_rdatatype_fromtext(typep, &r);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(typeobj, ISC_LOG_ERROR, "unknown type '%s'",
r.base);
cfg_obj_log(typeobj, named_g_lctx, ISC_LOG_ERROR,
"unknown type '%s'", r.base);
}
return result;
return (result);
}
dns_zonetype_t
@@ -486,8 +483,7 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
if (strcasecmp(str, "primary") == 0 || strcasecmp(str, "master") == 0) {
ztype = dns_zone_primary;
} else if (strcasecmp(str, "secondary") == 0 ||
strcasecmp(str, "slave") == 0)
{
strcasecmp(str, "slave") == 0) {
ztype = dns_zone_secondary;
} else if (strcasecmp(str, "mirror") == 0) {
ztype = dns_zone_mirror;
@@ -500,12 +496,115 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
} else {
UNREACHABLE();
}
return ztype;
return (ztype);
}
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
in_port_t defport, isc_mem_t *mctx,
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
uint32_t *countp) {
int count, i = 0;
const cfg_obj_t *addrlist;
const cfg_obj_t *portobj, *dscpobj;
const cfg_listelt_t *element;
isc_sockaddr_t *addrs;
in_port_t port;
isc_dscp_t dscp = -1, *dscps = NULL;
isc_result_t result;
INSIST(addrsp != NULL && *addrsp == NULL);
INSIST(dscpsp == NULL || *dscpsp == NULL);
INSIST(countp != NULL);
addrlist = cfg_tuple_get(list, "addresses");
count = named_config_listcount(addrlist);
portobj = cfg_tuple_get(list, "port");
if (cfg_obj_isuint32(portobj)) {
uint32_t val = cfg_obj_asuint32(portobj);
if (val > UINT16_MAX) {
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range", val);
return (ISC_R_RANGE);
}
port = (in_port_t)val;
} else if (defport != 0) {
port = defport;
} else {
result = named_config_getport(config, "port", &port);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (dscpsp != NULL) {
dscpobj = cfg_tuple_get(list, "dscp");
if (dscpobj != NULL && cfg_obj_isuint32(dscpobj)) {
if (cfg_obj_asuint32(dscpobj) > 63) {
cfg_obj_log(dscpobj, named_g_lctx,
ISC_LOG_ERROR,
"dscp value '%u' is out of range",
cfg_obj_asuint32(dscpobj));
return (ISC_R_RANGE);
}
dscp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
}
dscps = isc_mem_get(mctx, count * sizeof(isc_dscp_t));
}
addrs = isc_mem_get(mctx, count * sizeof(isc_sockaddr_t));
for (element = cfg_list_first(addrlist); element != NULL;
element = cfg_list_next(element), i++)
{
const cfg_obj_t *addr;
INSIST(i < count);
addr = cfg_listelt_value(element);
addrs[i] = *cfg_obj_assockaddr(addr);
if (dscpsp != NULL) {
isc_dscp_t innerdscp;
innerdscp = cfg_obj_getdscp(addr);
if (innerdscp == -1) {
innerdscp = dscp;
}
dscps[i] = innerdscp;
}
if (isc_sockaddr_getport(&addrs[i]) == 0) {
isc_sockaddr_setport(&addrs[i], port);
}
}
INSIST(i == count);
*addrsp = addrs;
*countp = count;
if (dscpsp != NULL) {
*dscpsp = dscps;
}
return (ISC_R_SUCCESS);
}
void
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
isc_dscp_t **dscpsp, uint32_t count) {
INSIST(addrsp != NULL && *addrsp != NULL);
INSIST(dscpsp == NULL || *dscpsp != NULL);
isc_mem_put(mctx, *addrsp, count * sizeof(isc_sockaddr_t));
*addrsp = NULL;
if (dscpsp != NULL) {
isc_mem_put(mctx, *dscpsp, count * sizeof(isc_dscp_t));
*dscpsp = NULL;
}
}
static isc_result_t
getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
const cfg_obj_t **ret) {
isc_result_t result;
const cfg_obj_t *obj = NULL;
const cfg_listelt_t *elt;
@@ -516,20 +615,36 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
result = cfg_map_get(cctx, list, &obj);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
elt = cfg_list_first(obj);
while (elt != NULL) {
obj = cfg_listelt_value(elt);
if (strcasecmp(cfg_obj_asstring(cfg_tuple_get(obj, "name")),
name) == 0)
{
name) == 0) {
*ret = obj;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
elt = cfg_list_next(elt);
}
return ISC_R_NOTFOUND;
return (ISC_R_NOTFOUND);
}
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
isc_result_t result;
if (strcmp(list, "parental-agents") == 0) {
return (getremotesdef(cctx, list, name, ret));
} else if (strcmp(list, "primaries") == 0) {
result = getremotesdef(cctx, list, name, ret);
if (result != ISC_R_SUCCESS) {
result = getremotesdef(cctx, "masters", name, ret);
}
return (result);
}
return (ISC_R_NOTFOUND);
}
static isc_result_t
@@ -544,7 +659,7 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
if (!cfg_obj_isstring(obj)) {
*namep = NULL;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
*namep = isc_mem_get(mctx, sizeof(**namep));
@@ -559,63 +674,59 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, *namep, sizeof(**namep));
*namep = NULL;
return result;
return (result);
}
dns_name_dup(dns_fixedname_name(&fname), mctx, *namep);
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
#define grow_array(mctx, array, newlen, oldlen) \
if (newlen >= oldlen) { \
array = isc_mem_creget(mctx, array, oldlen, newlen + 16, \
sizeof(array[0])); \
oldlen = newlen + 16; \
#define grow_array(mctx, array, newlen, oldlen) \
if (newlen >= oldlen) { \
size_t newsize = (newlen + 16) * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
ISC_MEM_ZERO); \
oldlen = newlen + 16; \
}
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
array = isc_mem_creget(mctx, array, oldlen, newlen, \
sizeof(array[0])); \
oldlen = newlen; \
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
size_t newsize = newlen * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
ISC_MEM_ZERO); \
oldlen = newlen; \
}
static const char *remotesnames[4] = { "remote-servers", "parental-agents",
"primaries", "masters" };
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
uint32_t addrcount = 0, srccount = 0;
uint32_t keycount = 0, tlscount = 0;
uint32_t listcount = 0, l = 0, i = 0;
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl) {
uint32_t addrcount = 0, dscpcount = 0, keycount = 0, tlscount = 0,
i = 0;
uint32_t listcount = 0, l = 0, j;
uint32_t stackcount = 0, pushed = 0;
isc_result_t result;
const cfg_listelt_t *element;
const cfg_obj_t *addrlist;
const cfg_obj_t *portobj;
const cfg_obj_t *src4obj;
const cfg_obj_t *src6obj;
const cfg_obj_t *dscpobj;
in_port_t port = (in_port_t)0;
in_port_t def_port;
in_port_t def_tlsport;
isc_sockaddr_t src4;
isc_sockaddr_t src6;
isc_dscp_t dscp = -1;
isc_sockaddr_t *addrs = NULL;
isc_sockaddr_t *sources = NULL;
isc_dscp_t *dscps = NULL;
dns_name_t **keys = NULL;
dns_name_t **tlss = NULL;
struct {
const char *name;
in_port_t port;
isc_sockaddr_t *src4s;
isc_sockaddr_t *src6s;
} *lists = NULL;
struct {
const cfg_listelt_t *element;
in_port_t port;
isc_sockaddr_t src4;
isc_sockaddr_t src6;
isc_dscp_t dscp;
} *stack = NULL;
REQUIRE(ipkl != NULL);
@@ -623,6 +734,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
REQUIRE(ipkl->addrs == NULL);
REQUIRE(ipkl->keys == NULL);
REQUIRE(ipkl->tlss == NULL);
REQUIRE(ipkl->dscps == NULL);
REQUIRE(ipkl->labels == NULL);
REQUIRE(ipkl->allocated == 0);
@@ -639,16 +751,20 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
goto cleanup;
}
result = named_config_getdscp(config, &dscp);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
newlist:
addrlist = cfg_tuple_get(list, "addresses");
portobj = cfg_tuple_get(list, "port");
src4obj = cfg_tuple_get(list, "source");
src6obj = cfg_tuple_get(list, "source-v6");
dscpobj = cfg_tuple_get(list, "dscp");
if (cfg_obj_isuint32(portobj)) {
uint32_t val = cfg_obj_asuint32(portobj);
if (val > UINT16_MAX) {
cfg_obj_log(portobj, ISC_LOG_ERROR,
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range", val);
result = ISC_R_RANGE;
goto cleanup;
@@ -656,17 +772,18 @@ newlist:
port = (in_port_t)val;
}
if (src4obj != NULL && cfg_obj_issockaddr(src4obj)) {
src4 = *cfg_obj_assockaddr(src4obj);
} else {
isc_sockaddr_any(&src4);
if (dscpobj != NULL && cfg_obj_isuint32(dscpobj)) {
if (cfg_obj_asuint32(dscpobj) > 63) {
cfg_obj_log(dscpobj, named_g_lctx, ISC_LOG_ERROR,
"dscp value '%u' is out of range",
cfg_obj_asuint32(dscpobj));
result = ISC_R_RANGE;
goto cleanup;
}
dscp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
}
if (src6obj != NULL && cfg_obj_issockaddr(src6obj)) {
src6 = *cfg_obj_assockaddr(src6obj);
} else {
isc_sockaddr_any6(&src6);
}
result = ISC_R_NOMEMORY;
element = cfg_list_first(addrlist);
resume:
@@ -683,7 +800,6 @@ resume:
if (!cfg_obj_issockaddr(addr)) {
const char *listname = cfg_obj_asstring(addr);
isc_result_t tresult;
uint32_t j;
/* Grow lists? */
grow_array(mctx, lists, l, listcount);
@@ -698,22 +814,17 @@ resume:
continue;
}
list = NULL;
tresult = ISC_R_NOTFOUND;
for (size_t n = 0; n < ARRAY_SIZE(remotesnames); n++) {
tresult = named_config_getremotesdef(
config, remotesnames[n], listname,
&list);
if (tresult == ISC_R_SUCCESS) {
break;
}
}
tresult = named_config_getremotesdef(config, listtype,
listname, &list);
if (tresult == ISC_R_NOTFOUND) {
cfg_obj_log(addr, ISC_LOG_ERROR,
"remote-servers \"%s\" not found",
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
"%s \"%s\" not found", listtype,
listname);
result = tresult;
goto cleanup;
}
if (tresult != ISC_R_SUCCESS) {
result = tresult;
goto cleanup;
}
lists[l++].name = listname;
@@ -725,18 +836,21 @@ resume:
*/
stack[pushed].element = cfg_list_next(element);
stack[pushed].port = port;
stack[pushed].src4 = src4;
stack[pushed].src6 = src6;
stack[pushed].dscp = dscp;
pushed++;
goto newlist;
}
grow_array(mctx, addrs, i, addrcount);
grow_array(mctx, dscps, i, dscpcount);
grow_array(mctx, keys, i, keycount);
grow_array(mctx, tlss, i, tlscount);
grow_array(mctx, sources, i, srccount);
addrs[i] = *cfg_obj_assockaddr(addr);
dscps[i] = cfg_obj_getdscp(addr);
if (dscps[i] == -1) {
dscps[i] = dscp;
}
result = named_config_getname(mctx, key, &keys[i]);
if (result != ISC_R_SUCCESS) {
@@ -752,78 +866,63 @@ resume:
goto cleanup;
}
/* If the port is unset, take it from one of the upper levels */
if (isc_sockaddr_getport(&addrs[i]) == 0) {
in_port_t addr_port = port;
/* If unset, use the default port or tls-port */
if (addr_port == 0) {
if (tlss[i] != NULL) {
addr_port = def_tlsport;
} else {
addr_port = def_port;
}
/* Set the default port or tls-port */
if (port == 0) {
if (tlss[i] != NULL) {
port = def_tlsport;
} else {
port = def_port;
}
isc_sockaddr_setport(&addrs[i], addr_port);
}
switch (isc_sockaddr_pf(&addrs[i])) {
case PF_INET:
sources[i] = src4;
break;
case PF_INET6:
sources[i] = src6;
break;
default:
i++; /* Increment here so that cleanup on error works.
*/
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
if (isc_sockaddr_getport(&addrs[i]) == 0) {
isc_sockaddr_setport(&addrs[i], port);
}
i++;
}
if (pushed != 0) {
pushed--;
element = stack[pushed].element;
port = stack[pushed].port;
src4 = stack[pushed].src4;
src6 = stack[pushed].src6;
dscp = stack[pushed].dscp;
goto resume;
}
shrink_array(mctx, addrs, i, addrcount);
shrink_array(mctx, dscps, i, dscpcount);
shrink_array(mctx, keys, i, keycount);
shrink_array(mctx, tlss, i, tlscount);
shrink_array(mctx, sources, i, srccount);
if (lists != NULL) {
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
}
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
}
INSIST(dscpcount == addrcount);
INSIST(keycount == addrcount);
INSIST(tlscount == addrcount);
INSIST(srccount == addrcount);
INSIST(keycount == dscpcount);
ipkl->addrs = addrs;
ipkl->dscps = dscps;
ipkl->keys = keys;
ipkl->tlss = tlss;
ipkl->sources = sources;
ipkl->count = addrcount;
ipkl->allocated = addrcount;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
cleanup:
if (addrs != NULL) {
isc_mem_cput(mctx, addrs, addrcount, sizeof(addrs[0]));
isc_mem_put(mctx, addrs, addrcount * sizeof(addrs[0]));
}
if (dscps != NULL) {
isc_mem_put(mctx, dscps, dscpcount * sizeof(dscps[0]));
}
if (keys != NULL) {
for (size_t j = 0; j < i; j++) {
for (j = 0; j < i; j++) {
if (keys[j] == NULL) {
continue;
}
@@ -832,10 +931,10 @@ cleanup:
}
isc_mem_put(mctx, keys[j], sizeof(*keys[j]));
}
isc_mem_cput(mctx, keys, keycount, sizeof(keys[0]));
isc_mem_put(mctx, keys, keycount * sizeof(keys[0]));
}
if (tlss != NULL) {
for (size_t j = 0; j < i; j++) {
for (j = 0; j < i; j++) {
if (tlss[j] == NULL) {
continue;
}
@@ -844,18 +943,15 @@ cleanup:
}
isc_mem_put(mctx, tlss[j], sizeof(*tlss[j]));
}
isc_mem_cput(mctx, tlss, tlscount, sizeof(tlss[0]));
}
if (sources != NULL) {
isc_mem_cput(mctx, sources, srccount, sizeof(sources[0]));
isc_mem_put(mctx, tlss, tlscount * sizeof(tlss[0]));
}
if (lists != NULL) {
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
}
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
}
return result;
return (result);
}
isc_result_t
@@ -878,12 +974,39 @@ named_config_getport(const cfg_obj_t *config, const char *type,
result = named_config_get(maps, type, &portobj);
INSIST(result == ISC_R_SUCCESS);
if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
cfg_obj_log(portobj, ISC_LOG_ERROR, "port '%u' out of range",
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range",
cfg_obj_asuint32(portobj));
return ISC_R_RANGE;
return (ISC_R_RANGE);
}
*portp = (in_port_t)cfg_obj_asuint32(portobj);
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
isc_result_t
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp) {
const cfg_obj_t *options = NULL;
const cfg_obj_t *dscpobj = NULL;
isc_result_t result;
(void)cfg_map_get(config, "options", &options);
if (options == NULL) {
return (ISC_R_SUCCESS);
}
result = cfg_map_get(options, "dscp", &dscpobj);
if (result != ISC_R_SUCCESS || dscpobj == NULL) {
*dscpp = -1;
return (ISC_R_SUCCESS);
}
if (cfg_obj_asuint32(dscpobj) >= 64) {
cfg_obj_log(dscpobj, named_g_lctx, ISC_LOG_ERROR,
"dscp '%u' out of range",
cfg_obj_asuint32(dscpobj));
return (ISC_R_RANGE);
}
*dscpp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
return (ISC_R_SUCCESS);
}
struct keyalgorithms {
@@ -910,8 +1033,14 @@ struct keyalgorithms {
{ NULL, hmacnone, DST_ALG_UNKNOWN, 0 } };
isc_result_t
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
uint16_t *digestbits) {
return (named_config_getkeyalgorithm2(str, name, NULL, digestbits));
}
isc_result_t
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
unsigned int *typep, uint16_t *digestbits) {
int i;
size_t len = 0;
uint16_t bits;
@@ -927,22 +1056,51 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
}
}
if (algorithms[i].str == NULL) {
return ISC_R_NOTFOUND;
return (ISC_R_NOTFOUND);
}
if (str[len] == '-') {
result = isc_parse_uint16(&bits, str + len + 1, 10);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
if (bits > algorithms[i].size) {
return ISC_R_RANGE;
return (ISC_R_RANGE);
}
} else if (algorithms[i].size == 0) {
bits = 128;
} else {
bits = algorithms[i].size;
}
SET_IF_NOT_NULL(typep, algorithms[i].type);
SET_IF_NOT_NULL(digestbits, bits);
return ISC_R_SUCCESS;
if (name != NULL) {
switch (algorithms[i].hmac) {
case hmacmd5:
*name = dns_tsig_hmacmd5_name;
break;
case hmacsha1:
*name = dns_tsig_hmacsha1_name;
break;
case hmacsha224:
*name = dns_tsig_hmacsha224_name;
break;
case hmacsha256:
*name = dns_tsig_hmacsha256_name;
break;
case hmacsha384:
*name = dns_tsig_hmacsha384_name;
break;
case hmacsha512:
*name = dns_tsig_hmacsha512_name;
break;
default:
UNREACHABLE();
}
}
if (typep != NULL) {
*typep = algorithms[i].type;
}
if (digestbits != NULL) {
*digestbits = bits;
}
return (ISC_R_SUCCESS);
}
+25 -32
View File
@@ -15,8 +15,8 @@
#include <stdbool.h>
#include <isc/event.h>
#include <isc/lex.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -44,23 +44,23 @@ getcommand(isc_lex_t *lex, char **cmdp) {
result = isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
isc_lex_ungettoken(lex, &token);
if (token.type != isc_tokentype_string) {
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
*cmdp = token.value.as_textregion.base;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static bool
command_compare(const char *str, const char *command) {
return strcasecmp(str, command) == 0;
return (strcasecmp(str, command) == 0);
}
/*%
@@ -86,7 +86,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/*
* No data section.
*/
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
result = isccc_cc_lookupstring(data, "type", &cmdline);
@@ -94,10 +94,13 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/*
* We have no idea what this is.
*/
return result;
return (result);
}
isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
result = isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
if (result != ISC_R_SUCCESS) {
return (result);
}
isc_buffer_init(&src, cmdline, strlen(cmdline));
isc_buffer_add(&src, strlen(cmdline));
@@ -135,7 +138,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
!command_compare(command, NAMED_COMMAND_TESTGEN) &&
!command_compare(command, NAMED_COMMAND_ZONESTATUS))
{
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_CONTROL, log_level,
"rejecting restricted control channel "
"command '%s'",
@@ -144,9 +147,9 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
goto cleanup;
}
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_CONTROL,
log_level, "received control channel command '%s'",
cmdline);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_CONTROL, log_level,
"received control channel command '%s'", cmdline);
/*
* After the lengthy "halt" and "stop", the commands are
@@ -178,7 +181,6 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/* Do not flush master files */
named_server_flushonshutdown(named_g_server, false);
named_os_shutdownmsg(cmdline, *text);
isc_loopmgr_shutdown(named_g_loopmgr);
result = ISC_R_SHUTTINGDOWN;
} else if (command_compare(command, NAMED_COMMAND_STOP)) {
/*
@@ -196,15 +198,11 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
#endif /* ifdef HAVE_LIBSCF */
named_server_flushonshutdown(named_g_server, true);
named_os_shutdownmsg(cmdline, *text);
isc_loopmgr_shutdown(named_g_loopmgr);
result = ISC_R_SHUTTINGDOWN;
} else if (command_compare(command, NAMED_COMMAND_ADDZONE) ||
command_compare(command, NAMED_COMMAND_MODZONE))
{
result = named_server_changezone(named_g_server, cmdline, text);
} else if (command_compare(command, NAMED_COMMAND_CLOSELOGS)) {
isc_log_closefilelogs();
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_DELZONE)) {
result = named_server_delzone(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DNSSEC)) {
@@ -214,7 +212,8 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
{
result = named_server_dnstap(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPDB)) {
result = named_server_dumpdb(named_g_server, lex, text);
named_server_dumpdb(named_g_server, lex, text);
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_DUMPSTATS)) {
result = named_server_dumpstats(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_FETCHLIMIT)) {
@@ -227,30 +226,24 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_flushnode(named_g_server, lex, true);
} else if (command_compare(command, NAMED_COMMAND_FREEZE)) {
result = named_server_freeze(named_g_server, true, lex, text);
} else if (command_compare(command, NAMED_COMMAND_SKR)) {
result = named_server_skr(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_LOADKEYS) ||
command_compare(command, NAMED_COMMAND_SIGN))
{
result = named_server_rekey(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_MEMPROF)) {
result = named_server_togglememprof(lex);
} else if (command_compare(command, NAMED_COMMAND_MKEYS)) {
result = named_server_mkeys(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_NOTIFY)) {
result = named_server_notifycommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_NOTRACE)) {
named_g_debuglevel = 0;
isc_log_setdebuglevel(named_g_debuglevel);
isc_log_setdebuglevel(named_g_lctx, named_g_debuglevel);
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_NTA)) {
result = named_server_nta(named_g_server, lex, readonly, text);
} else if (command_compare(command, NAMED_COMMAND_NULL)) {
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_QUERYLOG)) {
result = named_server_setortoggle(named_g_server,
"query logging",
NS_SERVER_LOGQUERIES, lex);
result = named_server_togglequerylog(named_g_server, lex);
} else if (command_compare(command, NAMED_COMMAND_RECONFIG)) {
result = named_server_reconfigcommand(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_RECURSING)) {
@@ -259,10 +252,6 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_refreshcommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_RELOAD)) {
result = named_server_reloadcommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_RESPONSELOG)) {
result = named_server_setortoggle(named_g_server,
"response logging",
NS_SERVER_LOGRESPONSES, lex);
} else if (command_compare(command, NAMED_COMMAND_RETRANSFER)) {
result = named_server_retransfercommand(named_g_server, lex,
text);
@@ -291,12 +280,16 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_freeze(named_g_server, false, lex, text);
} else if (command_compare(command, NAMED_COMMAND_TRACE)) {
result = named_server_setdebuglevel(named_g_server, lex);
} else if (command_compare(command, NAMED_COMMAND_TSIGDELETE)) {
result = named_server_tsigdelete(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_TSIGLIST)) {
result = named_server_tsiglist(named_g_server, text);
} else if (command_compare(command, NAMED_COMMAND_VALIDATION)) {
result = named_server_validation(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_ZONESTATUS)) {
result = named_server_zonestatus(named_g_server, lex, text);
} else {
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"unknown control channel command '%s'", command);
result = DNS_R_UNKNOWNCOMMAND;
@@ -307,5 +300,5 @@ cleanup:
isc_lex_destroy(&lex);
}
return result;
return (result);
}
+404 -279
View File
File diff suppressed because it is too large Load Diff
+28 -27
View File
@@ -17,13 +17,14 @@
#include <stdlib.h>
#include <string.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <isc/uv.h>
#include <dns/dlz_dlopen.h>
#include <dns/log.h>
#include <dlz/dlz_dlopen_driver.h>
#include <named/globals.h>
@@ -80,7 +81,7 @@ static void
dlopen_log(int level, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
isc_log_vwrite(DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ,
isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ,
ISC_LOG_DEBUG(level), fmt, ap);
va_end(ap);
}
@@ -98,13 +99,13 @@ dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_allnodes == NULL) {
return ISC_R_NOPERM;
return (ISC_R_NOPERM);
}
MAYBE_LOCK(cd);
result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
static isc_result_t
@@ -116,13 +117,13 @@ dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
UNUSED(driverarg);
if (cd->dlz_allowzonexfr == NULL) {
return ISC_R_NOPERM;
return (ISC_R_NOPERM);
}
MAYBE_LOCK(cd);
result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
static isc_result_t
@@ -134,13 +135,13 @@ dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_authority == NULL) {
return ISC_R_NOTIMPLEMENTED;
return (ISC_R_NOTIMPLEMENTED);
}
MAYBE_LOCK(cd);
result = cd->dlz_authority(zone, cd->dbdata, lookup);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
static isc_result_t
@@ -155,7 +156,7 @@ dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
MAYBE_LOCK(cd);
result = cd->dlz_findzonedb(cd->dbdata, name, methods, clientinfo);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
static isc_result_t
@@ -172,7 +173,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
result = cd->dlz_lookup(zone, name, cd->dbdata, lookup, methods,
clientinfo);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
/*
@@ -195,7 +196,7 @@ dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
}
}
return ptr;
return (ptr);
}
static void
@@ -219,7 +220,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
"dlz_dlopen driver for '%s' needs a path to "
"the shared library",
dlzname);
return ISC_R_FAILURE;
return (ISC_R_FAILURE);
}
isc_mem_create(&mctx);
@@ -319,14 +320,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
*dbdata = cd;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
failed:
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
dlopen_dlz_destroy(NULL, cd);
return result;
return (result);
}
/*
@@ -363,13 +364,13 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_newversion == NULL) {
return ISC_R_NOTIMPLEMENTED;
return (ISC_R_NOTIMPLEMENTED);
}
MAYBE_LOCK(cd);
result = cd->dlz_newversion(zone, cd->dbdata, versionp);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
/*
@@ -404,7 +405,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_configure == NULL) {
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
MAYBE_LOCK(cd);
@@ -413,7 +414,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
cd->in_configure = false;
MAYBE_UNLOCK(cd);
return result;
return (result);
}
/*
@@ -429,7 +430,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
UNUSED(driverarg);
if (cd->dlz_ssumatch == NULL) {
return false;
return (false);
}
MAYBE_LOCK(cd);
@@ -437,7 +438,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
keydata, cd->dbdata);
MAYBE_UNLOCK(cd);
return ret;
return (ret);
}
/*
@@ -452,14 +453,14 @@ dlopen_dlz_addrdataset(const char *name, const char *rdatastr, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_addrdataset == NULL) {
return ISC_R_NOTIMPLEMENTED;
return (ISC_R_NOTIMPLEMENTED);
}
MAYBE_LOCK(cd);
result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
/*
@@ -474,14 +475,14 @@ dlopen_dlz_subrdataset(const char *name, const char *rdatastr, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_subrdataset == NULL) {
return ISC_R_NOTIMPLEMENTED;
return (ISC_R_NOTIMPLEMENTED);
}
MAYBE_LOCK(cd);
result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
/*
@@ -496,14 +497,14 @@ dlopen_dlz_delrdataset(const char *name, const char *type, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_delrdataset == NULL) {
return ISC_R_NOTIMPLEMENTED;
return (ISC_R_NOTIMPLEMENTED);
}
MAYBE_LOCK(cd);
result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return result;
return (result);
}
static dns_sdlzmethods_t dlz_dlopen_methods = {
@@ -535,7 +536,7 @@ dlz_dlopen_init(isc_mem_t *mctx) {
result = ISC_R_UNEXPECTED;
}
return result;
return (result);
}
/*
+7 -6
View File
@@ -26,12 +26,13 @@
#include <unistd.h>
#include <isc/condition.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/mutex.h>
#include <isc/thread.h>
#include <isc/util.h>
#include <dns/log.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/server.h>
@@ -126,7 +127,7 @@ fuzz_thread_client(void *arg) {
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return NULL;
return (NULL);
}
raise(SIGSTOP);
goto next;
@@ -160,7 +161,7 @@ fuzz_thread_client(void *arg) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
return NULL;
return (NULL);
}
/*
@@ -374,7 +375,7 @@ fuzz_thread_resolver(void *arg) {
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return NULL;
return (NULL);
}
raise(SIGSTOP);
continue;
@@ -586,7 +587,7 @@ fuzz_thread_resolver(void *arg) {
__AFL_LOOP(0);
#endif /* ifdef __AFL_LOOP */
return NULL;
return (NULL);
}
/*
@@ -717,7 +718,7 @@ fuzz_thread_tcp(void *arg) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
return NULL;
return (NULL);
}
#endif /* ENABLE_AFL */
+14 -13
View File
@@ -18,6 +18,7 @@
#endif /* if defined(HAVE_GEOIP2) */
#include <isc/dir.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -39,27 +40,27 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
n = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", dir, dbfile);
if (n >= sizeof(pathbuf)) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR,
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"GeoIP2 database '%s/%s': path too long", dir,
dbfile);
return NULL;
return (NULL);
}
ret = MMDB_open(pathbuf, MMDB_MODE_MMAP, mmdb);
if (ret == MMDB_SUCCESS) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO, "opened GeoIP2 database '%s'",
pathbuf);
return mmdb;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"opened GeoIP2 database '%s'", pathbuf);
return (mmdb);
}
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_DEBUG(1),
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_DEBUG(1),
"unable to open GeoIP2 database '%s' (status %d)",
pathbuf, ret);
return NULL;
return (NULL);
}
#endif /* HAVE_GEOIP2 */
@@ -79,9 +80,9 @@ named_geoip_load(char *dir) {
#if defined(HAVE_GEOIP2)
REQUIRE(dir != NULL);
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO, "looking for GeoIP2 databases in '%s'",
dir);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"looking for GeoIP2 databases in '%s'", dir);
named_g_geoip->country = open_geoip2(dir, "GeoIP2-Country.mmdb",
&geoip_country);
-10
View File
@@ -15,18 +15,8 @@
/*! \file */
#include <inttypes.h>
#include <isc/types.h>
#include <dns/clientinfo.h>
#include <dns/types.h>
/***
*** Functions
***/
/* Initialization functions for builtin zone databases */
isc_result_t
named_builtin_init(void);
+20 -3
View File
@@ -52,18 +52,35 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
dns_zonetype_t
named_config_getzonetype(const cfg_obj_t *zonetypeobj);
isc_result_t
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
in_port_t defport, isc_mem_t *mctx,
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
uint32_t *countp);
void
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
isc_dscp_t **dscpsp, uint32_t count);
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret);
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl);
isc_result_t
named_config_getport(const cfg_obj_t *config, const char *type,
in_port_t *portp);
isc_result_t
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
uint16_t *digestbits);
isc_result_t
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
unsigned int *typep, uint16_t *digestbits);
isc_result_t
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp);
+37 -40
View File
@@ -20,60 +20,57 @@
#include <stdbool.h>
#include <isccc/types.h>
#include <isccfg/aclconf.h>
#include <isccc/types.h>
#include <named/types.h>
#define NAMED_CONTROL_PORT 953
#define NAMED_COMMAND_ADDZONE "addzone"
#define NAMED_COMMAND_CLOSELOGS "closelogs"
#define NAMED_COMMAND_DELZONE "delzone"
#define NAMED_COMMAND_DNSSEC "dnssec"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DUMPDB "dumpdb"
#define NAMED_COMMAND_STOP "stop"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_RELOAD "reload"
#define NAMED_COMMAND_RECONFIG "reconfig"
#define NAMED_COMMAND_REFRESH "refresh"
#define NAMED_COMMAND_RETRANSFER "retransfer"
#define NAMED_COMMAND_DUMPSTATS "stats"
#define NAMED_COMMAND_FETCHLIMIT "fetchlimit"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_DUMPDB "dumpdb"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_FLUSH "flush"
#define NAMED_COMMAND_FLUSHNAME "flushname"
#define NAMED_COMMAND_FLUSHTREE "flushtree"
#define NAMED_COMMAND_FREEZE "freeze"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_LOADKEYS "loadkeys"
#define NAMED_COMMAND_MEMPROF "memprof"
#define NAMED_COMMAND_MKEYS "managed-keys"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_NOTIFY "notify"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_NTA "nta"
#define NAMED_COMMAND_NULL "null"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_RECONFIG "reconfig"
#define NAMED_COMMAND_RECURSING "recursing"
#define NAMED_COMMAND_REFRESH "refresh"
#define NAMED_COMMAND_RELOAD "reload"
#define NAMED_COMMAND_RESPONSELOG "responselog"
#define NAMED_COMMAND_RETRANSFER "retransfer"
#define NAMED_COMMAND_SCAN "scan"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_SERVESTALE "serve-stale"
#define NAMED_COMMAND_SHOWZONE "showzone"
#define NAMED_COMMAND_SIGN "sign"
#define NAMED_COMMAND_SIGNING "signing"
#define NAMED_COMMAND_SKR "skr"
#define NAMED_COMMAND_STATUS "status"
#define NAMED_COMMAND_STOP "stop"
#define NAMED_COMMAND_SYNC "sync"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_TESTGEN "testgen"
#define NAMED_COMMAND_THAW "thaw"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_TSIGLIST "tsig-list"
#define NAMED_COMMAND_TSIGDELETE "tsig-delete"
#define NAMED_COMMAND_FREEZE "freeze"
#define NAMED_COMMAND_UNFREEZE "unfreeze"
#define NAMED_COMMAND_THAW "thaw"
#define NAMED_COMMAND_RECURSING "recursing"
#define NAMED_COMMAND_NULL "null"
#define NAMED_COMMAND_NOTIFY "notify"
#define NAMED_COMMAND_VALIDATION "validation"
#define NAMED_COMMAND_SCAN "scan"
#define NAMED_COMMAND_SIGN "sign"
#define NAMED_COMMAND_LOADKEYS "loadkeys"
#define NAMED_COMMAND_ADDZONE "addzone"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_DELZONE "delzone"
#define NAMED_COMMAND_SHOWZONE "showzone"
#define NAMED_COMMAND_SYNC "sync"
#define NAMED_COMMAND_SIGNING "signing"
#define NAMED_COMMAND_DNSSEC "dnssec"
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
#define NAMED_COMMAND_NTA "nta"
#define NAMED_COMMAND_TESTGEN "testgen"
#define NAMED_COMMAND_MKEYS "managed-keys"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_SERVESTALE "serve-stale"
#define NAMED_COMMAND_FETCHLIMIT "fetchlimit"
isc_result_t
named_controls_create(named_server_t *server, named_controls_t **ctrlsp);

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