]>
Commit | Line | Data |
---|---|---|
8e65cfb6 | 1 | # |
2 | # setup-openssh-keys.pl: | |
7c25a6d7 | 3 | # Generates the host keys for the openssh install. |
8e65cfb6 | 4 | # |
5 | # Send comments/fixes/suggestions to: | |
6 | # Chase Phillips <cphillip@ncsa.uiuc.edu> | |
7 | # | |
8 | ||
9 | $gpath = $ENV{GLOBUS_LOCATION}; | |
10 | if (!defined($gpath)) | |
11 | { | |
12 | die "GLOBUS_LOCATION needs to be set before running this script" | |
13 | } | |
14 | ||
15 | # | |
16 | # i'm including this because other perl scripts in the gpt setup directories | |
17 | # do so | |
18 | # | |
19 | ||
20 | @INC = (@INC, "$gpath/lib/perl"); | |
21 | ||
22 | require Grid::GPT::Setup; | |
23 | ||
24 | my $globusdir = $gpath; | |
25 | my $setupdir = "$globusdir/setup/globus"; | |
26 | my $myname = "setup-openssh-keys.pl"; | |
27 | ||
28 | print "$myname: Configuring keys for package 'gsi_openssh'...\n"; | |
29 | ||
30 | # | |
31 | # Set up path prefixes for use in the path translations | |
32 | # | |
33 | ||
34 | $prefix = ${globusdir}; | |
35 | $exec_prefix = "${prefix}"; | |
36 | $bindir = "${exec_prefix}/bin"; | |
8e65cfb6 | 37 | $sysconfdir = "/etc"; |
38 | ||
39 | sub runkeygen | |
40 | { | |
41 | print "Generating ssh keys (if necessary)...\n"; | |
42 | if ( -e "${sysconfdir}/ssh_host_key" ) | |
43 | { | |
44 | print "${sysconfdir}/ssh_host_key already exists, skipping.\n"; | |
45 | } | |
46 | else | |
47 | { | |
48 | # if $sysconfdir/ssh_host_key doesn't exist.. | |
49 | system("$bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N \"\""); | |
50 | } | |
51 | ||
52 | if ( -e "${sysconfdir}/ssh_host_dsa_key" ) | |
53 | { | |
54 | print "${sysconfdir}/ssh_host_dsa_key already exists, skipping.\n"; | |
55 | } | |
56 | else | |
57 | { | |
58 | # if $sysconfdir/ssh_host_dsa_key doesn't exist.. | |
59 | system("$bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N \"\""); | |
60 | } | |
61 | ||
62 | if ( -e "${sysconfdir}/ssh_host_rsa_key" ) | |
63 | { | |
64 | print "${sysconfdir}/ssh_host_rsa_key already exists, skipping.\n"; | |
65 | } | |
66 | else | |
67 | { | |
68 | # if $sysconfdir/ssh_host_rsa_key doesn't exist.. | |
69 | system("$bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N \"\""); | |
70 | } | |
71 | ||
72 | return 0; | |
73 | } | |
74 | ||
8e65cfb6 | 75 | runkeygen(); |