mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Zone transfer test page
This commit is contained in:
@@ -125,3 +125,5 @@ Added the Delete Records In Selected button to the main page, for removing the s
|
||||
The default view for new zones can now be set via an option on the Module Config page.
|
||||
When adding cluster slave servers, their IPs are added to the also-notify and allow-transfer blocks of each domain added to the slave.
|
||||
IPv6 addresses can now be used for remote nameservers in slave and delegation zones.
|
||||
---- Changes since 1.540 ----
|
||||
Added the Test Zone Transfer button to the slave zone page, to check if zone transfers are possible or not.
|
||||
|
||||
@@ -3279,5 +3279,39 @@ if (&find_byname("nscd")) {
|
||||
}
|
||||
}
|
||||
|
||||
# transfer_slave_records(zone, &masters, [file])
|
||||
# Transfer DNS records from a master into some file. Returns a map from master
|
||||
# IPs to errors.
|
||||
sub transfer_slave_records
|
||||
{
|
||||
my ($dom, $masters, $file) = @_;
|
||||
my %rv;
|
||||
my $dig = &has_command("dig");
|
||||
foreach my $ip (@$masters) {
|
||||
if (!$dig) {
|
||||
$rv{$ip} = "Missing dig command";
|
||||
}
|
||||
else {
|
||||
my $out = &backquote_logged("$dig IN AXFR ".quotemeta($dom).
|
||||
" \@".quotemeta($ip)." 2>&1");
|
||||
if ($?) {
|
||||
$rv{$ip} = $out;
|
||||
}
|
||||
elsif (!$out) {
|
||||
$rv{$ip} = "No records transferred";
|
||||
}
|
||||
else {
|
||||
if ($file) {
|
||||
&open_tempfile(XFER, ">$file");
|
||||
&print_tempfile(XFER, $out);
|
||||
&close_tempfile(XFER);
|
||||
$file = undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%rv;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ if ($access{'whois'} && &has_command($config{'whois_cmd'}) &&
|
||||
push(@titles, $text{'master_whois'});
|
||||
push(@images, "images/whois.gif");
|
||||
}
|
||||
push(@links, "xfer.cgi?index=$in{'index'}&view=$in{'view'}");
|
||||
push(@titles, $text{'slave_xfer'});
|
||||
push(@images, "images/xfer.gif");
|
||||
if (@links) {
|
||||
print &ui_hr() if ($done_recs);
|
||||
&icons_table(\@links, \@titles, \@images);
|
||||
|
||||
BIN
bind8/images/xfer.gif
Normal file
BIN
bind8/images/xfer.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -192,6 +192,7 @@ slave_apply=Force Update
|
||||
slave_applymsg2=Click this button to force a re-transfer of the zone from the master server, so that it gets all the latest records.
|
||||
slave_last=Last transferred : $1
|
||||
slave_never=Never
|
||||
slave_xfer=Test Zone Transfer
|
||||
|
||||
screate_title1=Create Slave Zone
|
||||
screate_title2=Create Stub Zone
|
||||
@@ -1109,4 +1110,11 @@ trusted_ealg=Missing or invalid algorithm number in row $1
|
||||
trusted_ekey=Missing base-64 encoded trusted zone key in row $1
|
||||
trusted_setup=For DNSSEC to be useful to verify the majority of signed zones on the Internet, BIND must be configured to use a DLV server. Webmin can set this up for you, using the ICS DLV server at $1.
|
||||
trusted_ok=Setup DLV and Enable DNSSEC Verification
|
||||
|
||||
xfer_title=Test Zone Transfer
|
||||
xfer_doing=Testing transfer of slave zone from $1 ..
|
||||
xfer_failed=.. from $1 : Failed : $2
|
||||
xfer_done=.. from $1 : Completed OK
|
||||
xfer_count=Test transfer successfully fetched $1 records from at least one nameserver. Actual transfers by BIND should also succeed.
|
||||
|
||||
__norefs=1
|
||||
|
||||
51
bind8/xfer.cgi
Normal file
51
bind8/xfer.cgi
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Force a zone transfer for a slave domain
|
||||
|
||||
require './bind8-lib.pl';
|
||||
&ReadParse();
|
||||
$zone = &get_zone_name($in{'index'}, $in{'view'});
|
||||
&can_edit_zone($zone) ||
|
||||
&error($text{'master_ecannot'});
|
||||
|
||||
# Get config object
|
||||
$bconf = $conf = &get_config();
|
||||
if ($in{'view'} ne '') {
|
||||
$view = $conf->[$in{'view'}];
|
||||
$conf = $view->{'members'};
|
||||
}
|
||||
$zconf = $conf->[$in{'index'}]->{'members'};
|
||||
$file = &find_value("file", $zconf);
|
||||
|
||||
$desc = &ip6int_to_net(&arpa_to_ip($zone->{'name'}));
|
||||
&ui_print_header($desc, $text{'xfer_title'}, "",
|
||||
undef, undef, undef, undef, &restart_links($zone));
|
||||
|
||||
# Get master IPs
|
||||
$masters = &find("masters", $zconf);
|
||||
foreach $av (@{$masters->{'members'}}) {
|
||||
push(@ips, join(" ", $av->{'name'}, @{$av->{'values'}}));
|
||||
}
|
||||
print &text('xfer_doing', join(" ", @ips)),"<br>\n";
|
||||
$temp = &transname();
|
||||
$rv = &transfer_slave_records($zone->{'name'}, \@ips, $temp);
|
||||
foreach $ip (@ips) {
|
||||
if ($rv->{$ip}) {
|
||||
print &text('xfer_failed', $ip,
|
||||
"<font color=red>".&html_escape($rv->{$ip})."</font>"),
|
||||
"<br>\n";
|
||||
}
|
||||
else {
|
||||
print &text('xfer_done', $ip),"<br>\n";
|
||||
}
|
||||
}
|
||||
print "<p>\n";
|
||||
|
||||
# Show records
|
||||
if (-r $temp) {
|
||||
@recs = &read_zone_file($temp, $zone->{'name'}.".");
|
||||
print &text('xfer_count', scalar(@recs)),"<p>\n";
|
||||
}
|
||||
&unlink_file($temp);
|
||||
|
||||
&ui_print_footer("edit_slave.cgi?index=$in{'index'}&view=$in{'view'}",
|
||||
$text{'master_return'});
|
||||
Reference in New Issue
Block a user