1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC") 2 # 3 # SPDX-License-Identifier: MPL-2.0 4 # 5 # This Source Code Form is subject to the terms of the Mozilla Public 6 # License, v. 2.0. If a copy of the MPL was not distributed with this 7 # file, you can obtain one at https://mozilla.org/MPL/2.0/. 8 # 9 # See the COPYRIGHT file distributed with this work for additional 10 # information regarding copyright ownership. 11 12 import shutil 13 14 import pytest 15 16 from isctest.util import param 17 from rollover.common import CDSS, DEFAULT_CONFIG, DURATION, ROLLOVER_MARK 18 19 import isctest 20 21 pytestmark = ROLLOVER_MARK 22 23 24 def bootstrap(): 25 data = { 26 "testconf": "lifetime", 27 "trust_anchors": [], 28 } 29 30 shutil.copyfile("ns3/lifetime.db.in", "ns3/longer-lifetime.db") 31 shutil.copyfile("ns3/lifetime.db.in", "ns3/shorter-lifetime.db") 32 shutil.copyfile("ns3/lifetime.db.in", "ns3/limit-lifetime.db") 33 shutil.copyfile("ns3/lifetime.db.in", "ns3/unlimit-lifetime.db") 34 35 return data 36 37 38 @pytest.mark.parametrize( 39 "zone, policy, lifetime", 40 [ 41 param("shorter-lifetime", "long-lifetime", "P1Y"), 42 param("longer-lifetime", "short-lifetime", "P6M"), 43 param("limit-lifetime", "unlimited-lifetime", 0), 44 param("unlimit-lifetime", "short-lifetime", "P6M"), 45 ], 46 ) 47 def test_lifetime_initial(zone, policy, lifetime, ns3, default_algorithm): 48 config = DEFAULT_CONFIG 49 50 isctest.kasp.wait_keymgr_done(ns3, f"{zone}.kasp") 51 52 step = { 53 "zone": f"{zone}.kasp", 54 "cdss": CDSS, 55 "keyprops": [ 56 f"csk {DURATION[lifetime]} {default_algorithm.number} {default_algorithm.bits} goal:omnipresent dnskey:rumoured krrsig:rumoured zrrsig:rumoured ds:hidden", 57 ], 58 "nextev": None, 59 } 60 isctest.kasp.check_rollover_step(ns3, config, policy, step) 61