31 lines
961 B
Plaintext
31 lines
961 B
Plaintext
{
|
|
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;
|
|
}
|