3 # setup-openssh.pl - substitutes variables into text files and runs
6 # adapted from 'fixpath', located in the openssh-3.0.2p1 package
9 my $gpath = $ENV{GPT_LOCATION};
12 $gpath = $ENV{GLOBUS_LCATION};
16 die "GPT_LOCATION or GLOBUS_LOCATION needs to be set before running this script"
20 # i'm including this because other perl scripts in the gpt setup directories
24 @INC = (@INC, "$gpath/lib/perl");
26 my $globusdir = $gpath;
27 my $setupdir = "$globusdir/setup/globus";
28 my $myname = "setup-openssh.pl";
30 print "$myname: Configuring gsi-openssh package\n";
33 # Set up path prefixes for use in the path translations
36 $prefix = ${globusdir};
37 $exec_prefix = "${prefix}";
38 $bindir = "${exec_prefix}/bin";
39 $mandir = "${prefix}/man";
41 $libexecdir = "${exec_prefix}/libexec";
42 $sysconfdir = "${prefix}/etc";
44 $xauth_path = "/usr/bin/X11/xauth";
49 # Set up path translations for the installation files
53 "/etc/ssh_config" => "${sysconfdir}/ssh_config",
54 "/etc/ssh_known_hosts" => "${sysconfdir}/ssh_known_hosts",
55 "/etc/sshd_config" => "${sysconfdir}/sshd_config",
56 "/usr/libexec" => "${libexecdir}",
57 "/etc/shosts.equiv" => "${sysconfdir}/shosts.equiv",
58 "/etc/ssh_host_key" => "${sysconfdir}/ssh_host_key",
59 "/etc/ssh_host_dsa_key" => "${sysconfdir}/ssh_host_dsa_key",
60 "/etc/ssh_host_rsa_key" => "${sysconfdir}/ssh_host_rsa_key",
61 "/var/run/sshd.pid" => "${piddir}/sshd.pid",
62 "/etc/moduli" => "${sysconfdir}/moduli",
63 "/etc/sshrc" => "${sysconfdir}/sshrc",
64 "/usr/X11R6/bin/xauth" => "${xauth_path}",
65 "/usr/bin:/bin:/usr/sbin:/sbin" => "/usr/bin:/bin:/usr/sbin:/sbin:${bindir}",
69 # Files on which to perform path translations
73 "${sysconfdir}/ssh_config",
74 "${sysconfdir}/sshd_config",
75 "${sysconfdir}/moduli",
76 "${mandir}/${mansubdir}1/scp.1",
77 "${mandir}/${mansubdir}1/ssh-add.1",
78 "${mandir}/${mansubdir}1/ssh-agent.1",
79 "${mandir}/${mansubdir}1/ssh-keygen.1",
80 "${mandir}/${mansubdir}1/ssh-keyscan.1",
81 "${mandir}/${mansubdir}1/ssh.1",
82 "${mandir}/${mansubdir}8/sshd.8",
83 "${mandir}/${mansubdir}8/sftp-server.8",
84 "${mandir}/${mansubdir}1/sftp.1",
87 print "\nTranslating strings in config/man files..\n";
93 $result = system("cp $f $g");
96 die "Failed to copy $f to $g!\n";
99 open(IN, "<$g") || die ("$0: input file $g missing!\n");
100 open(OUT, ">$f") || die ("$0: unable to open output file $f!\n");
114 $result = system("rm $g");
117 die "Failed to remove $g\n";
126 print "\nGenerating ssh keys (if necessary)..\n";
127 if ( -e "${sysconfdir}/ssh_host_key" )
129 print "${sysconfdir}/ssh_host_key already exists, skipping.\n";
133 # if $sysconfdir/ssh_host_key doesn't exist..
134 system("$bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N \"\"");
137 if ( -e "${sysconfdir}/ssh_host_dsa_key" )
139 print "${sysconfdir}/ssh_host_dsa_key already exists, skipping.\n";
143 # if $sysconfdir/ssh_host_dsa_key doesn't exist..
144 system("$bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N \"\"");
147 if ( -e "${sysconfdir}/ssh_host_rsa_key" )
149 print "${sysconfdir}/ssh_host_rsa_key already exists, skipping.\n";
153 # if $sysconfdir/ssh_host_rsa_key doesn't exist..
154 system("$bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N \"\"");