initial commit of file from CVS for e-smith-tinydns on Wed 12 Jul 09:11:00 BST 2023
This commit is contained in:
		
							
								
								
									
										30
									
								
								root/etc/e-smith/db/hosts/migrate/20tinydns
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								root/etc/e-smith/db/hosts/migrate/20tinydns
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
{
 | 
			
		||||
    use esmith::ConfigDB;
 | 
			
		||||
    my $confdb     = esmith::ConfigDB->open_ro;
 | 
			
		||||
    return unless $confdb;
 | 
			
		||||
 | 
			
		||||
    my $systemname = $confdb->get_value('SystemName');
 | 
			
		||||
    my $domainname = $confdb->get_value('DomainName');
 | 
			
		||||
    return unless $systemname && $domainname; # nothing to do
 | 
			
		||||
 | 
			
		||||
    my $fqdn       = "$systemname.$domainname";
 | 
			
		||||
 | 
			
		||||
    # Make sure that the ReverseDNS property of the proper name of the server
 | 
			
		||||
    # is set to "yes", unless the $LocalIP has a configured PTR record already.
 | 
			
		||||
    my $self_host  = undef;
 | 
			
		||||
    foreach my $host ( $DB->get_all() )
 | 
			
		||||
    {
 | 
			
		||||
        next unless $host->prop('HostType') eq 'Self';
 | 
			
		||||
        if ( $host->{key} eq $fqdn )
 | 
			
		||||
        {
 | 
			
		||||
            $self_host = $host;
 | 
			
		||||
        }
 | 
			
		||||
        if ( $host->prop('ReverseDNS')
 | 
			
		||||
            && ( $host->prop('ReverseDNS') eq 'yes' ) )
 | 
			
		||||
        {
 | 
			
		||||
            # It already has one configured. Nothing to do.
 | 
			
		||||
	    return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    $self_host->set_prop( 'ReverseDNS', 'yes' ) if $self_host;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user