]> andersk Git - gssapi-openssh.git/blob - setup/setup-openssh-keys.pl
o Add files to gsi-openssh for generating keys into /etc. Needs work.
[gssapi-openssh.git] / setup / setup-openssh-keys.pl
1 #
2 # setup-openssh-keys.pl:
3 #   Adapts the installed gsi-ssh environment to the current machine,
4 #   performing actions that originally occurred during the package's
5 #   'make install' phase.
6 #
7 # Send comments/fixes/suggestions to:
8 # Chase Phillips <cphillip@ncsa.uiuc.edu>
9 #
10
11 $gpath = $ENV{GLOBUS_LOCATION};
12 if (!defined($gpath))
13 {
14     die "GLOBUS_LOCATION needs to be set before running this script"
15 }
16
17 #
18 # i'm including this because other perl scripts in the gpt setup directories
19 # do so
20 #
21
22 @INC = (@INC, "$gpath/lib/perl");
23
24 require Grid::GPT::Setup;
25
26 my $globusdir = $gpath;
27 my $setupdir = "$globusdir/setup/globus";
28 my $myname = "setup-openssh-keys.pl";
29
30 print "$myname: Configuring keys for package 'gsi_openssh'...\n";
31
32 #
33 # Set up path prefixes for use in the path translations
34 #
35
36 $prefix = ${globusdir};
37 $exec_prefix = "${prefix}";
38 $bindir = "${exec_prefix}/bin";
39 $mandir = "${prefix}/man";
40 $mansubdir = "man";
41 $libexecdir = "${exec_prefix}/libexec";
42 $sysconfdir = "${prefix}/etc";
43 $piddir = "/var/run";
44 $xauth_path = "/usr/bin/X11/xauth";
45
46 $sysconfdir = "/etc";
47
48 sub runkeygen
49 {
50     print "Generating ssh keys (if necessary)...\n";
51     if ( -e "${sysconfdir}/ssh_host_key" )
52     {
53         print "${sysconfdir}/ssh_host_key already exists, skipping.\n";
54     }
55     else
56     {
57         # if $sysconfdir/ssh_host_key doesn't exist..
58         system("$bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N \"\"");
59     }
60
61     if ( -e "${sysconfdir}/ssh_host_dsa_key" )
62     {
63         print "${sysconfdir}/ssh_host_dsa_key already exists, skipping.\n";
64     }
65     else
66     {
67         # if $sysconfdir/ssh_host_dsa_key doesn't exist..
68         system("$bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N \"\"");
69     }
70
71     if ( -e "${sysconfdir}/ssh_host_rsa_key" )
72     {
73         print "${sysconfdir}/ssh_host_rsa_key already exists, skipping.\n";
74     }
75     else
76     {
77         # if $sysconfdir/ssh_host_rsa_key doesn't exist..
78         system("$bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N \"\"");
79     }
80
81     return 0;
82 }
83
84 fixpaths();
85 runkeygen();
86
87 my $metadata = new Grid::GPT::Setup(package_name => "gsi_openssh_setup");
88
89 $metadata->finish();
90
91 print "$myname: Finished configuring package 'gsi_openssh'.\n";
This page took 0.045461 seconds and 5 git commands to generate.