Changeset 1398 in genappalpha


Ignore:
Timestamp:
Feb 9, 2018, 3:39:23 PM (4 years ago)
Author:
ehb
Message:

validate & warn about bad hostname

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sbin/setconfig.pl

    r1396 r1398  
    255255}
    256256
     257$hostname = $$json{ 'hostname' };
     258# verify hostname matches ip address
     259{
     260    my $nametoip;
     261    if ( `which dig 2> /dev/null` ) {
     262        $nametoip = `dig +short $hostname`;
     263    } else {
     264        $nametoip = `host $hostname | awk '/has address/ { print \$4 }'`;
     265    }
     266    chomp $nametoip;
     267    if ( $nametoip ne $hostip ) {
     268        $notice .= "WARNING: the ip address from a DNS lookup [$nametoip] of the hostname [$hostname] does not match the hostip [$hostip]. This will create issues unless you really understand what you are doing!\n";
     269    }
     270}
     271
    257272my $wssport   = $https ? 443 : 80;
    258273my $wsport    = 30777;
Note: See TracChangeset for help on using the changeset viewer.