3 # setup-openssh.pl - substitutes variables into text files and runs
6 # adapted from 'fixpath', located in the openssh-3.0.2p1 package
9 $gpath = $ENV{GLOBUS_LOCATION};
12 die "GLOBUS_LOCATION needs to be set before running this script"
16 # i'm including this because other perl scripts in the gpt setup directories
20 @INC = (@INC, "$gpath/lib/perl");
22 require Grid::GPT::Setup;
24 my $globusdir = $gpath;
25 my $setupdir = "$globusdir/setup/globus";
26 my $myname = "setup-openssh.pl";
28 print "$myname: Configuring gsi-openssh package";
31 # Set up path prefixes for use in the path translations
34 $prefix = ${globusdir};
35 $exec_prefix = "${prefix}";
36 $bindir = "${exec_prefix}/bin";
37 $mandir = "${prefix}/man";
39 $libexecdir = "${exec_prefix}/libexec";
40 $sysconfdir = "${prefix}/etc";
42 $xauth_path = "/usr/bin/X11/xauth";
47 # Set up path translations for the installation files
51 "/etc/ssh_config" => "${sysconfdir}/ssh_config",
52 "/etc/ssh_known_hosts" => "${sysconfdir}/ssh_known_hosts",
53 "/etc/sshd_config" => "${sysconfdir}/sshd_config",
54 "/usr/libexec" => "${libexecdir}",
55 "/etc/shosts.equiv" => "${sysconfdir}/shosts.equiv",
56 "/etc/ssh_host_key" => "${sysconfdir}/ssh_host_key",
57 "/etc/ssh_host_dsa_key" => "${sysconfdir}/ssh_host_dsa_key",
58 "/etc/ssh_host_rsa_key" => "${sysconfdir}/ssh_host_rsa_key",
59 "/var/run/sshd.pid" => "${piddir}/sshd.pid",
60 "/etc/moduli" => "${sysconfdir}/moduli",
61 "/etc/sshrc" => "${sysconfdir}/sshrc",
62 "/usr/X11R6/bin/xauth" => "${xauth_path}",
63 "/usr/bin:/bin:/usr/sbin:/sbin" => "/usr/bin:/bin:/usr/sbin:/sbin:${bindir}",
67 # Files on which to perform path translations
71 "${sysconfdir}/ssh_config",
72 "${sysconfdir}/sshd_config",
73 "${sysconfdir}/moduli",
74 "${mandir}/${mansubdir}1/scp.1",
75 "${mandir}/${mansubdir}1/ssh-add.1",
76 "${mandir}/${mansubdir}1/ssh-agent.1",
77 "${mandir}/${mansubdir}1/ssh-keygen.1",
78 "${mandir}/${mansubdir}1/ssh-keyscan.1",
79 "${mandir}/${mansubdir}1/ssh.1",
80 "${mandir}/${mansubdir}8/sshd.8",
81 "${mandir}/${mansubdir}8/sftp-server.8",
82 "${mandir}/${mansubdir}1/sftp.1",
85 print "Translating strings in config/man files...\n";
91 $result = system("mv $f $g");
94 die "Failed to copy $f to $g!\n";
97 open(IN, "<$g") || die ("$0: input file $g missing!\n");
98 open(OUT, ">$f") || die ("$0: unable to open output file $f!\n");
112 $result = system("rm $g");
115 die "Failed to remove $g\n";
124 print "Generating ssh keys (if necessary)...\n";
125 if ( -e "${sysconfdir}/ssh_host_key" )
127 print "${sysconfdir}/ssh_host_key already exists, skipping.\n";
131 # if $sysconfdir/ssh_host_key doesn't exist..
132 system("$bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N \"\"");
135 if ( -e "${sysconfdir}/ssh_host_dsa_key" )
137 print "${sysconfdir}/ssh_host_dsa_key already exists, skipping.\n";
141 # if $sysconfdir/ssh_host_dsa_key doesn't exist..
142 system("$bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N \"\"");
145 if ( -e "${sysconfdir}/ssh_host_rsa_key" )
147 print "${sysconfdir}/ssh_host_rsa_key already exists, skipping.\n";
151 # if $sysconfdir/ssh_host_rsa_key doesn't exist..
152 system("$bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N \"\"");
161 my $metadata = new Grid::GPT::Setup(package_name => "gsi-openssh-setup");