print "What IP address do you want to allow ssh logins from? "; $_ = <>; chomp($_); # This method does not appear to do strict validation of IP addresses # While, it will check for a valod dotted quad entry, it will allow many invalid addresses. # See the following for additional hints: # http://www.perlmonks.org/index.pl?node_id=513811 # http://www.perlmonks.org/index.pl?node=221512 # For the time being, this is a sufficient check my $allowed_ipaddr = inet_aton( $_ ); length($allowed_ipaddr) or die "Sorry, '$_' is not a valid IP address.\n"; $allowed_ipaddr = inet_ntoa($allowed_ipaddr); # convert to dotted quad, if necessary. print " You have authorized the host with IP address $allowed_ipaddr to log in via ssh.\n";