2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2020 IPFire Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 # enable only the following on debugging purpose
27 #use CGI::Carp 'fatalsToBrowser';
29 require '/var/ipfire/general-functions.pl';
30 require "${General::swroot}/geoip-functions.pl";
31 require "${General::swroot}/lang.pl";
32 require "${General::swroot}/header.pl";
34 #workaround to suppress a warning when a variable is used only once
35 my @dummy = ( ${Header
::colouryellow
} );
41 my $errormessage = '';
43 # Config file which stores the DNS settings.
44 my $settings_file = "${General::swroot}/dns/settings";
46 # File which stores the configured DNS-Servers.
47 my $servers_file = "${General::swroot}/dns/servers";
49 # Create files if the does not exist.
50 unless (-f
$settings_file) { system("touch $settings_file") };
51 unless (-f
$servers_file) { system("touch $servers_file") };
53 # File which stores the ISP assigned DNS servers.
54 my @ISP_nameserver_files = ( "/var/run/dns1", "/var/run/dns2" );
56 # File which contains the ca-certificates.
57 my $ca_certs_file = "/etc/ssl/certs/ca-bundle.crt";
59 # Server which is used, to determine if the whole DNS system works properly.
60 my $dns_test_server = "ping.ipfire.org";
65 my %mainsettings = ();
66 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
67 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
69 &Header
::showhttpheaders
();
70 &Header
::getcgihash
(\
%cgiparams);
73 # Save general settings.
75 if ($cgiparams{'GENERAL'} eq $Lang::tr
{'save'}) {
76 # Prevent form name from been stored in conf file.
77 delete $cgiparams{'GENERAL'};
79 # Add value for non-checked checkbox.
80 if ($cgiparams{'USE_ISP_NAMESERVERS'} ne "on") {
81 $cgiparams{'USE_ISP_NAMESERVERS'} = "off";
84 # Add value for non-checked checkbox.
85 if ($cgiparams{'ENABLE_SAFE_SEARCH'} ne "on") {
86 $cgiparams{'ENABLE_SAFE_SEARCH'} = "off";
89 # Store settings into settings file.
90 &General
::writehash
("$settings_file", \
%cgiparams);
92 # Call function to handle unbound restart, etc.
93 &_handle_unbound_and_more
()
99 if (($cgiparams{'SERVERS'} eq $Lang::tr
{'save'}) || ($cgiparams{'SERVERS'} eq $Lang::tr
{'update'})) {
100 # Hash to store the generic DNS settings.
103 # Read-in generic settings.
104 &General
::readhash
("$settings_file", \
%settings);
106 # Check if an IP-address has been given.
107 if ($cgiparams{"NAMESERVER"} eq "") {
108 $errormessage = "$Lang::tr{'dns no address given'}";
111 # Check if the given DNS server is valid.
112 elsif(!&General
::validip
($cgiparams{"NAMESERVER"})) {
113 $errormessage = "$Lang::tr{'invalid ip'}: $cgiparams{'NAMESERVER'}";
116 # Check if a TLS is enabled and no TLS_HOSTNAME has benn specified.
117 elsif($settings{'PROTO'} eq "TLS") {
118 unless($cgiparams{"TLS_HOSTNAME"}) {
119 $errormessage = "$Lang::tr{'dns no tls hostname given'}";
121 # Check if the provided domain is valid.
122 unless(&General
::validfqdn
($cgiparams{"TLS_HOSTNAME"})) {
123 $errormessage = "$Lang::tr{'invalid ip or hostname'}: $cgiparams{'TLS_HOSTNAME'}";
128 # Go further if there was no error.
129 if ( ! $errormessage) {
130 # Check if a remark has been entered.
131 $cgiparams{'REMARK'} = &Header
::cleanhtml
($cgiparams{'REMARK'});
133 my %dns_servers = ();
137 # Read-in configfile.
138 &General
::readhasharray
($servers_file, \
%dns_servers);
140 # Check if we should edit an existing entry and got an ID.
141 if (($cgiparams{'SERVERS'} eq $Lang::tr
{'update'}) && ($cgiparams{'ID'})) {
142 # Assin the provided id.
143 $id = $cgiparams{'ID'};
145 # Undef the given ID.
146 undef($cgiparams{'ID'});
148 # Grab the configured status of the corresponding entry.
149 $status = $dns_servers{$id}[2];
151 # Each newly added entry automatically should be enabled.
154 # Generate the ID for the new entry.
156 # Sort the keys by their ID and store them in an array.
157 my @keys = sort { $a <=> $b } keys %dns_servers;
159 # Reverse the key array.
160 my @reversed = reverse(@keys);
162 # Obtain the last used id.
163 my $last_id = @reversed[0];
165 # Increase the last id by one and use it as id for the new entry.
168 # The first allowed id is 3 to keep space for
169 # possible ISP assigned DNS servers.
175 # Add/Modify the entry to/in the dns_servers hash.
176 $dns_servers{$id} = ["$cgiparams{'NAMESERVER'}", "$cgiparams{'TLS_HOSTNAME'}", "$status", "$cgiparams{'REMARK'}"];
178 # Write the changed hash to the config file.
179 &General
::writehasharray
($servers_file, \
%dns_servers);
181 # Call function to handle unbound restart, etc.
182 &_handle_unbound_and_more
();
184 # Switch back to previous mode.
185 $cgiparams{'SERVERS'} = $cgiparams{'MODE'};
188 # Toggle enable / disable.
190 } elsif ($cgiparams{'SERVERS'} eq $Lang::tr
{'toggle enable disable'}) {
191 my %dns_servers = ();
193 # Only go further, if an ID has been passed.
194 if ($cgiparams{'ID'}) {
195 # Assign the given ID.
196 my $id = $cgiparams{'ID'};
198 # Undef the given ID.
199 undef($cgiparams{'ID'});
201 # Read-in configfile.
202 &General
::readhasharray
($servers_file, \
%dns_servers);
204 # Grab the configured status of the corresponding entry.
205 my $status = $dns_servers{$id}[2];
208 if ($status eq "disabled") {
211 $status = "disabled";
214 # Modify the status of the existing entry.
215 $dns_servers{$id} = ["$dns_servers{$id}[0]", "$dns_servers{$id}[1]", "$status", "$dns_servers{$id}[3]"];
217 # Write the changed hash back to the config file.
218 &General
::writehasharray
($servers_file, \
%dns_servers);
221 ## Remove entry from DNS servers list.
223 } elsif ($cgiparams{'SERVERS'} eq $Lang::tr
{'remove'}) {
224 my %dns_servers = ();
226 # Read-in configfile.
227 &General
::readhasharray
($servers_file, \
%dns_servers);
229 # Drop entry from the hash.
230 delete($dns_servers{$cgiparams{'ID'}});
232 # Undef the given ID.
233 undef($cgiparams{'ID'});
235 # Write the changed hash to the config file.
236 &General
::writehasharray
($servers_file, \
%dns_servers);
238 ## Handle request to check the servers.
240 } elsif ($cgiparams{'SERVERS'} eq $Lang::tr
{'dns check servers'}) {
244 # Hash to store the generic DNS settings.
247 # Read-in general DNS settings.
248 &General
::readhash
("$settings_file", \
%settings);
250 # Hash which contains the configured DNS servers.
251 my %dns_servers = ();
253 # Read-in config file.
254 &General
::readhasharray
("$servers_file", \
%dns_servers);
256 &Header
::openpage
($Lang::tr
{'dns'}, 1, '');
258 &Header
::openbigbox
('100%', 'left', '', $errormessage);
261 # Error messages layout.
264 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
265 print "<class name='base'>$errormessage\n";
266 print " </class>\n";
270 # Handle if a nameserver should be added or edited.
271 if (($cgiparams{'SERVERS'} eq "$Lang::tr{'add'}") || ($cgiparams{'SERVERS'} eq "$Lang::tr{'edit'}")) {
272 # Display the sub page.
273 &show_add_edit_nameserver
();
276 &Header
::closebigbox
();
277 &Header
::closepage
();
279 # Finished here for the moment.
283 $cgiparams{'GENERAL'} = '';
284 $cgiparams{'SERVERS'} = '';
285 $cgiparams{'NAMESERVER'} = '';
286 $cgiparams{'TLS_HOSTNAME'} = '';
287 $cgiparams{'REMARK'} ='';
289 $checked{'USE_ISP_NAMESERVERS'}{'off'} = '';
290 $checked{'USE_ISP_NAMESERVERS'}{'on'} = '';
291 $checked{'USE_ISP_NAMESERVERS'}{$settings{'USE_ISP_NAMESERVERS'}} = "checked='checked'";
293 $checked{'ENABLE_SAFE_SEARCH'}{'off'} = '';
294 $checked{'ENABLE_SAFE_SEARCH'}{'on'} = '';
295 $checked{'ENABLE_SAFE_SEARCH'}{$settings{'ENABLE_SAFE_SEARCH'}} = "checked='checked'";
297 $selected{'PROTO'}{'UDP'} = '';
298 $selected{'PROTO'}{'TLS'} = '';
299 $selected{'PROTO'}{'TCP'} = '';
300 $selected{'PROTO'}{$settings{'PROTO'}} = "selected='selected'";
302 $selected{'QNAME_MIN'}{'standard'} = '';
303 $selected{'QNAME_MIN'}{'strict'} = '';
304 $selected{'QNAME_MIN'}{$settings{'QNAME_MIN'}} = "selected='selected'";
306 # Display nameserver and configuration sections.
308 &show_general_dns_configuration
();
310 &Header
::closebigbox
();
311 &Header
::closepage
();
314 # General DNS-Servers sektion.
316 sub show_general_dns_configuration
() {
317 &Header
::openbox
('100%', 'center', "$Lang::tr{'dns configuration'}");
320 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
324 $Lang::tr{'dns use isp assigned nameservers'}
328 <input type="checkbox" name="USE_ISP_NAMESERVERS" $checked{'USE_ISP_NAMESERVERS'}{'on'}>
340 $Lang::tr{'dns use protocol for dns queries'}
344 <select name="PROTO">
345 <option value="UDP" $selected{'PROTO'}{'UDP'}>UDP</option>
346 <option value="TLS" $selected{'PROTO'}{'TLS'}>TLS</option>
347 <option value="TCP" $selected{'PROTO'}{'TCP'}>TCP</option>
360 $Lang::tr{'dns enable safe-search'}
364 <input type="checkbox" name="ENABLE_SAFE_SEARCH" $checked{'ENABLE_SAFE_SEARCH'}{'on'}>
376 $Lang::tr{'dns mode for qname minimisation'}
380 <select name="QNAME_MIN">
381 <option value="standard" $selected{'QNAME_MIN'}{'standard'}>$Lang::tr{'standard'}</option>
382 <option value="strict" $selected{'QNAME_MIN'}{'strict'}>$Lang::tr{'strict'}</option>
388 <td colspan="2" align="right">
389 <input type="submit" name="GENERAL" value="$Lang::tr{'save'}">
400 # Section to display the configured and used DNS servers.
402 sub show_nameservers
() {
403 &Header
::openbox
('100%', 'center', "$Lang::tr{'dns title'}");
405 my $dns_status_string;
408 # Test if the DNS system is working.
410 # Simple send a request to unbound and check if it can resolve the
412 my $dns_status_ret = &check_nameserver
("127.0.0.1", "$dns_test_server", "UDP");
414 if ($dns_status_ret eq "2") {
415 $dns_status_string = "$Lang::tr{'working'}";
416 $dns_status_col = "${Header::colourgreen}";
418 $dns_status_string = "$Lang::tr{'broken'}";
419 $dns_status_col = "${Header::colourred}";
426 <strong>$Lang::tr{'status'}: </strong>
427 <strong><font color='$dns_status_col'>$dns_status_string</font></strong>
434 <table class="tbl" width='100%'>
437 <strong>$Lang::tr{'nameserver'}</strong>
441 <strong>$Lang::tr{'country'}</strong>
445 <strong>$Lang::tr{'rdns'}</strong>
449 <strong>$Lang::tr{'remark'}</strong>
452 # Check if the status should be displayed.
453 if ($check_servers) {
456 <strong>$Lang::tr{'status'}</strong>
464 <td align="center" colspan="3">
465 <strong>$Lang::tr{'action'}</strong>
471 # Check the usage of ISP assigned nameservers is enabled.
474 # Loop through the array which stores the files.
475 foreach my $file (@ISP_nameserver_files) {
476 # Grab the address of the nameserver.
477 my $address = &grab_address_from_file
($file);
479 # Check if we got an address.
481 # Add the address to the hash of nameservers.
482 $dns_servers{$id} = [ "$address", "none",
483 ($settings{'USE_ISP_NAMESERVERS'} eq "on") ?
"enabled" : "disabled",
484 "$Lang::tr{'dns isp assigned nameserver'}" ];
486 # Increase id by one.
491 # Check some DNS servers have been configured. In this case
492 # the hash contains at least one key.
494 if (keys %dns_servers) {
495 # Sort the keys by their ID and store them in an array.
496 my @keys = sort { $a <=> $b } keys %dns_servers;
498 # Loop through all entries of the array/hash.
499 foreach my $id (@keys) {
500 # Inrease server_amount.
503 # Assign data array positions to some nice variable names.
504 my $nameserver = $dns_servers{$id}[0];
505 my $tls_hostname = $dns_servers{$id}[1];
506 my $enabled = $dns_servers{$id}[2];
507 my $remark = $dns_servers{$id}[3];
516 if ($server_amount % 2) {
517 $col="bgcolor='$color{'color22'}'"; }
519 $col="bgcolor='$color{'color20'}'";
522 if ($enabled eq 'enabled') {
523 $gif='on.gif'; $toggle='off'; $gdesc=$Lang::tr
{'click to disable'};
525 $gif='off.gif'; $toggle='on'; $gdesc=$Lang::tr
{'click to enable'};
533 # Only grab the status if the nameserver is enabled.
534 if (($check_servers) && ($enabled eq "enabled")) {
535 $status = &check_nameserver
("$nameserver", "ping.ipfire.org", "$settings{'PROTO'}", "$tls_hostname");
539 $status_short = "$Lang::tr{'disabled'}";
541 # DNSSEC Not supported
542 } elsif ($status eq 0) {
543 $status_short = "$Lang::tr{'broken'}";
544 $status_message = $Lang::tr
{'dnssec not supported'};
545 $status_colour = ${Header
::colourred
};
548 } elsif ($status eq 1) {
549 $status_short = "$Lang::tr{'not validating'}";
550 $status_message = $Lang::tr
{'dnssec aware'};
551 $status_colour = ${Header
::colourblack
};
554 } elsif ($status eq 2) {
555 $status_short = "$Lang::tr{'ok'}";
556 $status_message = $Lang::tr
{'dnssec validating'};
557 $status_colour = ${Header
::colourgreen
};
561 $status_short = "$Lang::tr{'error'}";
562 $status_message = $status;
563 $status_colour = ${Header
::colourred
};
566 # collect more information about name server (rDNS, GeoIP country code)
567 my $ccode = &GeoIP
::lookup
($nameserver);
568 my $flag_icon = &GeoIP
::get_flag_icon
($ccode);
572 # Only do the reverse lookup if the system is online.
573 if (&red_is_active
()) {
574 my $iaddr = inet_aton
($nameserver);
575 $rdns = gethostbyaddr($iaddr, AF_INET
);
578 if (!$rdns) { $rdns = $Lang::tr
{'lookup failed'}; }
580 # Mark ISP name servers as disabled
581 if ($id <= 2 && $enabled eq "disabled") {
582 $nameserver = "<del>$nameserver</del>";
587 <td align="center" $col>
591 <td align="center" $col>
592 <a href='country.cgi#$ccode'><img src="$flag_icon" border="0" alt="$ccode" title="$ccode" /></a>
595 <td align="center" $col>
599 <td align="center" $col>
604 # Display server status if requested.
605 if ($check_servers) {
607 <td align="center" $col>
608 <strong><font color="$status_colour"><abbr title="$status_message">$status_short</abbr></font></strong>
614 # Check if the id is greater than "2".
616 # Nameservers with an ID's of one or two are ISP assigned,
617 # and we cannot perform any actions on them, so hide the tools for
622 <td align='center' width='5%' $col>
623 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
624 <input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' title='$gdesc' alt='$gdesc' />
625 <input type='hidden' name='ID' value='$id' />
626 <input type='hidden' name='ENABLE' value='$toggle' />
627 <input type='hidden' name='SERVERS' value='$Lang::tr{'toggle enable disable'}' />
631 <td align='center' width='5%' $col>
632 <form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'>
633 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' />
634 <input type='hidden' name='ID' value='$id' />
635 <input type='hidden' name='SERVERS' value='$Lang::tr{'edit'}' />
639 <td align='center' width='5%' $col>
640 <form method='post' name='frmc$id' action='$ENV{'SCRIPT_NAME'}'>
641 <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' />
642 <input type='hidden' name='ID' value='$id' />
643 <input type='hidden' name='SERVERS' value='$Lang::tr{'remove'}' />
649 print "<td colspan='3' $col> </td>\n";
659 print"<table width='100%'>\n";
661 # Check if the usage of the ISP nameservers is enabled and there are more than 2 servers.
662 if (($settings{'USE_ISP_NAMESERVERS'} eq "on") && ($server_amount gt "2")) {
665 <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
666 <td> <img src='/images/on.gif' alt='$Lang::tr{'click to disable'}' /></td>
667 <td class='base'>$Lang::tr{'click to disable'}</td>
668 <td> <img src='/images/off.gif' alt='$Lang::tr{'click to enable'}' /></td>
669 <td class='base'>$Lang::tr{'click to enable'}</td>
670 <td> <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
671 <td class='base'>$Lang::tr{'edit'}</td>
672 <td> <img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
673 <td class='base'>$Lang::tr{'remove'}</td>
680 <form method="post" action="$ENV{'SCRIPT_NAME'}">
681 <td colspan="9" align="right">
682 <input type="submit" name="SERVERS" value="$Lang::tr{'add'}">
683 <input type="submit" name="SERVERS" value="$Lang::tr{'dns check servers'}">
695 <td colspan="6" align="center">
696 <br>$Lang::tr{'guardian no entries'}<br>
701 <form method="post" action="$ENV{'SCRIPT_NAME'}">
702 <td colspan="6" align="right"><input type="submit" name="SERVERS" value="$Lang::tr{'add'}"></td>
715 # Section to display the add or edit subpage.
717 sub show_add_edit_nameserver
() {
718 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
720 my $buttontext = $Lang::tr
{'save'};
723 if ($cgiparams{'SERVERS'} eq $Lang::tr
{'edit'}) {
724 &Header
::openbox
('100%', 'left', $Lang::tr
{'dnsforward edit an entry'});
726 # Update button text for upate the existing entry.
727 $buttontext = $Lang::tr
{'update'};
729 # Add hidden input for sending ID.
730 print"<input type='hidden' name='ID' value='$cgiparams{'ID'}'>\n";
732 # Check if an ID has been given.
733 if ($cgiparams{'ID'}) {
734 # Assign cgiparams values.
735 $cgiparams{'NAMESERVER'} = $dns_servers{$cgiparams{'ID'}}[0];
736 $cgiparams{'TLS_HOSTNAME'} = $dns_servers{$cgiparams{'ID'}}[1];
737 $cgiparams{'REMARK'} = $dns_servers{$cgiparams{'ID'}}[3];
740 &Header
::openbox
('100%', 'left', $Lang::tr
{'dnsforward add a new entry'});
743 my $tls_required_image;
745 # If the protocol is TLS, dispaly the required image.
746 if ($settings{'PROTO'} eq "TLS") {
747 $tls_required_image = "<img src='/blob.gif' alt='*'>";
750 # Add hidden input to store the mode.
751 print "<input type='hidden' name='MODE' value='$cgiparams{'SERVERS'}'>\n";
756 <td width='20%' class='base'>$Lang::tr{'ip address'}: <img src='/blob.gif' alt='*' /></td>
757 <td><input type='text' name='NAMESERVER' value='$cgiparams{"NAMESERVER"}' size='24' /></td>
762 <td width='20%' class='base'>$Lang::tr{'dns tls hostname'}: $tls_required_image</td>
763 <td><input type='text' name='TLS_HOSTNAME' value='$cgiparams{'TLS_HOSTNAME'}' size='24'></td>
768 <td width ='20%' class='base'>$Lang::tr{'remark'}:</td>
769 <td><input type='text' name='REMARK' value='$cgiparams{'REMARK'}' size='40' maxlength='50' /></td>
778 <td class='base' width='55%'><img src='/blob.gif' alt ='*' align='top' /> $Lang::tr{'required field'}</td>
779 <td width='40%' align='right'>
780 <input type="submit" name="SERVERS" value="$buttontext">
781 <input type="submit" name="SERVERS" value="$Lang::tr{'back'}">
794 # Private function to handle the restart of unbound and more.
795 sub _handle_unbound_and_more
() {
797 system('/usr/local/bin/unboundctrl restart >/dev/null');
800 # Check if the system is online (RED is connected).
801 sub red_is_active
() {
802 # Check if the "active" file is present.
803 if ( -f
"${General::swroot}/red/active") {
807 # Return nothing - False.
812 # Tiny function to grab an IP-address of a given file.
813 sub grab_address_from_file
($) {
818 # Check if the given file exists.
820 # Open the file for reading.
821 open(FILE
, $file) or die "Could not read from $file. $!\n";
823 # Read the address from the file.
832 # Check if the obtained address is valid.
833 if (&General
::validip
($address)) {
834 # Return the address.
843 # Function to check a given nameserver against propper work.
844 sub check_nameserver
($$$$) {
845 my ($nameserver, $record, $proto, $tls_hostname) = @_;
847 # Check if the system is online.
848 unless (&red_is_active
()) {
849 return "$Lang::tr{'system is offline'}";
853 my @command = ("kdig", "+timeout=2", "+retry=0", "+dnssec",
856 # Handle different protols.
857 if ($proto eq "TCP") {
858 # Add TCP switch to the command.
859 push(@command, "+tcp");
861 } elsif($proto eq "TLS") {
862 # Add TLS switch to the command and provide the
863 # path to our file which contains the ca certs.
864 push(@command, "+tls-ca=$ca_certs_file");
866 # Check if a TLS hostname has been provided.
868 # Add TLS hostname to the command.
869 push(@command, "+tls-hostname=$tls_hostname");
871 return "$Lang::tr{'dns no tls hostname given'}";
875 # Add record to the command array.
876 push(@command, "$record");
878 # Add nameserver to the command array.
879 push(@command, "\@$nameserver");
881 # Connect to STDOUT and STDERR.
882 push(@command, "2>&1");
884 my @output = qx(@command);
885 my $output = join("", @output);
889 if ($output =~ m/status: (\w+)/) {
890 $status = ($1 eq "NOERROR");
898 while ($output =~ m/WARNING: (.*)/g) {
899 # Add the current grabbed warning to the warning string.
903 # Return the warning string, if we grabbed at least one.
910 if ($output =~ m/Flags: (.*);/) {
911 @flags = split(/ /, $1);
914 my $aware = ($output =~ m/RRSIG/);
915 my $validating = (grep(/ad;/, @flags));
917 return $aware + $validating;