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}/ids-functions.pl";
32 require "${General::swroot}/lang.pl";
33 require "${General::swroot}/header.pl";
35 #workaround to suppress a warning when a variable is used only once
36 my @dummy = ( ${Header
::colouryellow
} );
42 my $errormessage = '';
44 # Config file which stores the DNS settings.
45 my $settings_file = "${General::swroot}/dns/settings";
47 # File which stores the configured DNS-Servers.
48 my $servers_file = "${General::swroot}/dns/servers";
50 # Create files if the does not exist.
51 unless (-f
$settings_file) { system("touch $settings_file") };
52 unless (-f
$servers_file) { system("touch $servers_file") };
54 # File which stores the ISP assigned DNS servers.
55 my @ISP_nameserver_files = ( "/var/run/dns1", "/var/run/dns2" );
57 # File which contains the ca-certificates.
58 my $ca_certs_file = "/etc/ssl/certs/ca-bundle.crt";
60 # Server which is used, to determine if the whole DNS system works properly.
61 my $dns_test_server = "ping.ipfire.org";
66 my %mainsettings = ();
67 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
68 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
70 &Header
::showhttpheaders
();
71 &Header
::getcgihash
(\
%cgiparams);
74 # Save general settings.
76 if ($cgiparams{'GENERAL'} eq $Lang::tr
{'save'}) {
77 # Prevent form name from been stored in conf file.
78 delete $cgiparams{'GENERAL'};
80 # Add value for non-checked checkbox.
81 if ($cgiparams{'USE_ISP_NAMESERVERS'} ne "on") {
82 $cgiparams{'USE_ISP_NAMESERVERS'} = "off";
85 # Add value for non-checked checkbox.
86 if ($cgiparams{'ENABLE_SAFE_SEARCH'} ne "on") {
87 $cgiparams{'ENABLE_SAFE_SEARCH'} = "off";
90 # Check if using ISP nameservers and TLS is enabled at the same time.
91 if (($cgiparams{'USE_ISP_NAMESERVERS'} eq "on") && ($cgiparams{'PROTO'} eq "TLS")) {
92 $errormessage = $Lang::tr
{'dns isp nameservers and tls not allowed'}
95 # Check if there was an error.
96 if ( ! $errormessage) {
98 # Store settings into settings file.
99 &General
::writehash
("$settings_file", \
%cgiparams);
101 # Call function to handle unbound restart, etc.
102 &_handle_unbound_and_more
()
107 # Add / Edit entries.
109 if (($cgiparams{'SERVERS'} eq $Lang::tr
{'save'}) || ($cgiparams{'SERVERS'} eq $Lang::tr
{'update'})) {
110 # Hash to store the generic DNS settings.
113 # Read-in generic settings.
114 &General
::readhash
("$settings_file", \
%settings);
116 # Check if an IP-address has been given.
117 if ($cgiparams{"NAMESERVER"} eq "") {
118 $errormessage = "$Lang::tr{'dns no address given'}";
121 # Check if the given DNS server is valid.
122 elsif(!&General
::validip
($cgiparams{"NAMESERVER"})) {
123 $errormessage = "$Lang::tr{'invalid ip'}: $cgiparams{'NAMESERVER'}";
126 # Check if a TLS is enabled and no TLS_HOSTNAME has benn specified.
127 elsif($settings{'PROTO'} eq "TLS") {
128 unless($cgiparams{"TLS_HOSTNAME"}) {
129 $errormessage = "$Lang::tr{'dns no tls hostname given'}";
131 # Check if the provided domain is valid.
132 unless(&General
::validfqdn
($cgiparams{"TLS_HOSTNAME"})) {
133 $errormessage = "$Lang::tr{'invalid ip or hostname'}: $cgiparams{'TLS_HOSTNAME'}";
138 # Go further if there was no error.
139 if ( ! $errormessage) {
140 # Check if a remark has been entered.
141 $cgiparams{'REMARK'} = &Header
::cleanhtml
($cgiparams{'REMARK'});
143 my %dns_servers = ();
147 # Read-in configfile.
148 &General
::readhasharray
($servers_file, \
%dns_servers);
150 # Check if we should edit an existing entry and got an ID.
151 if (($cgiparams{'SERVERS'} eq $Lang::tr
{'update'}) && ($cgiparams{'ID'})) {
152 # Assin the provided id.
153 $id = $cgiparams{'ID'};
155 # Undef the given ID.
156 undef($cgiparams{'ID'});
158 # Grab the configured status of the corresponding entry.
159 $status = $dns_servers{$id}[2];
161 # Each newly added entry automatically should be enabled.
164 # Generate the ID for the new entry.
166 # Sort the keys by their ID and store them in an array.
167 my @keys = sort { $a <=> $b } keys %dns_servers;
169 # Reverse the key array.
170 my @reversed = reverse(@keys);
172 # Obtain the last used id.
173 my $last_id = @reversed[0];
175 # Increase the last id by one and use it as id for the new entry.
178 # The first allowed id is 3 to keep space for
179 # possible ISP assigned DNS servers.
185 # Add/Modify the entry to/in the dns_servers hash.
186 $dns_servers{$id} = ["$cgiparams{'NAMESERVER'}", "$cgiparams{'TLS_HOSTNAME'}", "$status", "$cgiparams{'REMARK'}"];
188 # Write the changed hash to the config file.
189 &General
::writehasharray
($servers_file, \
%dns_servers);
191 # Call function to handle unbound restart, etc.
192 &_handle_unbound_and_more
();
194 # Switch back to previous mode.
195 $cgiparams{'SERVERS'} = $cgiparams{'MODE'};
198 # Toggle enable / disable.
200 } elsif ($cgiparams{'SERVERS'} eq $Lang::tr
{'toggle enable disable'}) {
201 my %dns_servers = ();
203 # Only go further, if an ID has been passed.
204 if ($cgiparams{'ID'}) {
205 # Assign the given ID.
206 my $id = $cgiparams{'ID'};
208 # Undef the given ID.
209 undef($cgiparams{'ID'});
211 # Read-in configfile.
212 &General
::readhasharray
($servers_file, \
%dns_servers);
214 # Grab the configured status of the corresponding entry.
215 my $status = $dns_servers{$id}[2];
218 if ($status eq "disabled") {
221 $status = "disabled";
224 # Modify the status of the existing entry.
225 $dns_servers{$id} = ["$dns_servers{$id}[0]", "$dns_servers{$id}[1]", "$status", "$dns_servers{$id}[3]"];
227 # Write the changed hash back to the config file.
228 &General
::writehasharray
($servers_file, \
%dns_servers);
230 # Call function to handle unbound restart, etc.
231 &_handle_unbound_and_more
();
234 ## Remove entry from DNS servers list.
236 } elsif ($cgiparams{'SERVERS'} eq $Lang::tr
{'remove'}) {
237 my %dns_servers = ();
239 # Read-in configfile.
240 &General
::readhasharray
($servers_file, \
%dns_servers);
242 # Drop entry from the hash.
243 delete($dns_servers{$cgiparams{'ID'}});
245 # Undef the given ID.
246 undef($cgiparams{'ID'});
248 # Write the changed hash to the config file.
249 &General
::writehasharray
($servers_file, \
%dns_servers);
251 # Call function to handle unbound restart, etc.
252 &_handle_unbound_and_more
();
254 ## Handle request to check the servers.
256 } elsif ($cgiparams{'SERVERS'} eq $Lang::tr
{'dns check servers'}) {
260 # Hash to store the generic DNS settings.
263 # Read-in general DNS settings.
264 &General
::readhash
("$settings_file", \
%settings);
266 # Hash which contains the configured DNS servers.
267 my %dns_servers = ();
269 # Read-in config file.
270 &General
::readhasharray
("$servers_file", \
%dns_servers);
272 &Header
::openpage
($Lang::tr
{'dns'}, 1, '');
274 &Header
::openbigbox
('100%', 'left', '', $errormessage);
277 # Error messages layout.
280 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
281 print "<class name='base'>$errormessage\n";
282 print " </class>\n";
286 # Handle if a nameserver should be added or edited.
287 if (($cgiparams{'SERVERS'} eq "$Lang::tr{'add'}") || ($cgiparams{'SERVERS'} eq "$Lang::tr{'edit'}")) {
288 # Display the sub page.
289 &show_add_edit_nameserver
();
292 &Header
::closebigbox
();
293 &Header
::closepage
();
295 # Finished here for the moment.
299 $cgiparams{'GENERAL'} = '';
300 $cgiparams{'SERVERS'} = '';
301 $cgiparams{'NAMESERVER'} = '';
302 $cgiparams{'TLS_HOSTNAME'} = '';
303 $cgiparams{'REMARK'} ='';
305 $checked{'USE_ISP_NAMESERVERS'}{'off'} = '';
306 $checked{'USE_ISP_NAMESERVERS'}{'on'} = '';
307 $checked{'USE_ISP_NAMESERVERS'}{$settings{'USE_ISP_NAMESERVERS'}} = "checked='checked'";
309 $checked{'ENABLE_SAFE_SEARCH'}{'off'} = '';
310 $checked{'ENABLE_SAFE_SEARCH'}{'on'} = '';
311 $checked{'ENABLE_SAFE_SEARCH'}{$settings{'ENABLE_SAFE_SEARCH'}} = "checked='checked'";
313 $selected{'PROTO'}{'UDP'} = '';
314 $selected{'PROTO'}{'TLS'} = '';
315 $selected{'PROTO'}{'TCP'} = '';
316 $selected{'PROTO'}{$settings{'PROTO'}} = "selected='selected'";
318 $selected{'QNAME_MIN'}{'standard'} = '';
319 $selected{'QNAME_MIN'}{'strict'} = '';
320 $selected{'QNAME_MIN'}{$settings{'QNAME_MIN'}} = "selected='selected'";
322 # Display nameserver and configuration sections.
324 &show_general_dns_configuration
();
326 &Header
::closebigbox
();
327 &Header
::closepage
();
330 # General DNS-Servers sektion.
332 sub show_general_dns_configuration
() {
333 &Header
::openbox
('100%', 'center', "$Lang::tr{'dns configuration'}");
336 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
340 $Lang::tr{'dns use isp assigned nameservers'}
344 <input type="checkbox" name="USE_ISP_NAMESERVERS" $checked{'USE_ISP_NAMESERVERS'}{'on'}>
356 $Lang::tr{'dns use protocol for dns queries'}
360 <select name="PROTO">
361 <option value="UDP" $selected{'PROTO'}{'UDP'}>UDP</option>
362 <option value="TLS" $selected{'PROTO'}{'TLS'}>TLS</option>
363 <option value="TCP" $selected{'PROTO'}{'TCP'}>TCP</option>
376 $Lang::tr{'dns enable safe-search'}
380 <input type="checkbox" name="ENABLE_SAFE_SEARCH" $checked{'ENABLE_SAFE_SEARCH'}{'on'}>
392 $Lang::tr{'dns mode for qname minimisation'}
396 <select name="QNAME_MIN">
397 <option value="standard" $selected{'QNAME_MIN'}{'standard'}>$Lang::tr{'standard'}</option>
398 <option value="strict" $selected{'QNAME_MIN'}{'strict'}>$Lang::tr{'strict'}</option>
404 <td colspan="2" align="right">
405 <input type="submit" name="GENERAL" value="$Lang::tr{'save'}">
416 # Section to display the configured and used DNS servers.
418 sub show_nameservers
() {
419 &Header
::openbox
('100%', 'center', "$Lang::tr{'dns title'}");
421 my $dns_status_string;
425 # Test if the DNS system is working.
427 # Simple send a request to unbound and check if it can resolve the
429 my $dns_status_ret = &check_nameserver
("127.0.0.1", "$dns_test_server", "UDP");
431 if ($dns_status_ret eq "2") {
432 $dns_status_string = "$Lang::tr{'working'}";
433 $dns_status_col = "${Header::colourgreen}";
436 $dns_status_string = "$Lang::tr{'broken'}";
437 $dns_status_col = "${Header::colourred}";
444 <strong>$Lang::tr{'status'}: </strong>
445 <strong><font color='$dns_status_col'>$dns_status_string</font></strong>
452 <table class="tbl" width='100%'>
455 <strong>$Lang::tr{'nameserver'}</strong>
459 <strong>$Lang::tr{'country'}</strong>
463 <strong>$Lang::tr{'rdns'}</strong>
467 <strong>$Lang::tr{'remark'}</strong>
470 # Check if the status should be displayed.
471 if ($check_servers) {
474 <strong>$Lang::tr{'status'}</strong>
482 <td align="center" colspan="3">
483 <strong>$Lang::tr{'action'}</strong>
489 # Check the usage of ISP assigned nameservers is enabled.
492 # Loop through the array which stores the files.
493 foreach my $file (@ISP_nameserver_files) {
494 # Grab the address of the nameserver.
495 my $address = &General
::grab_address_from_file
($file);
497 # Check if we got an address.
499 # Add the address to the hash of nameservers.
500 $dns_servers{$id} = [ "$address", "none",
501 ($settings{'USE_ISP_NAMESERVERS'} eq "on") ?
"enabled" : "disabled",
502 "$Lang::tr{'dns isp assigned nameserver'}" ];
504 # Increase id by one.
509 # Check some DNS servers have been configured. In this case
510 # the hash contains at least one key.
512 if (keys %dns_servers) {
513 # Sort the keys by their ID and store them in an array.
514 my @keys = sort { $a <=> $b } keys %dns_servers;
516 # Loop through all entries of the array/hash.
517 foreach my $id (@keys) {
518 # Inrease server_amount.
521 # Assign data array positions to some nice variable names.
522 my $nameserver = $dns_servers{$id}[0];
523 my $tls_hostname = $dns_servers{$id}[1];
524 my $enabled = $dns_servers{$id}[2];
525 my $remark = $dns_servers{$id}[3];
534 if ($server_amount % 2) {
535 $col="bgcolor='$color{'color22'}'"; }
537 $col="bgcolor='$color{'color20'}'";
540 if ($enabled eq 'enabled') {
541 $gif='on.gif'; $toggle='off'; $gdesc=$Lang::tr
{'click to disable'};
543 $gif='off.gif'; $toggle='on'; $gdesc=$Lang::tr
{'click to enable'};
551 # Only grab the status if the nameserver is enabled.
552 if (($check_servers) && ($enabled eq "enabled")) {
553 $status = &check_nameserver
("$nameserver", "ping.ipfire.org", "$settings{'PROTO'}", "$tls_hostname");
556 if (!defined $status) {
557 $status_short = "$Lang::tr{'disabled'}";
559 # DNSSEC Not supported
560 } elsif ($status eq 0) {
561 $status_short = "$Lang::tr{'broken'}";
562 $status_message = $Lang::tr
{'dnssec not supported'};
563 $status_colour = ${Header
::colourred
};
566 } elsif ($status eq 1) {
567 $status_short = "$Lang::tr{'not validating'}";
568 $status_message = $Lang::tr
{'dnssec aware'};
569 $status_colour = ${Header
::colourblack
};
572 } elsif ($status eq 2) {
573 $status_short = "$Lang::tr{'ok'}";
574 $status_message = $Lang::tr
{'dnssec validating'};
575 $status_colour = ${Header
::colourgreen
};
579 $status_short = "$Lang::tr{'error'}";
580 $status_message = $status;
581 $status_colour = ${Header
::colourred
};
584 # collect more information about name server (rDNS, GeoIP country code)
585 my $ccode = &GeoIP
::lookup
($nameserver);
586 my $flag_icon = &GeoIP
::get_flag_icon
($ccode);
590 # Only do the reverse lookup if the system is online.
592 my $iaddr = inet_aton
($nameserver);
593 $rdns = gethostbyaddr($iaddr, AF_INET
);
596 if (!$rdns) { $rdns = $Lang::tr
{'lookup failed'}; }
598 # Mark ISP name servers as disabled
599 if ($id <= 2 && $enabled eq "disabled") {
600 $nameserver = "<del>$nameserver</del>";
605 <td align="center" $col>
609 <td align="center" $col>
610 <a href='country.cgi#$ccode'><img src="$flag_icon" border="0" alt="$ccode" title="$ccode" /></a>
613 <td align="center" $col>
617 <td align="center" $col>
622 # Display server status if requested.
623 if ($check_servers) {
625 <td align="center" $col>
626 <strong><font color="$status_colour"><abbr title="$status_message">$status_short</abbr></font></strong>
632 # Check if the id is greater than "2".
634 # Nameservers with an ID's of one or two are ISP assigned,
635 # and we cannot perform any actions on them, so hide the tools for
640 <td align='center' width='5%' $col>
641 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
642 <input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' title='$gdesc' alt='$gdesc' />
643 <input type='hidden' name='ID' value='$id' />
644 <input type='hidden' name='ENABLE' value='$toggle' />
645 <input type='hidden' name='SERVERS' value='$Lang::tr{'toggle enable disable'}' />
649 <td align='center' width='5%' $col>
650 <form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'>
651 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' />
652 <input type='hidden' name='ID' value='$id' />
653 <input type='hidden' name='SERVERS' value='$Lang::tr{'edit'}' />
657 <td align='center' width='5%' $col>
658 <form method='post' name='frmc$id' action='$ENV{'SCRIPT_NAME'}'>
659 <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' />
660 <input type='hidden' name='ID' value='$id' />
661 <input type='hidden' name='SERVERS' value='$Lang::tr{'remove'}' />
667 print "<td colspan='3' $col> </td>\n";
677 print"<table width='100%'>\n";
679 # Check if the usage of the ISP nameservers is enabled and there are more than 2 servers.
680 if (($settings{'USE_ISP_NAMESERVERS'} eq "on") && ($server_amount gt "2")) {
683 <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
684 <td> <img src='/images/on.gif' alt='$Lang::tr{'click to disable'}' /></td>
685 <td class='base'>$Lang::tr{'click to disable'}</td>
686 <td> <img src='/images/off.gif' alt='$Lang::tr{'click to enable'}' /></td>
687 <td class='base'>$Lang::tr{'click to enable'}</td>
688 <td> <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
689 <td class='base'>$Lang::tr{'edit'}</td>
690 <td> <img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
691 <td class='base'>$Lang::tr{'remove'}</td>
698 <form method="post" action="$ENV{'SCRIPT_NAME'}">
699 <td colspan="9" align="right">
700 <input type="submit" name="SERVERS" value="$Lang::tr{'add'}">
701 <input type="submit" name="SERVERS" value="$Lang::tr{'dns check servers'}">
713 <td colspan="6" align="center">
714 <br>$Lang::tr{'guardian no entries'}<br>
719 <form method="post" action="$ENV{'SCRIPT_NAME'}">
720 <td colspan="6" align="right"><input type="submit" name="SERVERS" value="$Lang::tr{'add'}"></td>
733 # Section to display the add or edit subpage.
735 sub show_add_edit_nameserver
() {
736 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
738 my $buttontext = $Lang::tr
{'save'};
741 if ($cgiparams{'SERVERS'} eq $Lang::tr
{'edit'}) {
742 &Header
::openbox
('100%', 'left', $Lang::tr
{'dnsforward edit an entry'});
744 # Update button text for upate the existing entry.
745 $buttontext = $Lang::tr
{'update'};
747 # Add hidden input for sending ID.
748 print"<input type='hidden' name='ID' value='$cgiparams{'ID'}'>\n";
750 # Check if an ID has been given.
751 if ($cgiparams{'ID'}) {
752 # Assign cgiparams values.
753 $cgiparams{'NAMESERVER'} = $dns_servers{$cgiparams{'ID'}}[0];
754 $cgiparams{'TLS_HOSTNAME'} = $dns_servers{$cgiparams{'ID'}}[1];
755 $cgiparams{'REMARK'} = $dns_servers{$cgiparams{'ID'}}[3];
758 &Header
::openbox
('100%', 'left', $Lang::tr
{'dnsforward add a new entry'});
761 my $tls_required_image;
763 # If the protocol is TLS, dispaly the required image.
764 if ($settings{'PROTO'} eq "TLS") {
765 $tls_required_image = "<img src='/blob.gif' alt='*'>";
768 # Add hidden input to store the mode.
769 print "<input type='hidden' name='MODE' value='$cgiparams{'SERVERS'}'>\n";
774 <td width='20%' class='base'>$Lang::tr{'ip address'}: <img src='/blob.gif' alt='*' /></td>
775 <td><input type='text' name='NAMESERVER' value='$cgiparams{"NAMESERVER"}' size='24' /></td>
780 <td width='20%' class='base'>$Lang::tr{'dns tls hostname'}: $tls_required_image</td>
781 <td><input type='text' name='TLS_HOSTNAME' value='$cgiparams{'TLS_HOSTNAME'}' size='24'></td>
786 <td width ='20%' class='base'>$Lang::tr{'remark'}:</td>
787 <td><input type='text' name='REMARK' value='$cgiparams{'REMARK'}' size='40' maxlength='50' /></td>
796 <td class='base' width='55%'><img src='/blob.gif' alt ='*' align='top' /> $Lang::tr{'required field'}</td>
797 <td width='40%' align='right'>
798 <input type="submit" name="SERVERS" value="$buttontext">
799 <input type="submit" name="SERVERS" value="$Lang::tr{'back'}">
812 # Private function to handle the restart of unbound and more.
813 sub _handle_unbound_and_more
() {
815 system('/usr/local/bin/unboundctrl reload >/dev/null');
817 # Check if the IDS is running.
818 if(&IDS
::ids_is_running
()) {
819 # Re-generate the file which contains the DNS Server
821 &IDS
::generate_dns_servers_file
();
823 # Call suricatactrl to perform a reload.
824 &IDS
::call_suricatactrl
("restart");
828 # Check if the system is online (RED is connected).
829 sub red_is_active
() {
830 # Check if the "active" file is present.
831 if ( -f
"${General::swroot}/red/active") {
835 # Return nothing - False.
840 # Function to check a given nameserver against propper work.
841 sub check_nameserver
($$$$) {
842 my ($nameserver, $record, $proto, $tls_hostname) = @_;
844 # Check if the system is online.
845 unless (&red_is_active
()) {
846 return "$Lang::tr{'system is offline'}";
850 my @command = ("kdig", "+timeout=2", "+retry=0", "+dnssec",
853 # Handle different protols.
854 if ($proto eq "TCP") {
855 # Add TCP switch to the command.
856 push(@command, "+tcp");
858 } elsif($proto eq "TLS") {
859 # Add TLS switch to the command and provide the
860 # path to our file which contains the ca certs.
861 push(@command, "+tls-ca=$ca_certs_file");
863 # Check if a TLS hostname has been provided.
865 # Add TLS hostname to the command.
866 push(@command, "+tls-hostname=$tls_hostname");
868 return "$Lang::tr{'dns no tls hostname given'}";
872 # Add record to the command array.
873 push(@command, "$record");
875 # Add nameserver to the command array.
876 push(@command, "\@$nameserver");
878 # Connect to STDOUT and STDERR.
879 push(@command, "2>&1");
881 my @output = qx(@command);
882 my $output = join("", @output);
886 if ($output =~ m/status: (\w+)/) {
887 $status = ($1 eq "NOERROR");
895 while ($output =~ m/WARNING: (.*)/g) {
896 # Add the current grabbed warning to the warning string.
900 # Return the warning string, if we grabbed at least one.
907 if ($output =~ m/Flags: (.*);/) {
908 @flags = split(/ /, $1);
911 my $aware = ($output =~ m/RRSIG/);
912 my $validating = (grep(/ad;/, @flags));
914 return $aware + $validating;