sub runKeyGen
{
my($gen_keys) = @_;
+ my $keygen = "$bindir/ssh-keygen";
- if (@$gen_keys)
+ if (@$gen_keys && -x $keygen)
{
print "Generating ssh host keys...\n";
if ( ! -f "$f" )
{
- die("Cannot find $f!");
+ printf("Cannot find $f!\n");
+ return;
}
#
# sorry for the whacky regex, but i need to verify a whole line
#
- if ( /^\s*Subsystem\s+sftp\s+\S+\s*$/ )
+ $line = $_;
+ if ( $line =~ /^\s*Subsystem\s+sftp\s+\S+\s*$/ )
{
- $_ = "Subsystem\tsftp\t$gpath/libexec/sftp-server\n";
- $_ =~ s:/+:/:g;
+ $newline = "Subsystem\tsftp\t$gpath/libexec/sftp-server\n";
+ $newline =~ s:/+:/:g;
}
- print OUT "$_";
+ elsif ( $line =~ /^\s*PidFile.*$/ )
+ {
+ $newline = "PidFile\t$gpath/var/sshd.pid\n";
+ $newline =~ s:/+:/:g;
+ }
+ else
+ {
+ $newline = $line;
+ }
+
+ print OUT "$newline";
} # while <IN>
close(OUT);
{
my ($in, $out) = @_;
- if ( ! -e $out )
+ if ( -r $in )
{
- $data = readFile($in);
- $data =~ s|\@GLOBUS_LOCATION\@|$gpath|g;
- writeFile($out, $data);
+ if ( ( -w $out ) || ( ! -e $out ) )
+ {
+ $data = readFile($in);
+ $data =~ s|\@GLOBUS_LOCATION\@|$gpath|g;
+ writeFile($out, $data);
+ action("chmod 755 $out");
+ }
}
}