3 Commits

Author SHA1 Message Date
fc2031eb7c Support TLSA records
Closes: #4
2021-06-19 15:49:54 +01:00
17ff01d066 Handle SSHFP records
Closes #2
2021-06-19 15:42:11 +01:00
7a3e5e472a fix readme 2021-06-16 17:03:15 +01:00
2 changed files with 29 additions and 5 deletions

View File

@ -68,12 +68,12 @@ zones:
# Running
Invoke the docker container with the input yaml file:
```bash
docker run --rm -ti -v "${PWD}:/a" -w /a fooflington/mythic-beasts-dns mafoo.org.uk.yml
docker run --rm -ti -v "${PWD}:/a" -w /a fooflington/mythic-dns mafoo.org.uk.yml
```
## Dry run
Pass the environment variable `DRY_RUN` to prevent any changes:
```bash
docker run --rm -ti -v "${PWD}:/a" -w /a -e DRY_RUN=1 fooflington/mythic-beasts-dns mafoo.org.uk.yml
```
docker run --rm -ti -v "${PWD}:/a" -w /a -e DRY_RUN=1 fooflington/mythic-dns mafoo.org.uk.yml
```

View File

@ -40,9 +40,9 @@ my %supported_types = (
MX => "yes",
NS => "yes",
PTR => "yes",
SSHFP => "not yet implemented",
SSHFP => "yes",
SRV => "yes",
TLSA => "not yet implemented",
TLSA => "yes",
TXT => "yes",
);
sub is_unsupported($) {
@ -136,6 +136,17 @@ sub format_record($$$$) {
$record->{caa_property} = $property;
$record->{caa_tag} = $property;
$record->{data} = $data;
} elsif ($type eq 'SSHFP') {
my ($algo, $keytype, $data) = split(/\s+/, $value);
$record->{sshfp_type} = $keytype;
$record->{sshfp_algorithm} = $algo;
$record->{data} = $data;
} elsif ($type eq 'TLSA') {
my ($usage, $selector, $matching, $data) = split(/\s+/, $value);
$record->{tlsa_usage} = $usage;
$record->{tlsa_selector} = $selector;
$record->{tlsa_matching} = $matching;
$record->{data} = $data;
}
return $record;
@ -158,6 +169,19 @@ sub reformat_data($$) {
$data->{caa_property} || $data->{caa_tag},
$data->{data}
);
} elsif($type eq 'SSHFP') {
return sprintf('%d %d %s',
$data->{sshfp_algorithm},
$data->{sshfp_type},
$data->{data},
);
} elsif($type eq 'TLSA') {
return sprintf('%d %d %d %s',
$data->{tlsa_usage},
$data->{tlsa_selector},
$data->{tlsa_matching},
$data->{data},
);
}
return $data->{data};