]> andersk Git - gssapi-openssh.git/blame - setup/setup-openssh.pl
Include for gsi-openssh setup config and man files which will be
[gssapi-openssh.git] / setup / setup-openssh.pl
CommitLineData
20d3226a 1#!/usr/bin/perl -w
2#
701aa556 3# setup-openssh.pl - substitutes variables into text files and runs
4# ssh key gen programs
5#
6# adapted from 'fixpath', located in the openssh-3.0.2p1 package
7#
20d3226a 8
9#
10# Set up path prefixes for use in the path translations
11#
12
13$prefix = "/home/cphillip/gsi-openssh/install";
14$exec_prefix = "$prefix";
15$bindir = "$exec_prefix/bin";
16$libexecdir = "$exec_prefix/libexec";
17$sysconfdir = "$prefix/etc";
18$piddir = "/var/run";
19$xauth_path = "/usr/bin/X11/xauth";
20
21sub fixpaths
22{
23 #
24 # Set up path translations for the installation files
25 #
26
27 %def = (
28 "/etc/ssh_config" => "${sysconfdir}/ssh_config",
29 "/etc/ssh_known_hosts" => "${sysconfdir}/ssh_known_hosts",
30 "/etc/sshd_config" => "${sysconfdir}/sshd_config",
31 "/usr/libexec" => "${libexecdir}",
32 "/etc/shosts.equiv" => "${sysconfdir}/shosts.equiv",
33 "/etc/ssh_host_key" => "${sysconfdir}/ssh_host_key",
34 "/etc/ssh_host_dsa_key" => "${sysconfdir}/ssh_host_dsa_key",
35 "/etc/ssh_host_rsa_key" => "${sysconfdir}/ssh_host_rsa_key",
36 "/var/run/sshd.pid" => "${piddir}/sshd.pid",
37 "/etc/moduli" => "${sysconfdir}/moduli",
38 "/etc/sshrc" => "${sysconfdir}/sshrc",
39 "/usr/X11R6/bin/xauth" => "${xauth_path}",
40 "/usr/bin:/bin:/usr/sbin:/sbin" => "/usr/bin:/bin:/usr/sbin:/sbin:${bindir}",
41 );
42
20d3226a 43 #
44 # Files on which to perform path translations
45 #
46
47 @files = (
48 "ssh_config",
49 "sshd_config",
50 "moduli",
51 "scp.1",
52 "ssh-add.1",
53 "ssh-agent.1",
54 "ssh-keygen.1",
55 "ssh-keyscan.1",
56 "ssh.1",
57 "sshd.8",
58 "sftp-server.8",
59 "sftp.1",
60 );
61
701aa556 62 print "\nTranslating strings in config/man files..\n";
20d3226a 63 for $f (@files)
64 {
65 $f =~ /(.*\/)*(.*)$/;
66 $g = "$f.out";
67
68 open(IN, "<$f") || die ("$0: input file $f missing!\n");
69
70 if ( -e $g )
71 {
72 print "$g already exists, skipping.\n";
73 }
74 else
75 {
76 open(OUT, ">$g") || die ("$0: unable to open output file $g!\n");
77
78 while (<IN>)
79 {
80 for $s (keys(%def))
81 {
82 s#$s#$def{$s}#;
83 } # for $s
84 print OUT "$_";
85 } # while <IN>
86
87 close(OUT);
88 }
89
90 close(IN);
91 } # for $f
92
93 return 0;
94}
95
96sub runkeygen
97{
701aa556 98 print "\nGenerating ssh keys (if necessary)..\n";
20d3226a 99 if ( -e "${sysconfdir}/ssh_host_key" )
100 {
101 print "${sysconfdir}/ssh_host_key already exists, skipping.\n";
102 }
103 else
104 {
105 # if $sysconfdir/ssh_host_key doesn't exist..
106 system("$bindir/ssh-keygen -t rsa1 -f $sysconfdir/ssh_host_key -N \"\"");
107 }
108
109 if ( -e "${sysconfdir}/ssh_host_dsa_key" )
110 {
111 print "${sysconfdir}/ssh_host_dsa_key already exists, skipping.\n";
112 }
113 else
114 {
115 # if $sysconfdir/ssh_host_dsa_key doesn't exist..
116 system("$bindir/ssh-keygen -t dsa -f $sysconfdir/ssh_host_dsa_key -N \"\"");
117 }
118
119 if ( -e "${sysconfdir}/ssh_host_rsa_key" )
120 {
121 print "${sysconfdir}/ssh_host_rsa_key already exists, skipping.\n";
122 }
123 else
124 {
125 # if $sysconfdir/ssh_host_rsa_key doesn't exist..
126 system("$bindir/ssh-keygen -t rsa -f $sysconfdir/ssh_host_rsa_key -N \"\"");
127 }
128
129 return 0;
130}
131
132fixpaths();
133
134runkeygen();
This page took 0.089212 seconds and 5 git commands to generate.