-
Notifications
You must be signed in to change notification settings - Fork 5
/
danectl-nsupdate
executable file
·45 lines (39 loc) · 1.43 KB
/
danectl-nsupdate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl
BEGIN { pop @INC if $INC[-1] eq '.' }
use 5.006;
use warnings;
use strict;
# danectl - DNSSEC DANE implementation manager
# https://raf.org/danectl
# https://github.com/raforg/danectl
# https://codeberg.org/raforg/danectl
#
# Copyright (C) 2021-2023 raf <raf@raf.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# 20230718 raf <raf@raf.org>
# danectl-nsupdate - Adapt danectl DNS RR output for BIND9 nsupdate
# usage: danectl rollover <cert-name> | danectl-nsupdate ttl | nsupdate
my $ttl = shift or die "usage: $0 ttl\n";
die "$0: Invalid ttl: $ttl (must be an integer)\n" unless $ttl =~ /^\d+$/;
print "ttl $ttl\n";
while (<>)
{
next if /; /; # Skip real comments
s/^;/update delete /, s/[ \t]+/ /g, print, next if /^;_/; # Deletions
s/^/update add /, s/[ \t]+/ /g, print, next if /^_/; # Additions
}
print "send\n";
# vi:set ts=4 sw=4: