# task.check – Validate flattened DNS BIND configuration in dot-per-line format # Each line:
. = (optionally followed by ;) # Example lines: # options.directory = "/var/named"; # zone.example.com.type = master # zone.example.com.file = "db.example.com"; # Soft check: options.directory regexp: options \. directory \s* \= \s* \" (<-[ \"]>+ ) \" \s* \;? code: < $c[0] }); } CODE generator: < @c { for @c -> $c { say "assert: 1 options.directory is '$c[0]'"; } } else { say "assert: 0 options.directory not found"; } CODE # Soft check: zone..type (master or slave) regexp: zone \. ( <-[ \= ; ]>+ ) \. type \s* \= \s* ( master | slave ) \s* \;? code: < @c { for @c -> $c { my $zone = $c[0]; my $type = $c[1]; say "assert: 1 zone $zone type is $type"; } } else { say "assert: 0 no zone type definitions found"; } CODE # Soft check: zone..file regexp: zone \. ( <-[ \= ; ]>+ ) \. file \s* \= \s* \" ( <-[ \"]>+ ) \" \s* \;? code: < @c { for @c -> $c { my $zone = $c[0]; my $file = $c[1]; my $nonempty = $file ne ''; say "assert: {$nonempty} zone $zone file is '$file'"; } } else { say "assert: 0 no zone file definitions found"; } CODE # Soft check: zone..masters (optional) regexp: zone \. ( <-[ \= ; ]>+ ) \. masters \s* \= \s* \{ \s* ( <-[ } ]>+ ) \s* \} \s* \;? code: < @c { for @c -> $c { my $zone = $c[0]; my $masters = $c[1]; say "assert: 1 zone $zone masters configured: $masters"; } } else { say "assert: 0 no zone masters definitions found (optional)"; } CODE