/*
 * 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.
 */

// NS3

{% set long_sigs = long_sigs  | default(False) %}

options {
	query-source address 10.53.0.3;
	notify-source 10.53.0.3;
	transfer-source 10.53.0.3;
	port @PORT@;
	pid-file "named.pid";
	listen-on { 10.53.0.3; };
	listen-on-v6 { none; };
	allow-transfer { any; };
	recursion no;
	notify yes;
	dnssec-validation yes;
	session-keyfile "session.key";
	minimal-responses no;
};

key rndc_key {
	secret "1234abcd8765";
	algorithm @DEFAULT_HMAC@;
};

controls {
	inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};

dnssec-policy "dnssec" {
	keys {
		ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
	};
};

dnssec-policy "nsec3" {
	keys {
		ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
	};

	nsec3param iterations 0 optout no salt-length 0;
};

dnssec-policy "autonsec" {
	keys {
		ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		ksk key-directory lifetime unlimited algorithm @ALTERNATIVE_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @ALTERNATIVE_ALGORITHM@;
	};
};

dnssec-policy "autonsec3" {
	keys {
		ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		ksk key-directory lifetime unlimited algorithm @ALTERNATIVE_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @ALTERNATIVE_ALGORITHM@;
	};

	nsec3param iterations 0 optout no salt-length 0;
};

zone "." {
	type hint;
	file "../../_common/root.hint";
};

zone "example" {
	type secondary;
	primaries { 10.53.0.2; };
	file "example.bk";
};

zone "secure.example" {
	type primary;
	file "secure.example.db.signed";
	allow-update { any; };
};

zone "bogus.example" {
	type primary;
	file "bogus.example.db.signed";
	allow-update { any; };
};

zone "badds.example" {
	type primary;
	file "badds.example.db.signed";
	allow-update { any; };
};

zone "localkey.example" {
	type primary;
	file "localkey.example.db.signed";
	allow-update { any; };
};

zone "dynamic.example" {
	type primary;
	file "dynamic.example.db.signed";
	allow-update { any; };
};

zone "insecure.example" {
	type primary;
	file "insecure.example.db";
	allow-update { any; };
};

zone "extrakey.example" {
	type primary;
	file "extrakey.example.db";
	allow-update { any; };
};

zone "insecure.nsec3.example" {
	type primary;
	file "insecure.nsec3.example.db";
	allow-update { any; };
};

zone "insecure.optout.example" {
	type primary;
	file "insecure.optout.example.db";
	allow-update { any; };
};

zone "keyless.example" {
	type primary;
	file "keyless.example.db.signed";
};

zone "nsec3.example" {
	type primary;
	file "nsec3.example.db.signed";
};

zone "optout.nsec3.example" {
	type primary;
	file "optout.nsec3.example.db.signed";
};

zone "nsec3.nsec3.example" {
	type primary;
	file "nsec3.nsec3.example.db.signed";
};

zone "secure.nsec3.example" {
	type primary;
	file "secure.nsec3.example.db.signed";
};

zone "optout.example" {
	type primary;
	file "optout.example.db.signed";
};

zone "secure.optout.example" {
	type primary;
	file "secure.optout.example.db.signed";
};

zone "nsec3.optout.example" {
	type primary;
	file "nsec3.optout.example.db.signed";
};

zone "optout.optout.example" {
	type primary;
	file "optout.optout.example.db.signed";
};

zone "nsec3-unknown.example" {
	type primary;
	nsec3-test-zone yes;
	file "nsec3-unknown.example.db.signed";
};

zone "optout-unknown.example" {
	type primary;
	nsec3-test-zone yes;
	file "optout-unknown.example.db.signed";
};

zone "dnskey-unknown.example" {
	type primary;
	file "dnskey-unknown.example.db.signed";
};

zone "digest-alg-unsupported.example" {
	type primary;
	file "digest-alg-unsupported.example.db.signed";
	allow-update { any; };
};

zone "ds-unsupported.example" {
	type primary;
	file "ds-unsupported.example.db.signed";
	allow-update { any; };
};

zone "dnskey-unsupported.example" {
	type primary;
	file "dnskey-unsupported.example.db.signed";
};

zone "dnskey-unsupported-2.example" {
	type primary;
	file "dnskey-unsupported-2.example.db.signed";
};

zone "dnskey-nsec3-unknown.example" {
	type primary;
	nsec3-test-zone yes;
	file "dnskey-nsec3-unknown.example.db.signed";
};

zone "multiple.example" {
	type primary;
	file "multiple.example.db.signed";
	allow-update { any; };
};

zone "rfc2335.example" {
	type secondary;
	primaries { 10.53.0.2; };
	file "rfc2335.example.bk";
};

zone "rsasha256.example" {
	type primary;
	file "rsasha256.example.db.signed";
};

zone "rsasha512.example" {
	type primary;
	file "rsasha512.example.db.signed";
};

zone "kskonly.example" {
	type primary;
	file "kskonly.example.db.signed";
};

zone "expired.example" {
	type primary;
	allow-update { none; };
	file "expired.example.db.signed";
};

zone "update-nsec3.example" {
	type primary;
	dnssec-policy nsec3;
	allow-update { any; };
	file "update-nsec3.example.db.signed";
};

zone "auto-nsec.example" {
	type primary;
	dnssec-policy autonsec;
	allow-update { !0.0.0.0; };
	file "auto-nsec.example.db.signed";
};

zone "auto-nsec3.example" {
	type primary;
	dnssec-policy autonsec3;
	allow-update { !0.0.0.0; };
	file "auto-nsec3.example.db.signed";
};

zone "insecure.below-cname.example" {
	type primary;
	file "insecure.below-cname.example.db";
};

zone "secure.below-cname.example" {
	type primary;
	file "secure.below-cname.example.db.signed";
};

zone "ttlpatch.example" {
	type primary;
	file "ttlpatch.example.db.patched";
};

zone "split-dnssec.example" {
	type primary;
	file "split-dnssec.example.db";
};

zone "split-smart.example" {
	type primary;
	file "split-smart.example.db";
};

zone "nsec3chain-test" {
	type secondary;
	file "nsec3chain-test.bk";
	primaries { 10.53.0.2; };
};

zone "expiring.example" {
	type primary;
	allow-update { any; };
	file "expiring.example.db.signed";
};

zone "upper.example" {
	type primary;
	file "upper.example.db.signed";
};

zone "LOWER.EXAMPLE" {
	type primary;
	file "lower.example.db.signed";
};

zone "inline.example" {
	type primary;
	file "inline.example.db";
	inline-signing yes;
	dnssec-policy dnssec;
};

zone "future.example" {
	type primary;
	file "future.example.db.signed";
};

zone "managed-future.example" {
	type primary;
	file "managed-future.example.db.signed";
	allow-update { any; };
};

zone "revkey.example" {
	type primary;
	file "revkey.example.db.signed";
};

zone "dname-at-apex-nsec3.example" {
	type primary;
	file "dname-at-apex-nsec3.example.db.signed";
};

zone "occluded.example" {
	type primary;
	file "occluded.example.db.signed";
};

zone "secure.managed" {
	type primary;
	file "secure.managed.db.signed";
};

zone "disabled.managed" {
	type primary;
	file "disabled.managed.db.signed";
};

zone "enabled.managed" {
	type primary;
	file "enabled.managed.db.signed";
};

zone "unsupported.managed" {
	type primary;
	file "unsupported.managed.db.signed";
};

zone "revoked.managed" {
	type primary;
	file "revoked.managed.db.signed";
};

zone "secure.trusted" {
	type primary;
	file "secure.trusted.db.signed";
};

zone "disabled.trusted" {
	type primary;
	file "disabled.trusted.db.signed";
};

zone "enabled.trusted" {
	type primary;
	file "enabled.trusted.db.signed";
};

zone "unsupported.trusted" {
	type primary;
	file "unsupported.trusted.db.signed";
};

zone "revoked.trusted" {
	type primary;
	file "revoked.trusted.db.signed";
};

zone "too-many-iterations" {
	type secondary;
	primaries { 10.53.0.2; };
	file "too-many-iterations.bk";
};

zone "rsasha1.example" {
	type primary;
	file "rsasha1.example.db";
};

zone "rsasha1-1024.example" {
	type primary;
	file "rsasha1-1024.example.db";
};

zone "rsasha256oid.example" {
        type primary;
        file "rsasha256oid.example.db.signed";
};

zone "rsasha512oid.example" {
        type primary;
        file "rsasha512oid.example.db.signed";
};

zone "unknownoid.example" {
        type primary;
        file "unknownoid.example.db.signed";
};

zone "target.peer-ns-spoof" {
	type primary;
	file "target.peer-ns-spoof.db.signed";
};

zone "extradsoid.example" {
        type primary;
        file "extradsoid.example.db.signed";
};

zone "extradsunknownoid.example" {
        type primary;
        file "extradsunknownoid.example.db.signed";
};

zone "extended-ds-unknown-oid.example" {
        type primary;
        file "extended-ds-unknown-oid.example.db.signed";
};

dnssec-policy "siginterval" {
	keys {
		ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
		zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
	};

	{% if long_sigs  %}
		signatures-validity 35d;
		signatures-refresh 28d;
	{% else %}
		signatures-validity 1d;
		signatures-refresh 21h;
	{% endif %}
	signatures-validity-dnskey 90d;
};

zone "siginterval.example" {
	type primary;
	allow-update { any; };
	dnssec-policy siginterval;
	file "siginterval.example.db";
};

include "trusted.conf";
