summaryrefslogtreecommitdiff
path: root/contrib/cygwin/ssh-user-config
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cygwin/ssh-user-config')
-rw-r--r--contrib/cygwin/ssh-user-config84
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=
39with_passphrase= 39with_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# ======================================================================
46create_ssh1_identity() { 46create_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() === #
66readonly -f create_ssh1_identity 69readonly -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# ======================================================================
73create_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() === #
93readonly -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# ======================================================================
100create_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() === #
120readonly -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
312check_user_homedir 261check_user_homedir
313check_user_dot_ssh_dir 262check_user_dot_ssh_dir
314create_ssh1_identity 263create_identity id_rsa rsa "SSH2 RSA"
315create_ssh2_rsa_identity 264create_identity id_dsa dsa "SSH2 DSA"
316create_ssh2_dsa_identity 265create_identity id_ecdsa ecdsa "SSH2 ECDSA"
266create_identity identity rsa1 "(deprecated) SSH1 RSA"
317fix_authorized_keys_perms 267fix_authorized_keys_perms
318 268
319echo 269echo