diff options
author | Colin Watson <cjwatson@debian.org> | 2011-09-06 09:45:52 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2011-09-06 09:45:52 +0100 |
commit | f38224d546cdde55f45c13d3d8225d273a3f920e (patch) | |
tree | a91a26b88ac90dc72d0ea3767feabb341eaa50a8 /contrib/cygwin/ssh-user-config | |
parent | 338146a3fc257e216fe5c10fe40e6896b40d7739 (diff) | |
parent | e90790abaf031e037f444a6658e136e48577ea49 (diff) |
merge 5.9p1
Diffstat (limited to 'contrib/cygwin/ssh-user-config')
-rw-r--r-- | contrib/cygwin/ssh-user-config | 84 |
1 files changed, 17 insertions, 67 deletions
diff --git a/contrib/cygwin/ssh-user-config b/contrib/cygwin/ssh-user-config index f1a001a93..027ae6032 100644 --- a/contrib/cygwin/ssh-user-config +++ b/contrib/cygwin/ssh-user-config | |||
@@ -39,85 +39,34 @@ pwdhome= | |||
39 | with_passphrase= | 39 | with_passphrase= |
40 | 40 | ||
41 | # ====================================================================== | 41 | # ====================================================================== |
42 | # Routine: create_ssh1_identity | 42 | # Routine: create_identity |
43 | # optionally create ~/.ssh/identity[.pub] | 43 | # optionally create identity of type argument in ~/.ssh |
44 | # optionally add result to ~/.ssh/authorized_keys | 44 | # optionally add result to ~/.ssh/authorized_keys |
45 | # ====================================================================== | 45 | # ====================================================================== |
46 | create_ssh1_identity() { | 46 | create_identity() { |
47 | if [ ! -f "${pwdhome}/.ssh/identity" ] | 47 | local file="$1" |
48 | local type="$2" | ||
49 | local name="$3" | ||
50 | if [ ! -f "${pwdhome}/.ssh/${file}" ] | ||
48 | then | 51 | then |
49 | if csih_request "Shall I create an SSH1 RSA identity file for you?" | 52 | if csih_request "Shall I create a ${name} identity file for you?" |
50 | then | 53 | then |
51 | csih_inform "Generating ${pwdhome}/.ssh/identity" | 54 | csih_inform "Generating ${pwdhome}/.ssh/${file}" |
52 | if [ "${with_passphrase}" = "yes" ] | 55 | if [ "${with_passphrase}" = "yes" ] |
53 | then | 56 | then |
54 | ssh-keygen -t rsa1 -N "${passphrase}" -f "${pwdhome}/.ssh/identity" > /dev/null | 57 | ssh-keygen -t "${type}" -N "${passphrase}" -f "${pwdhome}/.ssh/${file}" > /dev/null |
55 | else | 58 | else |
56 | ssh-keygen -t rsa1 -f "${pwdhome}/.ssh/identity" > /dev/null | 59 | ssh-keygen -t "${type}" -f "${pwdhome}/.ssh/${file}" > /dev/null |
57 | fi | 60 | fi |
58 | if csih_request "Do you want to use this identity to login to this machine?" | 61 | if csih_request "Do you want to use this identity to login to this machine?" |
59 | then | 62 | then |
60 | csih_inform "Adding to ${pwdhome}/.ssh/authorized_keys" | 63 | csih_inform "Adding to ${pwdhome}/.ssh/authorized_keys" |
61 | cat "${pwdhome}/.ssh/identity.pub" >> "${pwdhome}/.ssh/authorized_keys" | 64 | cat "${pwdhome}/.ssh/${file}.pub" >> "${pwdhome}/.ssh/authorized_keys" |
62 | fi | 65 | fi |
63 | fi | 66 | fi |
64 | fi | 67 | fi |
65 | } # === End of create_ssh1_identity() === # | 68 | } # === End of create_ssh1_identity() === # |
66 | readonly -f create_ssh1_identity | 69 | readonly -f create_identity |
67 | |||
68 | # ====================================================================== | ||
69 | # Routine: create_ssh2_rsa_identity | ||
70 | # optionally create ~/.ssh/id_rsa[.pub] | ||
71 | # optionally add result to ~/.ssh/authorized_keys | ||
72 | # ====================================================================== | ||
73 | create_ssh2_rsa_identity() { | ||
74 | if [ ! -f "${pwdhome}/.ssh/id_rsa" ] | ||
75 | then | ||
76 | if csih_request "Shall I create an SSH2 RSA identity file for you?" | ||
77 | then | ||
78 | csih_inform "Generating ${pwdhome}/.ssh/id_rsa" | ||
79 | if [ "${with_passphrase}" = "yes" ] | ||
80 | then | ||
81 | ssh-keygen -t rsa -N "${passphrase}" -f "${pwdhome}/.ssh/id_rsa" > /dev/null | ||
82 | else | ||
83 | ssh-keygen -t rsa -f "${pwdhome}/.ssh/id_rsa" > /dev/null | ||
84 | fi | ||
85 | if csih_request "Do you want to use this identity to login to this machine?" | ||
86 | then | ||
87 | csih_inform "Adding to ${pwdhome}/.ssh/authorized_keys" | ||
88 | cat "${pwdhome}/.ssh/id_rsa.pub" >> "${pwdhome}/.ssh/authorized_keys" | ||
89 | fi | ||
90 | fi | ||
91 | fi | ||
92 | } # === End of create_ssh2_rsa_identity() === # | ||
93 | readonly -f create_ssh2_rsa_identity | ||
94 | |||
95 | # ====================================================================== | ||
96 | # Routine: create_ssh2_dsa_identity | ||
97 | # optionally create ~/.ssh/id_dsa[.pub] | ||
98 | # optionally add result to ~/.ssh/authorized_keys | ||
99 | # ====================================================================== | ||
100 | create_ssh2_dsa_identity() { | ||
101 | if [ ! -f "${pwdhome}/.ssh/id_dsa" ] | ||
102 | then | ||
103 | if csih_request "Shall I create an SSH2 DSA identity file for you?" | ||
104 | then | ||
105 | csih_inform "Generating ${pwdhome}/.ssh/id_dsa" | ||
106 | if [ "${with_passphrase}" = "yes" ] | ||
107 | then | ||
108 | ssh-keygen -t dsa -N "${passphrase}" -f "${pwdhome}/.ssh/id_dsa" > /dev/null | ||
109 | else | ||
110 | ssh-keygen -t dsa -f "${pwdhome}/.ssh/id_dsa" > /dev/null | ||
111 | fi | ||
112 | if csih_request "Do you want to use this identity to login to this machine?" | ||
113 | then | ||
114 | csih_inform "Adding to ${pwdhome}/.ssh/authorized_keys" | ||
115 | cat "${pwdhome}/.ssh/id_dsa.pub" >> "${pwdhome}/.ssh/authorized_keys" | ||
116 | fi | ||
117 | fi | ||
118 | fi | ||
119 | } # === End of create_ssh2_dsa_identity() === # | ||
120 | readonly -f create_ssh2_dsa_identity | ||
121 | 70 | ||
122 | # ====================================================================== | 71 | # ====================================================================== |
123 | # Routine: check_user_homedir | 72 | # Routine: check_user_homedir |
@@ -311,9 +260,10 @@ fi | |||
311 | 260 | ||
312 | check_user_homedir | 261 | check_user_homedir |
313 | check_user_dot_ssh_dir | 262 | check_user_dot_ssh_dir |
314 | create_ssh1_identity | 263 | create_identity id_rsa rsa "SSH2 RSA" |
315 | create_ssh2_rsa_identity | 264 | create_identity id_dsa dsa "SSH2 DSA" |
316 | create_ssh2_dsa_identity | 265 | create_identity id_ecdsa ecdsa "SSH2 ECDSA" |
266 | create_identity identity rsa1 "(deprecated) SSH1 RSA" | ||
317 | fix_authorized_keys_perms | 267 | fix_authorized_keys_perms |
318 | 268 | ||
319 | echo | 269 | echo |