diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | auth1.c | 2 | ||||
-rw-r--r-- | auth2-pam.c | 6 | ||||
-rw-r--r-- | contrib/cygwin/README | 35 | ||||
-rw-r--r--[-rwxr-xr-x] | contrib/cygwin/ssh-host-config (renamed from contrib/cygwin/ssh-config) | 168 | ||||
-rw-r--r-- | contrib/cygwin/ssh-user-config | 200 | ||||
-rw-r--r-- | session.c | 1 |
7 files changed, 346 insertions, 67 deletions
@@ -19,6 +19,7 @@ | |||
19 | rename *-skey.c *-chall.c since the files are not skey specific | 19 | rename *-skey.c *-chall.c since the files are not skey specific |
20 | - (djm) Merge patch from Tim Waugh (via Nalin Dahyabhai <nalin@redhat.com>) | 20 | - (djm) Merge patch from Tim Waugh (via Nalin Dahyabhai <nalin@redhat.com>) |
21 | to fix NULL pointer deref and fake authloop breakage in PAM code. | 21 | to fix NULL pointer deref and fake authloop breakage in PAM code. |
22 | - (bal) Updated contrib/cygwin/ by Corinna Vinschen <vinschen@redhat.com> | ||
22 | 23 | ||
23 | 20010118 | 24 | 20010118 |
24 | - (bal) Super Sized OpenBSD Resync | 25 | - (bal) Super Sized OpenBSD Resync |
@@ -95,7 +95,7 @@ do_authloop(Authctxt *authctxt) | |||
95 | #ifdef KRB4 | 95 | #ifdef KRB4 |
96 | (!options.kerberos_authentication || options.kerberos_or_local_passwd) && | 96 | (!options.kerberos_authentication || options.kerberos_or_local_passwd) && |
97 | #endif | 97 | #endif |
98 | #ifdef USE_PAM /* ISSUE: Right?? */ | 98 | #ifdef USE_PAM |
99 | auth_pam_password(pw, password)) { | 99 | auth_pam_password(pw, password)) { |
100 | #else | 100 | #else |
101 | auth_password(pw, "")) { | 101 | auth_password(pw, "")) { |
diff --git a/auth2-pam.c b/auth2-pam.c index d1d840972..adb36163e 100644 --- a/auth2-pam.c +++ b/auth2-pam.c | |||
@@ -1,5 +1,5 @@ | |||
1 | #include "includes.h" | 1 | #include "includes.h" |
2 | RCSID("$Id: auth2-pam.c,v 1.4 2001/01/19 04:46:38 djm Exp $"); | 2 | RCSID("$Id: auth2-pam.c,v 1.5 2001/01/19 05:37:32 mouring Exp $"); |
3 | 3 | ||
4 | #ifdef USE_PAM | 4 | #ifdef USE_PAM |
5 | #include "ssh.h" | 5 | #include "ssh.h" |
@@ -44,10 +44,6 @@ auth2_pam(Authctxt *authctxt) | |||
44 | retval = (do_pam_authenticate(0) == PAM_SUCCESS); | 44 | retval = (do_pam_authenticate(0) == PAM_SUCCESS); |
45 | dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE, NULL); | 45 | dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE, NULL); |
46 | 46 | ||
47 | #if 0 /* ISSUE: No longer valid, but should this still be | ||
48 | handled?? */ | ||
49 | userauth_log(authctxt, retval, method); | ||
50 | #endif | ||
51 | return retval; | 47 | return retval; |
52 | } | 48 | } |
53 | 49 | ||
diff --git a/contrib/cygwin/README b/contrib/cygwin/README index 8c9d0bb73..ac0955836 100644 --- a/contrib/cygwin/README +++ b/contrib/cygwin/README | |||
@@ -20,18 +20,41 @@ of the files has changed from /usr/local to /usr. The global configuration | |||
20 | files are in /etc now. | 20 | files are in /etc now. |
21 | 21 | ||
22 | If you are installing OpenSSH the first time, you can generate | 22 | If you are installing OpenSSH the first time, you can generate |
23 | global config files, server keys and your own user keys by running | 23 | global config files and server keys by running |
24 | 24 | ||
25 | /usr/bin/ssh-config | 25 | /usr/bin/ssh-host-config |
26 | 26 | ||
27 | If you are updating your installation you may run the above ssh-config | 27 | Note that this binary archive doesn't contain default config files in /etc. |
28 | That files are only created if ssh-host-config is started. | ||
29 | |||
30 | If you are updating your installation you may run the above ssh-host-config | ||
28 | as well to move your configuration files to the new location and to | 31 | as well to move your configuration files to the new location and to |
29 | erase the files at the old location. | 32 | erase the files at the old location. |
30 | 33 | ||
31 | Be sure to start the new ssh-config when updating! | 34 | To support testing and unattended installation ssh-host-config got |
35 | some options: | ||
32 | 36 | ||
33 | Note that this binary archive doesn't contain default config files in /etc. | 37 | usage: ssh-host-config [OPTION]... |
34 | That files are only created if ssh-config is started. | 38 | Options: |
39 | --debug -d Enable shell's debug output. | ||
40 | --yes -y Answer all questions with "yes" automatically. | ||
41 | --no -n Answer all questions with "no" automatically. | ||
42 | |||
43 | You can create the private and public keys for a user now by running | ||
44 | |||
45 | /usr/bin/ssh-user-config | ||
46 | |||
47 | under the users account. | ||
48 | |||
49 | To support testing and unattended installation ssh-user-config got | ||
50 | some options as well: | ||
51 | |||
52 | usage: ssh-user-config [OPTION]... | ||
53 | Options: | ||
54 | --debug -d Enable shell's debug output. | ||
55 | --yes -y Answer all questions with "yes" automatically. | ||
56 | --no -n Answer all questions with "no" automatically. | ||
57 | --passphrase -p word Use "word" as passphrase automatically. | ||
35 | 58 | ||
36 | Install sshd as daemon via SRVANY.EXE (recommended on NT/W2K), via inetd | 59 | Install sshd as daemon via SRVANY.EXE (recommended on NT/W2K), via inetd |
37 | (results in very slow deamon startup!) or from the command line (recommended | 60 | (results in very slow deamon startup!) or from the command line (recommended |
diff --git a/contrib/cygwin/ssh-config b/contrib/cygwin/ssh-host-config index 20c8cceb0..6fe2c7795 100755..100644 --- a/contrib/cygwin/ssh-config +++ b/contrib/cygwin/ssh-host-config | |||
@@ -1,11 +1,9 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # ssh-config, Copyright 2000, Red Hat Inc. | 3 | # ssh-host-config, Copyright 2000, Red Hat Inc. |
4 | # | 4 | # |
5 | # This file is part of the Cygwin port of OpenSSH. | 5 | # This file is part of the Cygwin port of OpenSSH. |
6 | 6 | ||
7 | # set -x | ||
8 | |||
9 | # Subdirectory where the new package is being installed | 7 | # Subdirectory where the new package is being installed |
10 | PREFIX=/usr | 8 | PREFIX=/usr |
11 | 9 | ||
@@ -16,8 +14,19 @@ SYSCONFDIR=/etc | |||
16 | OLDPREFIX=/usr/local | 14 | OLDPREFIX=/usr/local |
17 | OLDSYSCONFDIR=${OLDPREFIX}/etc | 15 | OLDSYSCONFDIR=${OLDPREFIX}/etc |
18 | 16 | ||
17 | progname=$0 | ||
18 | auto_answer="" | ||
19 | |||
19 | request() | 20 | request() |
20 | { | 21 | { |
22 | if [ "${auto_answer}" = "yes" ] | ||
23 | then | ||
24 | return 0 | ||
25 | elif [ "${auto_answer}" = "no" ] | ||
26 | then | ||
27 | return 1 | ||
28 | fi | ||
29 | |||
21 | answer="" | 30 | answer="" |
22 | while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ] | 31 | while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ] |
23 | do | 32 | do |
@@ -32,6 +41,48 @@ request() | |||
32 | fi | 41 | fi |
33 | } | 42 | } |
34 | 43 | ||
44 | # Check options | ||
45 | |||
46 | while : | ||
47 | do | ||
48 | case $# in | ||
49 | 0) | ||
50 | break | ||
51 | ;; | ||
52 | esac | ||
53 | |||
54 | option=$1 | ||
55 | shift | ||
56 | |||
57 | case "$option" in | ||
58 | -d | --debug ) | ||
59 | set -x | ||
60 | ;; | ||
61 | |||
62 | -y | --yes ) | ||
63 | auto_answer=yes | ||
64 | ;; | ||
65 | |||
66 | -n | --no ) | ||
67 | auto_answer=no | ||
68 | ;; | ||
69 | |||
70 | *) | ||
71 | echo "usage: ${progname} [OPTION]..." | ||
72 | echo | ||
73 | echo "This script creates an OpenSSH host configuration." | ||
74 | echo | ||
75 | echo "Options:" | ||
76 | echo " --debug -d Enable shell's debug output." | ||
77 | echo " --yes -y Answer all questions with \"yes\" automatically." | ||
78 | echo " --no -n Answer all questions with \"no\" automatically." | ||
79 | echo | ||
80 | exit 1 | ||
81 | ;; | ||
82 | |||
83 | esac | ||
84 | done | ||
85 | |||
35 | # Check for running ssh/sshd processes first. Refuse to do anything while | 86 | # Check for running ssh/sshd processes first. Refuse to do anything while |
36 | # some ssh processes are still running | 87 | # some ssh processes are still running |
37 | 88 | ||
@@ -71,6 +122,7 @@ fi | |||
71 | # Check for an old installation in ${OLDPREFIX} unless ${OLDPREFIX} isn't | 122 | # Check for an old installation in ${OLDPREFIX} unless ${OLDPREFIX} isn't |
72 | # the same as ${PREFIX} | 123 | # the same as ${PREFIX} |
73 | 124 | ||
125 | old_install=0 | ||
74 | if [ "${OLDPREFIX}" != "${PREFIX}" ] | 126 | if [ "${OLDPREFIX}" != "${PREFIX}" ] |
75 | then | 127 | then |
76 | if [ -f "${OLDPREFIX}/sbin/sshd" ] | 128 | if [ -f "${OLDPREFIX}/sbin/sshd" ] |
@@ -116,6 +168,7 @@ then | |||
116 | rm -f ${OLDPREFIX}/sbin/sshd.exe | 168 | rm -f ${OLDPREFIX}/sbin/sshd.exe |
117 | rm -f ${OLDPREFIX}/sbin/sftp-server.exe | 169 | rm -f ${OLDPREFIX}/sbin/sftp-server.exe |
118 | fi | 170 | fi |
171 | old_install=1 | ||
119 | fi | 172 | fi |
120 | fi | 173 | fi |
121 | 174 | ||
@@ -124,13 +177,19 @@ fi | |||
124 | if [ ! -f "${SYSCONFDIR}/ssh_host_key" ] | 177 | if [ ! -f "${SYSCONFDIR}/ssh_host_key" ] |
125 | then | 178 | then |
126 | echo "Generating ${SYSCONFDIR}/ssh_host_key" | 179 | echo "Generating ${SYSCONFDIR}/ssh_host_key" |
127 | ssh-keygen -f ${SYSCONFDIR}/ssh_host_key -N '' | 180 | ssh-keygen -t rsa1 -f ${SYSCONFDIR}/ssh_host_key -N '' > /dev/null |
181 | fi | ||
182 | |||
183 | if [ ! -f "${SYSCONFDIR}/ssh_host_rsa_key" ] | ||
184 | then | ||
185 | echo "Generating ${SYSCONFDIR}/ssh_host_rsa_key" | ||
186 | ssh-keygen -t rsa -f ${SYSCONFDIR}/ssh_host_rsa_key -N '' > /dev/null | ||
128 | fi | 187 | fi |
129 | 188 | ||
130 | if [ ! -f "${SYSCONFDIR}/ssh_host_dsa_key" ] | 189 | if [ ! -f "${SYSCONFDIR}/ssh_host_dsa_key" ] |
131 | then | 190 | then |
132 | echo "Generating ${SYSCONFDIR}/ssh_host_dsa_key" | 191 | echo "Generating ${SYSCONFDIR}/ssh_host_dsa_key" |
133 | ssh-keygen -d -f ${SYSCONFDIR}/ssh_host_dsa_key -N '' | 192 | ssh-keygen -t dsa -f ${SYSCONFDIR}/ssh_host_dsa_key -N '' > /dev/null |
134 | fi | 193 | fi |
135 | 194 | ||
136 | # Check if ssh_config exists. If yes, ask for overwriting | 195 | # Check if ssh_config exists. If yes, ask for overwriting |
@@ -151,7 +210,7 @@ fi | |||
151 | 210 | ||
152 | if [ ! -f "${SYSCONFDIR}/ssh_config" ] | 211 | if [ ! -f "${SYSCONFDIR}/ssh_config" ] |
153 | then | 212 | then |
154 | echo "Creating default ${SYSCONFDIR}/ssh_config file" | 213 | echo "Generating ${SYSCONFDIR}/ssh_config file" |
155 | cat > ${SYSCONFDIR}/ssh_config << EOF | 214 | cat > ${SYSCONFDIR}/ssh_config << EOF |
156 | # This is ssh client systemwide configuration file. This file provides | 215 | # This is ssh client systemwide configuration file. This file provides |
157 | # defaults for users, and the values can be changed in per-user configuration | 216 | # defaults for users, and the values can be changed in per-user configuration |
@@ -179,7 +238,6 @@ then | |||
179 | # BatchMode no | 238 | # BatchMode no |
180 | # CheckHostIP yes | 239 | # CheckHostIP yes |
181 | # StrictHostKeyChecking no | 240 | # StrictHostKeyChecking no |
182 | # IdentityFile ~/.ssh/identity | ||
183 | # Port 22 | 241 | # Port 22 |
184 | # Protocol 2,1 | 242 | # Protocol 2,1 |
185 | # Cipher 3des | 243 | # Cipher 3des |
@@ -190,6 +248,11 @@ Host * | |||
190 | ForwardAgent no | 248 | ForwardAgent no |
191 | ForwardX11 no | 249 | ForwardX11 no |
192 | FallBackToRsh no | 250 | FallBackToRsh no |
251 | |||
252 | # Try authentification with the following identities | ||
253 | IdentityFile ~/.ssh/identity | ||
254 | IdentityFile ~/.ssh/id_rsa | ||
255 | IdentityFile ~/.ssh/id_dsa | ||
193 | EOF | 256 | EOF |
194 | fi | 257 | fi |
195 | 258 | ||
@@ -211,15 +274,20 @@ fi | |||
211 | 274 | ||
212 | if [ ! -f "${SYSCONFDIR}/sshd_config" ] | 275 | if [ ! -f "${SYSCONFDIR}/sshd_config" ] |
213 | then | 276 | then |
214 | echo "Creating default ${SYSCONFDIR}/sshd_config file" | 277 | echo "Generating ${SYSCONFDIR}/sshd_config file" |
215 | cat > ${SYSCONFDIR}/sshd_config << EOF | 278 | cat > ${SYSCONFDIR}/sshd_config << EOF |
216 | # This is ssh server systemwide configuration file. | 279 | # This is ssh server systemwide configuration file. |
217 | 280 | ||
218 | Port 22 | 281 | Port 22 |
219 | #Protocol 2,1 | 282 | # |
283 | Protocol 2,1 | ||
220 | ListenAddress 0.0.0.0 | 284 | ListenAddress 0.0.0.0 |
221 | #ListenAddress :: | 285 | #ListenAddress :: |
222 | #HostKey /etc/ssh_host_key | 286 | # |
287 | # Uncomment the following lines according to the used authentication | ||
288 | HostKey /etc/ssh_host_key | ||
289 | HostKey /etc/ssh_host_rsa_key | ||
290 | HostKey /etc/ssh_host_dsa_key | ||
223 | ServerKeyBits 768 | 291 | ServerKeyBits 768 |
224 | LoginGraceTime 600 | 292 | LoginGraceTime 600 |
225 | KeyRegenerationInterval 3600 | 293 | KeyRegenerationInterval 3600 |
@@ -262,63 +330,55 @@ UseLogin no | |||
262 | EOF | 330 | EOF |
263 | fi | 331 | fi |
264 | 332 | ||
265 | # Ask user if user identity should be generated | 333 | # Add port 22/tcp to services |
266 | 334 | _sys="`uname -a`" | |
267 | if [ "X${HOME}" = "X" ] | 335 | _nt=`expr "$_sys" : "CYGWIN_NT"` |
268 | then | 336 | if [ $_nt -gt 0 ] |
269 | echo '$HOME is nonexistant. Cannot create user identity files.' | ||
270 | exit 1 | ||
271 | fi | ||
272 | |||
273 | if [ ! -d "${HOME}" ] | ||
274 | then | 337 | then |
275 | echo '$HOME is not a valid directory. Cannot create user identity files.' | 338 | _wservices="${SYSTEMROOT}\\system32\\drivers\\etc\\services" |
276 | exit 1 | 339 | _wserv_tmp="${SYSTEMROOT}\\system32\\drivers\\etc\\srv.out.$$" |
277 | fi | 340 | else |
278 | 341 | _wservices="${WINDIR}\\SERVICES" | |
279 | # If HOME is the root dir, set HOME to empty string to avoid error messages | 342 | _wserv_tmp="${WINDIR}\\SERV.$$" |
280 | # in subsequent parts of that script. | ||
281 | if [ "X${HOME}" = "X/" ] | ||
282 | then | ||
283 | HOME='' | ||
284 | fi | 343 | fi |
344 | _services=`cygpath -u "${_wservices}"` | ||
345 | _serv_tmp=`cygpath -u "${_wserv_tmp}"` | ||
285 | 346 | ||
286 | if [ -e "${HOME}/.ssh" -a ! -d "${HOME}/.ssh" ] | 347 | mount -b -f "${_wservices}" "${_services}" |
287 | then | 348 | mount -b -f "${_wserv_tmp}" "${_serv_tmp}" |
288 | echo '$HOME/.ssh is existant but not a directory. Cannot create user identity files.' | ||
289 | exit 1 | ||
290 | fi | ||
291 | 349 | ||
292 | if [ ! -e "${HOME}/.ssh" ] | 350 | if [ `grep -q 'sshd[ \t][ \t]*22' "${_services}"; echo $?` -ne 0 ] |
293 | then | 351 | then |
294 | mkdir "${HOME}/.ssh" | 352 | awk '{ if ( $2 ~ /^23\/tcp/ ) print "sshd 22/tcp #SSH daemon\r"; print $0; }' < "${_services}" > "${_serv_tmp}" |
295 | if [ ! -e "${HOME}/.ssh" ] | 353 | if [ -f "${_serv_tmp}" ] |
296 | then | 354 | then |
297 | echo "Creating users ${HOME}/.ssh directory failed" | 355 | if mv "${_serv_tmp}" "${_services}" |
298 | exit 1 | 356 | then |
357 | echo "Added sshd to ${_services}" | ||
358 | else | ||
359 | echo "Adding sshd to ${_services} failed\!" | ||
360 | fi | ||
361 | rm -f "${_serv_tmp}" | ||
362 | else | ||
363 | echo "Adding sshd to ${_services} failed\!" | ||
299 | fi | 364 | fi |
300 | fi | 365 | fi |
301 | 366 | ||
302 | if [ ! -f "${HOME}/.ssh/identity" ] | 367 | umount "${_services}" |
368 | umount "${_serv_tmp}" | ||
369 | |||
370 | # Add sshd line to inetd.conf | ||
371 | if [ -f /etc/inetd.conf ] | ||
303 | then | 372 | then |
304 | if request "Shall I create an RSA identity file for you?" | 373 | grep -q "^[# \t]*sshd" /etc/inetd.conf || echo "# sshd stream tcp nowait root /usr/sbin/sshd -i" >> /etc/inetd.conf |
305 | then | ||
306 | echo "Generating ${HOME}/.ssh/identity" | ||
307 | ssh-keygen -f "${HOME}/.ssh/identity" | ||
308 | fi | ||
309 | fi | 374 | fi |
310 | 375 | ||
311 | if [ ! -f "${HOME}/.ssh/id_dsa" ] | 376 | if [ "${old_install}" = "1" ] |
312 | then | 377 | then |
313 | if request "Shall I create an DSA identity file for you? (yes/no) " | 378 | echo |
314 | then | 379 | echo "Note: If you have used sshd as service or from inetd, don't forget to" |
315 | echo "Generating ${HOME}/.ssh/id_dsa" | 380 | echo " change the path to sshd.exe in the service entry or in inetd.conf." |
316 | ssh-keygen -d -f "${HOME}/.ssh/id_dsa" | ||
317 | fi | ||
318 | fi | 381 | fi |
319 | 382 | ||
320 | echo | 383 | echo |
321 | echo "Note: If you have used sshd as service or from inetd, don't forget to" | 384 | echo "Host configuration finished. Have fun!" |
322 | echo " change the path to sshd.exe in the service entry or in inetd.conf." | ||
323 | echo | ||
324 | echo "Configuration finished. Have fun!" | ||
diff --git a/contrib/cygwin/ssh-user-config b/contrib/cygwin/ssh-user-config new file mode 100644 index 000000000..5a76adbaf --- /dev/null +++ b/contrib/cygwin/ssh-user-config | |||
@@ -0,0 +1,200 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # ssh-user-config, Copyright 2000, Red Hat Inc. | ||
4 | # | ||
5 | # This file is part of the Cygwin port of OpenSSH. | ||
6 | |||
7 | progname=$0 | ||
8 | auto_answer="" | ||
9 | auto_passphrase="no" | ||
10 | passphrase="" | ||
11 | |||
12 | request() | ||
13 | { | ||
14 | if [ "${auto_answer}" = "yes" ] | ||
15 | then | ||
16 | return 0 | ||
17 | elif [ "${auto_answer}" = "no" ] | ||
18 | then | ||
19 | return 1 | ||
20 | fi | ||
21 | |||
22 | answer="" | ||
23 | while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ] | ||
24 | do | ||
25 | echo -n "$1 (yes/no) " | ||
26 | read answer | ||
27 | done | ||
28 | if [ "X${answer}" = "Xyes" ] | ||
29 | then | ||
30 | return 0 | ||
31 | else | ||
32 | return 1 | ||
33 | fi | ||
34 | } | ||
35 | |||
36 | # Check options | ||
37 | |||
38 | while : | ||
39 | do | ||
40 | case $# in | ||
41 | 0) | ||
42 | break | ||
43 | ;; | ||
44 | esac | ||
45 | |||
46 | option=$1 | ||
47 | shift | ||
48 | |||
49 | case "$option" in | ||
50 | -d | --debug ) | ||
51 | set -x | ||
52 | ;; | ||
53 | |||
54 | -y | --yes ) | ||
55 | auto_answer=yes | ||
56 | ;; | ||
57 | |||
58 | -n | --no ) | ||
59 | auto_answer=no | ||
60 | ;; | ||
61 | |||
62 | -p | --passphrase ) | ||
63 | with_passphrase="yes" | ||
64 | passphrase=$1 | ||
65 | shift | ||
66 | ;; | ||
67 | |||
68 | *) | ||
69 | echo "usage: ${progname} [OPTION]..." | ||
70 | echo | ||
71 | echo "This script creates an OpenSSH user configuration." | ||
72 | echo | ||
73 | echo "Options:" | ||
74 | echo " --debug -d Enable shell's debug output." | ||
75 | echo " --yes -y Answer all questions with \"yes\" automatically." | ||
76 | echo " --no -n Answer all questions with \"no\" automatically." | ||
77 | echo " --passphrase -p word Use \"word\" as passphrase automatically." | ||
78 | echo | ||
79 | exit 1 | ||
80 | ;; | ||
81 | |||
82 | esac | ||
83 | done | ||
84 | |||
85 | # Ask user if user identity should be generated | ||
86 | |||
87 | if [ ! -f /etc/passwd ] | ||
88 | then | ||
89 | echo '/etc/passwd is nonexistant. Please generate an /etc/passwd file' | ||
90 | echo 'first using mkpasswd. Check if it contains an entry for you and' | ||
91 | echo 'please care for the home directory in your entry as well.' | ||
92 | exit 1 | ||
93 | fi | ||
94 | |||
95 | uid=`id -u` | ||
96 | pwdhome=`awk -F: '{ if ( $3 == '${uid}' ) print $6; }' < /etc/passwd` | ||
97 | |||
98 | if [ "X${pwdhome}" = "X" ] | ||
99 | then | ||
100 | echo 'There is no home directory set for you in /etc/passwd.' | ||
101 | echo 'Setting $HOME is not sufficient!' | ||
102 | exit 1 | ||
103 | fi | ||
104 | |||
105 | if [ ! -d "${pwdhome}" ] | ||
106 | then | ||
107 | echo "${pwdhome} is set in /etc/passwd as your home directory" | ||
108 | echo 'but it is not a valid directory. Cannot create user identity files.' | ||
109 | exit 1 | ||
110 | fi | ||
111 | |||
112 | # If home is the root dir, set home to empty string to avoid error messages | ||
113 | # in subsequent parts of that script. | ||
114 | if [ "X${pwdhome}" = "X/" ] | ||
115 | then | ||
116 | # But first raise a warning! | ||
117 | echo 'Your home directory in /etc/passwd is set to root (/). This is not recommended!' | ||
118 | if request "Would you like to proceed anyway?" | ||
119 | then | ||
120 | pwdhome='' | ||
121 | else | ||
122 | exit 1 | ||
123 | fi | ||
124 | fi | ||
125 | |||
126 | if [ -e "${pwdhome}/.ssh" -a ! -d "${pwdhome}/.ssh" ] | ||
127 | then | ||
128 | echo "${pwdhome}/.ssh is existant but not a directory. Cannot create user identity files." | ||
129 | exit 1 | ||
130 | fi | ||
131 | |||
132 | if [ ! -e "${pwdhome}/.ssh" ] | ||
133 | then | ||
134 | mkdir "${pwdhome}/.ssh" | ||
135 | if [ ! -e "${pwdhome}/.ssh" ] | ||
136 | then | ||
137 | echo "Creating users ${pwdhome}/.ssh directory failed" | ||
138 | exit 1 | ||
139 | fi | ||
140 | fi | ||
141 | |||
142 | if [ ! -f "${pwdhome}/.ssh/identity" ] | ||
143 | then | ||
144 | if request "Shall I create an SSH1 RSA identity file for you?" | ||
145 | then | ||
146 | echo "Generating ${pwdhome}/.ssh/identity" | ||
147 | if [ "${with_passphrase}" = "yes" ] | ||
148 | then | ||
149 | ssh-keygen -t rsa1 -N "${passphrase}" -f "${pwdhome}/.ssh/identity" > /dev/null | ||
150 | else | ||
151 | ssh-keygen -t rsa1 -f "${pwdhome}/.ssh/identity" > /dev/null | ||
152 | fi | ||
153 | if request "Do you want to use this identity to login to this machine?" | ||
154 | then | ||
155 | echo "Adding to ${pwdhome}/.ssh/authorized_keys" | ||
156 | cat "${pwdhome}/.ssh/identity.pub" >> "${pwdhome}/.ssh/authorized_keys" | ||
157 | fi | ||
158 | fi | ||
159 | fi | ||
160 | |||
161 | if [ ! -f "${pwdhome}/.ssh/id_rsa" ] | ||
162 | then | ||
163 | if request "Shall I create an SSH2 RSA identity file for you? (yes/no) " | ||
164 | then | ||
165 | echo "Generating ${pwdhome}/.ssh/id_rsa" | ||
166 | if [ "${with_passphrase}" = "yes" ] | ||
167 | then | ||
168 | ssh-keygen -t rsa -N "${passphrase}" -f "${pwdhome}/.ssh/id_rsa" > /dev/null | ||
169 | else | ||
170 | ssh-keygen -t rsa -f "${pwdhome}/.ssh/id_rsa" > /dev/null | ||
171 | fi | ||
172 | if request "Do you want to use this identity to login to this machine?" | ||
173 | then | ||
174 | echo "Adding to ${pwdhome}/.ssh/authorized_keys2" | ||
175 | cat "${pwdhome}/.ssh/id_rsa.pub" >> "${pwdhome}/.ssh/authorized_keys2" | ||
176 | fi | ||
177 | fi | ||
178 | fi | ||
179 | |||
180 | if [ ! -f "${pwdhome}/.ssh/id_dsa" ] | ||
181 | then | ||
182 | if request "Shall I create an SSH2 DSA identity file for you? (yes/no) " | ||
183 | then | ||
184 | echo "Generating ${pwdhome}/.ssh/id_dsa" | ||
185 | if [ "${with_passphrase}" = "yes" ] | ||
186 | then | ||
187 | ssh-keygen -t dsa -N "${passphrase}" -f "${pwdhome}/.ssh/id_dsa" > /dev/null | ||
188 | else | ||
189 | ssh-keygen -t dsa -f "${pwdhome}/.ssh/id_dsa" > /dev/null | ||
190 | fi | ||
191 | if request "Do you want to use this identity to login to this machine?" | ||
192 | then | ||
193 | echo "Adding to ${pwdhome}/.ssh/authorized_keys2" | ||
194 | cat "${pwdhome}/.ssh/id_dsa.pub" >> "${pwdhome}/.ssh/authorized_keys2" | ||
195 | fi | ||
196 | fi | ||
197 | fi | ||
198 | |||
199 | echo | ||
200 | echo "Configuration finished. Have fun!" | ||
@@ -2013,7 +2013,6 @@ do_authenticated2(Authctxt *authctxt) | |||
2013 | startup_pipe = -1; | 2013 | startup_pipe = -1; |
2014 | } | 2014 | } |
2015 | #if defined(HAVE_LOGIN_CAP) && defined(HAVE_PW_CLASS_IN_PASSWD) | 2015 | #if defined(HAVE_LOGIN_CAP) && defined(HAVE_PW_CLASS_IN_PASSWD) |
2016 | /* ISSUE: Is this correct? */ | ||
2017 | if ((lc = login_getclass(authctxt->pw->pw_class)) == NULL) { | 2016 | if ((lc = login_getclass(authctxt->pw->pw_class)) == NULL) { |
2018 | error("unable to get login class"); | 2017 | error("unable to get login class"); |
2019 | return; | 2018 | return; |