Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a08179fe76 | ||
|
|
90788a64b1 | ||
|
|
a6f765a7db | ||
|
|
a83a88435d | ||
|
|
76a3190b73 | ||
|
|
6ece1b29f9 | ||
|
|
2efe8153b3 | ||
|
|
f5c89269d4 | ||
|
|
ed6e4ad148 | ||
|
|
44865a539a | ||
|
|
2c6d519fad | ||
|
|
cc0145e17d | ||
|
|
e26ed504db | ||
|
|
8dfd1fca8c | ||
|
|
60713e5e94 | ||
|
|
1393083590 | ||
|
|
bcd2f588d1 | ||
|
|
18c6811164 | ||
|
|
6261a34554 | ||
|
|
b0d6a7f18c | ||
|
|
33fe286c6e | ||
|
|
4927580837 | ||
|
|
e9bc220310 | ||
|
|
625a6e3fa8 | ||
|
|
f9c7819126 | ||
|
|
4fd534308a | ||
|
|
de11e7b6e1 | ||
|
|
fe3a5775bb | ||
|
|
4c0dbd1844 | ||
|
|
5394919cda | ||
|
|
58ff8d6a24 | ||
|
|
99609f5c19 | ||
|
|
6dbe10d822 | ||
|
|
b5f8e5d4c6 | ||
|
|
e043e8e221 | ||
|
|
03575cc07d | ||
|
|
a05ec477b3 | ||
|
|
e1318fb07f | ||
|
|
d640322dd8 | ||
|
|
efa09bf250 | ||
|
|
d77263ea5c | ||
|
|
a35bebfdff | ||
|
|
4515ebb904 | ||
|
|
bd126db25c | ||
|
|
537d716831 | ||
|
|
8ceeb26993 | ||
|
|
7283b27e08 | ||
|
|
7724e94d04 | ||
|
|
2a2e64ea40 | ||
|
|
85786850fb | ||
|
|
a307b6ff14 | ||
|
|
8f4b946038 | ||
|
|
31486b0bea | ||
|
|
a21ea0840c | ||
|
|
7baaa6a961 | ||
|
|
387666a626 | ||
|
|
8f73f41d10 | ||
|
|
4dd222cb87 | ||
|
|
7b92600e9b | ||
|
|
aa9a76fe4c | ||
|
|
ade1cee573 | ||
|
|
92dc672aac | ||
|
|
9d14715146 | ||
|
|
04a1d8d67d | ||
|
|
5502e5895d | ||
|
|
315212b531 | ||
|
|
42978c7f28 |
@@ -1,3 +1,194 @@
|
||||
20031219
|
||||
- (dtucker) [defines.h] Bug #458: Define SIZE_T_MAX as UINT_MAX if we
|
||||
typedef size_t ourselves.
|
||||
|
||||
20031218
|
||||
- (dtucker) [configure.ac] Don't use setre[ug]id on DG-UX, from Tom Orban.
|
||||
|
||||
20031217
|
||||
- (dtucker) [acconfig.h configure.ac uidswap.c] Bug #645: Check for
|
||||
setres[ug]id() present but not implemented (eg some Linux/glibc
|
||||
combinations).
|
||||
|
||||
20031208
|
||||
- (tim) [configure.ac] Bug 770. Fix --without-rpath.
|
||||
|
||||
20031115
|
||||
- (dtucker) [regress/agent-ptrace.sh] Test for GDB output from Solaris and
|
||||
HP-UX, skip test on AIX.
|
||||
|
||||
20031113
|
||||
- (dtucker) [sshd_config] Clarify UsePAM consequences a little more, from
|
||||
current.
|
||||
- (dtucker) [auth-pam.c] Append newlines to lines output by the
|
||||
pam_chauthtok_conv().
|
||||
- (dtucker) [README ssh-host-config ssh-user-config Makefile] (All
|
||||
contrib/cygwin). Major update from vinschen at redhat.com.
|
||||
- Makefile provides a `cygwin-postinstall' target to run right after
|
||||
`make install'.
|
||||
- Better support for Windows 2003 Server.
|
||||
- Try to get permissions as correct as possible.
|
||||
- New command line options to allow full automated host configuration.
|
||||
- Create configs from skeletons in /etc/defaults/etc.
|
||||
- Use /bin/bash, allows reading user input with readline support.
|
||||
- Remove really old configs from /usr/local.
|
||||
- (dtucker) [auth-pam.c] Add newline to accumulated PAM_TEXT_INFO and
|
||||
PAM_ERROR_MSG messages.
|
||||
|
||||
20031103
|
||||
- (dtucker) [contrib/cygwin/ssh-host-config] Ensure entries in /etc/services
|
||||
are created correctly with CRLF line terminations. Patch from vinschen at
|
||||
redhat.com.
|
||||
- (dtucker) [regress/agent-ptrace.sh] Use numeric uid and gid.
|
||||
|
||||
20031021
|
||||
- (dtucker) [INSTALL] Some system crypt() functions support MD5 passwords
|
||||
directly. Noted by Darren.Moffat at sun.com.
|
||||
- (dtucker) [regress/agent-ptrace.sh] Skip agent-test unless SUDO is set,
|
||||
make agent setgid during test.
|
||||
|
||||
20031017
|
||||
- (dtucker) [INSTALL] Note that --with-md5 is now required on platforms with
|
||||
MD5 passwords even if PAM support is enabled. From steev at detritus.net.
|
||||
|
||||
20031015
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
- [email protected] 2003/10/11 08:26:43
|
||||
[sshconnect2.c]
|
||||
search keys in reverse order; fixes #684
|
||||
- (dtucker) [auth.c] Check for disabled password expiry on HP-UX Trusted Mode.
|
||||
- (tim) [regress/banner.sh] portability fix.
|
||||
|
||||
20031009
|
||||
- (dtucker) [sshd_config.5] UsePAM defaults to "no". ok djm@
|
||||
|
||||
20031008
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
- [email protected] 2003/10/07 01:47:27
|
||||
[sshconnect2.c]
|
||||
Don't use logit for banner, since it truncates to MSGBUFSIZ; bz #668 &
|
||||
#707. ok markus@
|
||||
- [email protected] 2003/10/07 07:04:16
|
||||
[sftp-int.c]
|
||||
sftp quoting fix from admorten AT umich.edu; ok markus@
|
||||
- [email protected] 2003/10/07 21:58:28
|
||||
[sshconnect2.c]
|
||||
set ptr to NULL after free
|
||||
- [email protected] 2003/10/07 01:52:13
|
||||
[regress/Makefile regress/banner.sh]
|
||||
Test SSH2 banner. ok markus@
|
||||
- [email protected] 2003/10/07 07:04:52
|
||||
[regress/sftp-cmds.sh]
|
||||
more sftp quoting regress tests; ok markus
|
||||
|
||||
20031007
|
||||
- (dtucker) [contrib/redhat/openssh.spec] Bug #714: Now that UsePAM is a
|
||||
run-time switch, always build --with-md5-passwords.
|
||||
- (dtucker) [configure.ac] Bug #715: Set BROKEN_SETREUID and BROKEN_SETREGID
|
||||
on Reliant Unix. Patch from Robert.Dahlem at siemens.com.
|
||||
- (dtucker) [configure.ac] Bug #710: Check for dlsym() in libdl on
|
||||
Reliant Unix. Based on patch from Robert.Dahlem at siemens.com.
|
||||
|
||||
20031003
|
||||
- (tim) [contrib/caldera/openssh.spec] Remove obsolete --with-ipv4-default
|
||||
option.
|
||||
|
||||
20031002
|
||||
- OpenBSD CVS Sync
|
||||
- [email protected] 2003/09/23 20:18:52
|
||||
[progressmeter.c]
|
||||
don't print trailing \0; bug #709; [email protected]
|
||||
ok millert/deraadt@
|
||||
- (dtucker) [session.c] Fix bus errors on some 64-bit Solaris configurations.
|
||||
Based on patches by Matthias Koeppe and Thomas Baden. ok djm@
|
||||
- (tim) [sshd_config] UsePAM defaults to no.
|
||||
|
||||
20030925
|
||||
- (dtucker) [configure.ac openbsd-compat/xcrypt.c] Bug #633: Remove
|
||||
DISABLE_SHADOW for HP-UX, use getspnam instead of getprpwnam. Patch from
|
||||
michael_steffens at hp.com, ok djm@
|
||||
|
||||
20030923
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
- [email protected] 2003/09/18 07:52:54
|
||||
[sshconnect.c]
|
||||
missing {}; bug #656; jclonguet at free.fr
|
||||
- [email protected] 2003/09/18 07:54:48
|
||||
[buffer.c]
|
||||
protect against double free; #660; zardoz at users.sf.net
|
||||
- [email protected] 2003/09/18 08:49:45
|
||||
[deattack.c misc.c session.c ssh-agent.c]
|
||||
more buffer allocation fixes; from Solar Designer; CAN-2003-0682;
|
||||
ok millert@
|
||||
- [email protected] 2003/09/19 09:02:02
|
||||
[packet.c]
|
||||
buffer_dump only if PACKET_DEBUG is defined; Jedi/Sector One; pr 3471
|
||||
- (djm) Fix SSH1 challenge kludge
|
||||
- (djm) Bug #671: Fix builds on OpenBSD
|
||||
- (djm) Bug #676: Fix PAM stack corruption
|
||||
- (djm) Fix bad free() in PAM code
|
||||
- (djm) Don't call pam_end before pam_init
|
||||
- (djm) Enable build with old OpenSSL again
|
||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||
- (djm) Crank version.h and spec version numbers
|
||||
- (djm) Release 3.7.1p2
|
||||
|
||||
20030922
|
||||
- (dtucker) [Makefile.in] Bug #644: Fix "make clean" for out-of-tree
|
||||
builds. Portability corrections from tim@.
|
||||
- (dtucker) [configure.ac] Bug #665: uid swapping issues on Mac OS X.
|
||||
Patch from max at quendi.de.
|
||||
- (dtucker) [configure.ac] Bug #657: uid swapping issues on BSDi.
|
||||
- (dtucker) [configure.ac] Bug #653: uid swapping issues on Tru64.
|
||||
- (dtucker) [configure.ac] Bug #693: uid swapping issues on NCR MP-RAS.
|
||||
Patch from david.haughton at ncr.com
|
||||
- (dtucker) [configure.ac] Bug #659: uid swapping issues on IRIX 6.
|
||||
Part of patch supplied by bugzilla-openssh at thewrittenword.com
|
||||
- (dtucker) [configure.ac openbsd-compat/fake-rfc2553.c
|
||||
openbsd-compat/fake-rfc2553.h] Bug #659: Test for and handle systems with
|
||||
where gai_strerror is defined as "const char *". Part of patch supplied
|
||||
by bugzilla-openssh at thewrittenword.com
|
||||
- (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config] Update
|
||||
ssh-host-config to match current defaults, bump README version. Patch from
|
||||
vinschen at redhat.com.
|
||||
- (dtucker) [uidswap.c] Don't test restoration of uid on Cygwin since the
|
||||
OS does not support permanently dropping privileges. Patch from
|
||||
vinschen at redhat.com.
|
||||
- (dtucker) [openbsd-compat/port-aix.c] Use correct include for xmalloc.h,
|
||||
add canohost.h to stop warning. Based on patch from openssh-unix-dev at
|
||||
thewrittenword.com
|
||||
- (dtucker) [INSTALL] Bug #686: Document requirement for zlib 1.1.4 or
|
||||
higher.
|
||||
- (tim) Fix typo. s/SETEIUD_BREAKS_SETUID/SETEUID_BREAKS_SETUID/
|
||||
- (tim) [configure.ac] Bug 665: move 3 new AC_DEFINES outside of AC_TRY_RUN.
|
||||
Report by distler AT golem ph utexas edu.
|
||||
- (dtucker) [contrib/aix/pam.conf] Include example pam.conf for AIX from
|
||||
article by genty at austin.ibm.com, included with the author's permission.
|
||||
- (tim) [configure.ac] add --disable-etc-default-login option. ok djm
|
||||
|
||||
20030919
|
||||
- (djm) Bug #683: Remove reference to --with-ipv4-default from INSTALL;
|
||||
djast AT cs.toronto.edu
|
||||
- (djm) Bug #680: Remove missing inet_ntoa.h header reference
|
||||
- (djm) Bug #646: Fix location of x11-ssh-askpass; Jim
|
||||
- (dtucker) [openbsd-compat/port-aix.h] Bug #640: Don't include audit.h
|
||||
unless required. Reorder to reduce warnings.
|
||||
- (dtucker) [session.c] Bug #643: Fix size_t -> u_int and fix null deref
|
||||
when /etc/default/login doesn't exist or isn't readable. Fixes from
|
||||
jparsons-lists at saffron.net and georg.oppenberg at deu mci com.
|
||||
|
||||
20030918
|
||||
- (djm) Bug #652: Fix empty password auth
|
||||
|
||||
20030917
|
||||
- (djm) OpenBSD Sync
|
||||
- [email protected] 2003/09/16 21:02:40
|
||||
[buffer.c channels.c version.h]
|
||||
more malloc/fatal fixes; ok millert/deraadt; ghudson at MIT.EDU
|
||||
- (djm) Crank RPM spec versions
|
||||
- (djm) Release 3.7.1p1
|
||||
|
||||
20030916
|
||||
- (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve
|
||||
PATH (or SUPATH) and UMASK from /etc/default/login on platforms that have it
|
||||
@@ -7,6 +198,10 @@
|
||||
- [email protected] 2003/09/16 03:03:47
|
||||
[buffer.c]
|
||||
do not expand buffer before attempting to reallocate it; markus ok
|
||||
- (djm) Crank spec versions
|
||||
- (djm) Banish (safe) sprintf from auth-pam.c. Patch from bal
|
||||
- (tim) [configure.ac] Fix portability issues.
|
||||
- (djm) Release 3.7p1
|
||||
|
||||
20030914
|
||||
- (dtucker) [Makefile regress/Makefile] Fix portability issues preventing
|
||||
@@ -1103,4 +1298,4 @@
|
||||
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
|
||||
Report from [email protected], diagnosis from [email protected]
|
||||
|
||||
$Id: ChangeLog,v 1.2994 2003/09/16 03:31:03 mouring Exp $
|
||||
$Id: ChangeLog,v 1.2994.2.65 2003/12/18 23:56:44 dtucker Exp $
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
You will need working installations of Zlib and OpenSSL.
|
||||
|
||||
Zlib:
|
||||
Zlib 1.1.4 or greater:
|
||||
http://www.gzip.org/zlib/
|
||||
|
||||
OpenSSL 0.9.6 or greater:
|
||||
@@ -33,7 +33,7 @@ http://www.gnome.org/
|
||||
Alternatively, Jim Knoble <[email protected]> has written an excellent X11
|
||||
passphrase requester. This is maintained separately at:
|
||||
|
||||
http://www.ntrnet.net/~jmknoble/software/x11-ssh-askpass/index.html
|
||||
http://www.jmknoble.net/software/x11-ssh-askpass/
|
||||
|
||||
PRNGD:
|
||||
|
||||
@@ -101,11 +101,8 @@ name).
|
||||
|
||||
There are a few other options to the configure script:
|
||||
|
||||
--with-pam enables PAM support.
|
||||
|
||||
--enable-gnome-askpass will build the GNOME passphrase dialog. You
|
||||
need a working installation of GNOME, including the development
|
||||
headers, for this to work.
|
||||
--with-pam enables PAM support. If PAM support is compiled in, it must
|
||||
also be enabled in sshd_config (refer to the UsePAM directive).
|
||||
|
||||
--with-prngd-socket=/some/file allows you to enable EGD or PRNGD
|
||||
support and to specify a PRNGd socket. Use this if your Unix lacks
|
||||
@@ -126,16 +123,6 @@ it if lastlog is installed in a different place.
|
||||
--with-osfsia, --without-osfsia will enable or disable OSF1's Security
|
||||
Integration Architecture. The default for OSF1 machines is enable.
|
||||
|
||||
--with-kerberos4=PATH will enable Kerberos IV support. You will need
|
||||
to have the Kerberos libraries and header files installed for this
|
||||
to work. Use the optional PATH argument to specify the root of your
|
||||
Kerberos installation.
|
||||
|
||||
--with-afs=PATH will enable AFS support. You will need to have the
|
||||
Kerberos IV and the AFS libraries and header files installed for this
|
||||
to work. Use the optional PATH argument to specify the root of your
|
||||
AFS installation. AFS requires Kerberos support to be enabled.
|
||||
|
||||
--with-skey=PATH will enable S/Key one time password support. You will
|
||||
need the S/Key libraries and header files installed for this to work.
|
||||
|
||||
@@ -143,7 +130,9 @@ need the S/Key libraries and header files installed for this to work.
|
||||
support. You will need libwrap.a and tcpd.h installed.
|
||||
|
||||
--with-md5-passwords will enable the use of MD5 passwords. Enable this
|
||||
if your operating system uses MD5 passwords without using PAM.
|
||||
if your operating system uses MD5 passwords and the system crypt() does
|
||||
not support them directly (see the crypt(3/3c) man page). If enabled, the
|
||||
resulting binary will support both MD5 and traditional crypt passwords.
|
||||
|
||||
--with-utmpx enables utmpx support. utmpx support is automatic for
|
||||
some platforms.
|
||||
@@ -161,12 +150,6 @@ created.
|
||||
|
||||
--with-xauth=PATH specifies the location of the xauth binary
|
||||
|
||||
--with-ipv4-default instructs OpenSSH to use IPv4 by default for new
|
||||
connections. Normally OpenSSH will try attempt to lookup both IPv6 and
|
||||
IPv4 addresses. On Linux/glibc-2.1.2 this causes long delays in name
|
||||
resolution. If this option is specified, you can still attempt to
|
||||
connect to IPv6 addresses using the command line option '-6'.
|
||||
|
||||
--with-ssl-dir=DIR allows you to specify where your OpenSSL libraries
|
||||
are installed.
|
||||
|
||||
@@ -217,4 +200,4 @@ Please refer to the "reporting bugs" section of the webpage at
|
||||
http://www.openssh.com/
|
||||
|
||||
|
||||
$Id: INSTALL,v 1.56 2003/05/24 01:41:16 dtucker Exp $
|
||||
$Id: INSTALL,v 1.56.2.6 2003/10/21 02:40:01 dtucker Exp $
|
||||
|
||||
+10
-5
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.in,v 1.249 2003/09/14 01:40:36 dtucker Exp $
|
||||
# $Id: Makefile.in,v 1.249.2.1 2003/09/22 01:00:12 dtucker Exp $
|
||||
|
||||
# uncomment if you run a non bourne compatable shell. Ie. csh
|
||||
#SHELL = @SH@
|
||||
@@ -192,20 +192,18 @@ ssh_prng_cmds.out: ssh_prng_cmds
|
||||
moduli:
|
||||
echo
|
||||
|
||||
clean:
|
||||
clean: regressclean
|
||||
rm -f *.o *.a $(TARGETS) logintest config.cache config.log
|
||||
rm -f *.out core
|
||||
(cd openbsd-compat && $(MAKE) clean)
|
||||
(cd regress && $(MAKE) clean)
|
||||
|
||||
distclean:
|
||||
distclean: regressclean
|
||||
rm -f *.o *.a $(TARGETS) logintest config.cache config.log
|
||||
rm -f *.out core
|
||||
rm -f Makefile config.h config.status ssh_prng_cmds *~
|
||||
rm -rf autom4te.cache
|
||||
(cd openbsd-compat && $(MAKE) distclean)
|
||||
(cd scard && $(MAKE) distclean)
|
||||
(cd regress && $(MAKE) distclean)
|
||||
|
||||
veryclean: distclean
|
||||
rm -f configure config.h.in *.0
|
||||
@@ -373,6 +371,8 @@ uninstall:
|
||||
tests: $(TARGETS)
|
||||
BUILDDIR=`pwd`; \
|
||||
[ -d `pwd`/regress ] || mkdir -p `pwd`/regress; \
|
||||
[ -f `pwd`/regress/Makefile ] || \
|
||||
ln -s $(srcdir)/regress/Makefile `pwd`/regress/Makefile ; \
|
||||
TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
|
||||
TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
|
||||
TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
|
||||
@@ -398,3 +398,8 @@ tests: $(TARGETS)
|
||||
TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
|
||||
EXEEXT="$(EXEEXT)" \
|
||||
$@
|
||||
|
||||
regressclean:
|
||||
if [ -f regress/Makefile -a -r regress/Makefile ]; then \
|
||||
(cd regress && $(MAKE) clean) \
|
||||
fi
|
||||
|
||||
+7
-1
@@ -1,4 +1,4 @@
|
||||
/* $Id: acconfig.h,v 1.166 2003/09/16 01:52:19 dtucker Exp $ */
|
||||
/* $Id: acconfig.h,v 1.166.2.1 2003/12/17 07:54:54 dtucker Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Damien Miller. All rights reserved.
|
||||
@@ -41,6 +41,12 @@
|
||||
/* Define if your setregid() is broken */
|
||||
#undef BROKEN_SETREGID
|
||||
|
||||
/* Define if your setresuid() is broken */
|
||||
#undef BROKEN_SETRESUID
|
||||
|
||||
/* Define if your setresgid() is broken */
|
||||
#undef BROKEN_SETRESGID
|
||||
|
||||
/* Define to a Set Process Title type if your system is */
|
||||
/* supported by bsd-setproctitle.c */
|
||||
#undef SPT_TYPE
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ verify_response(Authctxt *authctxt, const char *response)
|
||||
xfree(info);
|
||||
}
|
||||
/* if we received more prompts, we're screwed */
|
||||
res = (numprompts != 0);
|
||||
res = (res == 0 && numprompts == 0) ? 0 : -1;
|
||||
}
|
||||
device->free_ctx(authctxt->kbdintctxt);
|
||||
authctxt->kbdintctxt = NULL;
|
||||
|
||||
+68
-42
@@ -31,7 +31,7 @@
|
||||
|
||||
/* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */
|
||||
#include "includes.h"
|
||||
RCSID("$Id: auth-pam.c,v 1.72 2003/09/13 12:12:11 dtucker Exp $");
|
||||
RCSID("$Id: auth-pam.c,v 1.72.2.4 2003/11/13 08:53:16 dtucker Exp $");
|
||||
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
@@ -111,12 +111,12 @@ pthread_join(sp_pthread_t thread, void **value __unused)
|
||||
#endif
|
||||
|
||||
|
||||
static pam_handle_t *sshpam_handle;
|
||||
static int sshpam_err;
|
||||
static int sshpam_authenticated;
|
||||
static int sshpam_new_authtok_reqd;
|
||||
static int sshpam_session_open;
|
||||
static int sshpam_cred_established;
|
||||
static pam_handle_t *sshpam_handle = NULL;
|
||||
static int sshpam_err = 0;
|
||||
static int sshpam_authenticated = 0;
|
||||
static int sshpam_new_authtok_reqd = 0;
|
||||
static int sshpam_session_open = 0;
|
||||
static int sshpam_cred_established = 0;
|
||||
|
||||
struct pam_ctxt {
|
||||
sp_pthread_t pam_thread;
|
||||
@@ -136,42 +136,51 @@ sshpam_thread_conv(int n, const struct pam_message **msg,
|
||||
{
|
||||
Buffer buffer;
|
||||
struct pam_ctxt *ctxt;
|
||||
struct pam_response *reply;
|
||||
int i;
|
||||
|
||||
*resp = NULL;
|
||||
|
||||
ctxt = data;
|
||||
if (n <= 0 || n > PAM_MAX_NUM_MSG)
|
||||
return (PAM_CONV_ERR);
|
||||
*resp = xmalloc(n * sizeof **resp);
|
||||
|
||||
if ((reply = malloc(n * sizeof(*reply))) == NULL)
|
||||
return (PAM_CONV_ERR);
|
||||
memset(reply, 0, n * sizeof(*reply));
|
||||
|
||||
buffer_init(&buffer);
|
||||
for (i = 0; i < n; ++i) {
|
||||
resp[i]->resp_retcode = 0;
|
||||
resp[i]->resp = NULL;
|
||||
switch (PAM_MSG_MEMBER(msg, i, msg_style)) {
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
buffer_put_cstring(&buffer, PAM_MSG_MEMBER(msg, i, msg));
|
||||
buffer_put_cstring(&buffer,
|
||||
PAM_MSG_MEMBER(msg, i, msg));
|
||||
ssh_msg_send(ctxt->pam_csock,
|
||||
PAM_MSG_MEMBER(msg, i, msg_style), &buffer);
|
||||
ssh_msg_recv(ctxt->pam_csock, &buffer);
|
||||
if (buffer_get_char(&buffer) != PAM_AUTHTOK)
|
||||
goto fail;
|
||||
resp[i]->resp = buffer_get_string(&buffer, NULL);
|
||||
reply[i].resp = buffer_get_string(&buffer, NULL);
|
||||
break;
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
buffer_put_cstring(&buffer, PAM_MSG_MEMBER(msg, i, msg));
|
||||
buffer_put_cstring(&buffer,
|
||||
PAM_MSG_MEMBER(msg, i, msg));
|
||||
ssh_msg_send(ctxt->pam_csock,
|
||||
PAM_MSG_MEMBER(msg, i, msg_style), &buffer);
|
||||
ssh_msg_recv(ctxt->pam_csock, &buffer);
|
||||
if (buffer_get_char(&buffer) != PAM_AUTHTOK)
|
||||
goto fail;
|
||||
resp[i]->resp = buffer_get_string(&buffer, NULL);
|
||||
reply[i].resp = buffer_get_string(&buffer, NULL);
|
||||
break;
|
||||
case PAM_ERROR_MSG:
|
||||
buffer_put_cstring(&buffer, PAM_MSG_MEMBER(msg, i, msg));
|
||||
buffer_put_cstring(&buffer,
|
||||
PAM_MSG_MEMBER(msg, i, msg));
|
||||
ssh_msg_send(ctxt->pam_csock,
|
||||
PAM_MSG_MEMBER(msg, i, msg_style), &buffer);
|
||||
break;
|
||||
case PAM_TEXT_INFO:
|
||||
buffer_put_cstring(&buffer, PAM_MSG_MEMBER(msg, i, msg));
|
||||
buffer_put_cstring(&buffer,
|
||||
PAM_MSG_MEMBER(msg, i, msg));
|
||||
ssh_msg_send(ctxt->pam_csock,
|
||||
PAM_MSG_MEMBER(msg, i, msg_style), &buffer);
|
||||
break;
|
||||
@@ -181,12 +190,15 @@ sshpam_thread_conv(int n, const struct pam_message **msg,
|
||||
buffer_clear(&buffer);
|
||||
}
|
||||
buffer_free(&buffer);
|
||||
*resp = reply;
|
||||
return (PAM_SUCCESS);
|
||||
|
||||
fail:
|
||||
while (i)
|
||||
xfree(resp[--i]);
|
||||
xfree(*resp);
|
||||
*resp = NULL;
|
||||
for(i = 0; i < n; i++) {
|
||||
if (reply[i].resp != NULL)
|
||||
xfree(reply[i].resp);
|
||||
}
|
||||
xfree(reply);
|
||||
buffer_free(&buffer);
|
||||
return (PAM_CONV_ERR);
|
||||
}
|
||||
@@ -258,6 +270,8 @@ sshpam_cleanup(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
debug("PAM: cleanup");
|
||||
if (sshpam_handle == NULL)
|
||||
return;
|
||||
pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv);
|
||||
if (sshpam_cred_established) {
|
||||
pam_setcred(sshpam_handle, PAM_DELETE_CRED);
|
||||
@@ -396,9 +410,9 @@ sshpam_query(void *ctx, char **name, char **info,
|
||||
case PAM_ERROR_MSG:
|
||||
case PAM_TEXT_INFO:
|
||||
/* accumulate messages */
|
||||
len = plen + strlen(msg) + 1;
|
||||
len = plen + strlen(msg) + 2;
|
||||
**prompts = xrealloc(**prompts, len);
|
||||
plen += snprintf(**prompts + plen, len, "%s", msg);
|
||||
plen += snprintf(**prompts + plen, len, "%s\n", msg);
|
||||
xfree(msg);
|
||||
break;
|
||||
case PAM_SUCCESS:
|
||||
@@ -600,40 +614,50 @@ pam_chauthtok_conv(int n, const struct pam_message **msg,
|
||||
struct pam_response **resp, void *data)
|
||||
{
|
||||
char input[PAM_MAX_MSG_SIZE];
|
||||
struct pam_response *reply;
|
||||
int i;
|
||||
|
||||
*resp = NULL;
|
||||
|
||||
if (n <= 0 || n > PAM_MAX_NUM_MSG)
|
||||
return (PAM_CONV_ERR);
|
||||
*resp = xmalloc(n * sizeof **resp);
|
||||
|
||||
if ((reply = malloc(n * sizeof(*reply))) == NULL)
|
||||
return (PAM_CONV_ERR);
|
||||
memset(reply, 0, n * sizeof(*reply));
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
switch (PAM_MSG_MEMBER(msg, i, msg_style)) {
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
resp[i]->resp =
|
||||
reply[i].resp =
|
||||
read_passphrase(PAM_MSG_MEMBER(msg, i, msg),
|
||||
RP_ALLOW_STDIN);
|
||||
resp[i]->resp_retcode = PAM_SUCCESS;
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
break;
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
fputs(PAM_MSG_MEMBER(msg, i, msg), stderr);
|
||||
fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg));
|
||||
fgets(input, sizeof input, stdin);
|
||||
resp[i]->resp = xstrdup(input);
|
||||
resp[i]->resp_retcode = PAM_SUCCESS;
|
||||
reply[i].resp = xstrdup(input);
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
break;
|
||||
case PAM_ERROR_MSG:
|
||||
case PAM_TEXT_INFO:
|
||||
fputs(PAM_MSG_MEMBER(msg, i, msg), stderr);
|
||||
resp[i]->resp_retcode = PAM_SUCCESS;
|
||||
fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg));
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
*resp = reply;
|
||||
return (PAM_SUCCESS);
|
||||
|
||||
fail:
|
||||
while (i)
|
||||
xfree(resp[--i]);
|
||||
xfree(*resp);
|
||||
*resp = NULL;
|
||||
for(i = 0; i < n; i++) {
|
||||
if (reply[i].resp != NULL)
|
||||
xfree(reply[i].resp);
|
||||
}
|
||||
xfree(reply);
|
||||
return (PAM_CONV_ERR);
|
||||
}
|
||||
|
||||
@@ -672,17 +696,19 @@ do_pam_chauthtok(void)
|
||||
int
|
||||
do_pam_putenv(char *name, char *value)
|
||||
{
|
||||
char *compound;
|
||||
int ret = 1;
|
||||
|
||||
#ifdef HAVE_PAM_PUTENV
|
||||
compound = xmalloc(strlen(name)+strlen(value)+2);
|
||||
if (compound) {
|
||||
sprintf(compound,"%s=%s",name,value);
|
||||
ret = pam_putenv(sshpam_handle,compound);
|
||||
xfree(compound);
|
||||
}
|
||||
char *compound;
|
||||
size_t len;
|
||||
|
||||
len = strlen(name) + strlen(value) + 2;
|
||||
compound = xmalloc(len);
|
||||
|
||||
snprintf(compound, len, "%s=%s", name, value);
|
||||
ret = pam_putenv(sshpam_handle, compound);
|
||||
xfree(compound);
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ auth_password(Authctxt *authctxt, const char *password)
|
||||
char *pw_password = authctxt->valid ? shadow_pw(pw) : pw->pw_passwd;
|
||||
|
||||
/* Check for users with no password. */
|
||||
if (strcmp(pw_password, "") == 0 && strcmp(pw->pw_passwd, "") == 0)
|
||||
if (strcmp(pw_password, "") == 0 && strcmp(password, "") == 0)
|
||||
return ok;
|
||||
else {
|
||||
/* Encrypt the candidate password using the proper salt. */
|
||||
|
||||
@@ -90,6 +90,7 @@ allowed_user(struct passwd * pw)
|
||||
#ifdef HAS_SHADOW_EXPIRE
|
||||
#define DAY (24L * 60 * 60) /* 1 day in seconds */
|
||||
if (!options.use_pam && spw != NULL) {
|
||||
int disabled = 0;
|
||||
time_t today;
|
||||
|
||||
today = time(NULL) / DAY;
|
||||
@@ -106,13 +107,19 @@ allowed_user(struct passwd * pw)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (spw->sp_lstchg == 0) {
|
||||
#if defined(__hpux) && !defined(HAVE_SECUREWARE)
|
||||
if (iscomsec() && spw->sp_min == 0 && spw->sp_max == 0 &&
|
||||
spw->sp_warn == 0)
|
||||
disabled = 1; /* Trusted Mode: expiry disabled */
|
||||
#endif
|
||||
|
||||
if (!disabled && spw->sp_lstchg == 0) {
|
||||
logit("User %.100s password has expired (root forced)",
|
||||
pw->pw_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (spw->sp_max != -1 &&
|
||||
if (!disabled && spw->sp_max != -1 &&
|
||||
today > spw->sp_lstchg + spw->sp_max) {
|
||||
logit("User %.100s password has expired (password aged)",
|
||||
pw->pw_name);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $");
|
||||
RCSID("$OpenBSD: buffer.c,v 1.19 2003/09/18 07:54:48 markus Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "buffer.h"
|
||||
@@ -23,8 +23,11 @@ RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $");
|
||||
void
|
||||
buffer_init(Buffer *buffer)
|
||||
{
|
||||
buffer->alloc = 4096;
|
||||
buffer->buf = xmalloc(buffer->alloc);
|
||||
const u_int len = 4096;
|
||||
|
||||
buffer->alloc = 0;
|
||||
buffer->buf = xmalloc(len);
|
||||
buffer->alloc = len;
|
||||
buffer->offset = 0;
|
||||
buffer->end = 0;
|
||||
}
|
||||
@@ -34,8 +37,11 @@ buffer_init(Buffer *buffer)
|
||||
void
|
||||
buffer_free(Buffer *buffer)
|
||||
{
|
||||
memset(buffer->buf, 0, buffer->alloc);
|
||||
xfree(buffer->buf);
|
||||
if (buffer->alloc > 0) {
|
||||
memset(buffer->buf, 0, buffer->alloc);
|
||||
buffer->alloc = 0;
|
||||
xfree(buffer->buf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+4
-3
@@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: channels.c,v 1.194 2003/08/29 10:04:36 markus Exp $");
|
||||
RCSID("$OpenBSD: channels.c,v 1.195 2003/09/16 21:02:40 markus Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
@@ -229,12 +229,13 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
||||
if (found == -1) {
|
||||
/* There are no free slots. Take last+1 slot and expand the array. */
|
||||
found = channels_alloc;
|
||||
channels_alloc += 10;
|
||||
if (channels_alloc > 10000)
|
||||
fatal("channel_new: internal error: channels_alloc %d "
|
||||
"too big.", channels_alloc);
|
||||
channels = xrealloc(channels,
|
||||
(channels_alloc + 10) * sizeof(Channel *));
|
||||
channels_alloc += 10;
|
||||
debug2("channel: expanding %d", channels_alloc);
|
||||
channels = xrealloc(channels, channels_alloc * sizeof(Channel *));
|
||||
for (i = found; i < channels_alloc; i++)
|
||||
channels[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ RCSID("$OpenBSD: cipher-3des1.c,v 1.1 2003/05/15 03:08:29 markus Exp $");
|
||||
#include "xmalloc.h"
|
||||
#include "log.h"
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x00906000L
|
||||
#define SSH_OLD_EVP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is used by SSH1:
|
||||
*
|
||||
|
||||
@@ -31,6 +31,10 @@ RCSID("$OpenBSD: cipher-aes.c,v 1.1 2003/05/15 03:08:29 markus Exp $");
|
||||
#include "xmalloc.h"
|
||||
#include "log.h"
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x00906000L
|
||||
#define SSH_OLD_EVP
|
||||
#endif
|
||||
|
||||
#define RIJNDAEL_BLOCKSIZE 16
|
||||
struct ssh_rijndael_ctx
|
||||
{
|
||||
|
||||
@@ -28,6 +28,11 @@ RCSID("$OpenBSD: cipher-bf1.c,v 1.1 2003/05/15 03:08:29 markus Exp $");
|
||||
#include <openssl/evp.h>
|
||||
#include "xmalloc.h"
|
||||
#include "log.h"
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x00906000L
|
||||
#define SSH_OLD_EVP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SSH1 uses a variation on Blowfish, all bytes must be swapped before
|
||||
* and after encryption/decryption. Thus the swap_bytes stuff (yuk).
|
||||
|
||||
@@ -21,6 +21,10 @@ RCSID("$OpenBSD: cipher-ctr.c,v 1.2 2003/06/17 18:14:23 markus Exp $");
|
||||
#include "log.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x00906000L
|
||||
#define SSH_OLD_EVP
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x00907000L
|
||||
#include "rijndael.h"
|
||||
#define AES_KEY rijndael_ctx
|
||||
@@ -135,7 +139,9 @@ evp_aes_128_ctr(void)
|
||||
aes_ctr.init = ssh_aes_ctr_init;
|
||||
aes_ctr.cleanup = ssh_aes_ctr_cleanup;
|
||||
aes_ctr.do_cipher = ssh_aes_ctr;
|
||||
#ifndef SSH_OLD_EVP
|
||||
aes_ctr.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH |
|
||||
EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV;
|
||||
#endif
|
||||
return (&aes_ctr);
|
||||
}
|
||||
|
||||
@@ -87,9 +87,11 @@ struct Cipher {
|
||||
{ "[email protected]",
|
||||
SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x00906000L
|
||||
{ "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, evp_aes_128_ctr },
|
||||
{ "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, evp_aes_128_ctr },
|
||||
{ "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, evp_aes_128_ctr },
|
||||
#endif
|
||||
|
||||
{ NULL, SSH_CIPHER_ILLEGAL, 0, 0, NULL }
|
||||
};
|
||||
|
||||
+94
-24
@@ -1,4 +1,4 @@
|
||||
# $Id: configure.ac,v 1.154 2003/09/16 01:52:19 dtucker Exp $
|
||||
# $Id: configure.ac,v 1.154.2.17 2003/12/18 01:51:54 dtucker Exp $
|
||||
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([ssh.c])
|
||||
@@ -52,6 +52,18 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
|
||||
CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(rpath,
|
||||
[ --without-rpath Disable auto-added -R linker paths],
|
||||
[
|
||||
if test "x$withval" = "xno" ; then
|
||||
need_dash_r=""
|
||||
fi
|
||||
if test "x$withval" = "xyes" ; then
|
||||
need_dash_r=1
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
# Check for some target-specific stuff
|
||||
case "$host" in
|
||||
*-*-aix*)
|
||||
@@ -120,6 +132,9 @@ case "$host" in
|
||||
;;
|
||||
*-*-dgux*)
|
||||
AC_DEFINE(IP_TOS_IS_BROKEN)
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
;;
|
||||
*-*-darwin*)
|
||||
AC_MSG_CHECKING(if we have working getaddrinfo)
|
||||
@@ -132,6 +147,9 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
[AC_MSG_RESULT(buggy)
|
||||
AC_DEFINE(BROKEN_GETADDRINFO)],
|
||||
[AC_MSG_RESULT(assume it is working)])
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
;;
|
||||
*-*-hpux10.26)
|
||||
if test -z "$GCC"; then
|
||||
@@ -143,7 +161,6 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
AC_DEFINE(USE_PIPES)
|
||||
AC_DEFINE(LOGIN_NO_ENDOPT)
|
||||
AC_DEFINE(LOGIN_NEEDS_UTMPX)
|
||||
AC_DEFINE(DISABLE_SHADOW)
|
||||
AC_DEFINE(DISABLE_UTMP)
|
||||
AC_DEFINE(LOCKED_PASSWD_STRING, "*")
|
||||
AC_DEFINE(SPT_TYPE,SPT_PSTAT)
|
||||
@@ -160,7 +177,6 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
AC_DEFINE(USE_PIPES)
|
||||
AC_DEFINE(LOGIN_NO_ENDOPT)
|
||||
AC_DEFINE(LOGIN_NEEDS_UTMPX)
|
||||
AC_DEFINE(DISABLE_SHADOW)
|
||||
AC_DEFINE(DISABLE_UTMP)
|
||||
AC_DEFINE(LOCKED_PASSWD_STRING, "*")
|
||||
AC_DEFINE(SPT_TYPE,SPT_PSTAT)
|
||||
@@ -174,7 +190,6 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
AC_DEFINE(USE_PIPES)
|
||||
AC_DEFINE(LOGIN_NO_ENDOPT)
|
||||
AC_DEFINE(LOGIN_NEEDS_UTMPX)
|
||||
AC_DEFINE(DISABLE_SHADOW)
|
||||
AC_DEFINE(DISABLE_UTMP)
|
||||
AC_DEFINE(LOCKED_PASSWD_STRING, "*")
|
||||
AC_DEFINE(SPT_TYPE,SPT_PSTAT)
|
||||
@@ -198,6 +213,9 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
AC_DEFINE(WITH_IRIX_AUDIT)
|
||||
AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
|
||||
AC_DEFINE(BROKEN_INET_NTOA)
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
AC_DEFINE(WITH_ABBREV_NO_TTY)
|
||||
AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
|
||||
;;
|
||||
@@ -222,11 +240,18 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
check_for_libcrypt_before=1
|
||||
need_dash_r=1
|
||||
if test "x$withval" != "xno" ; then
|
||||
need_dash_r=1
|
||||
fi
|
||||
;;
|
||||
*-*-freebsd*)
|
||||
check_for_libcrypt_later=1
|
||||
;;
|
||||
*-*-bsdi*)
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
;;
|
||||
*-next-*)
|
||||
conf_lastlog_location="/usr/adm/lastlog"
|
||||
conf_utmp_location=/etc/utmp
|
||||
@@ -241,8 +266,12 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||
;;
|
||||
*-*-solaris*)
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
|
||||
need_dash_r=1
|
||||
if test "x$withval" = "xno" ; then
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
else
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
|
||||
need_dash_r=1
|
||||
fi
|
||||
AC_DEFINE(PAM_SUN_CODEBASE)
|
||||
AC_DEFINE(LOGIN_NEEDS_UTMPX)
|
||||
AC_DEFINE(LOGIN_NEEDS_TERM)
|
||||
@@ -278,14 +307,21 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||
LIBS="$LIBS -lc89"
|
||||
AC_DEFINE(USE_PIPES)
|
||||
AC_DEFINE(SSHD_ACQUIRES_CTTY)
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
;;
|
||||
*-sni-sysv*)
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
# /usr/ucblib MUST NOT be searched on ReliantUNIX
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
AC_CHECK_LIB(dl, dlsym, ,)
|
||||
IPADDR_IN_DISPLAY=yes
|
||||
AC_DEFINE(USE_PIPES)
|
||||
AC_DEFINE(IP_TOS_IS_BROKEN)
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
AC_DEFINE(SSHD_ACQUIRES_CTTY)
|
||||
external_path_file=/etc/default/login
|
||||
# /usr/ucblib/libucb.a no longer needed on ReliantUNIX
|
||||
@@ -395,6 +431,9 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||
fi
|
||||
AC_DEFINE(DISABLE_FD_PASSING)
|
||||
AC_DEFINE(BROKEN_GETADDRINFO)
|
||||
AC_DEFINE(SETEUID_BREAKS_SETUID)
|
||||
AC_DEFINE(BROKEN_SETREUID)
|
||||
AC_DEFINE(BROKEN_SETREGID)
|
||||
AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
|
||||
;;
|
||||
|
||||
@@ -463,7 +502,7 @@ AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
|
||||
sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
|
||||
sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
|
||||
sys/un.h time.h tmpdir.h ttyent.h usersec.h \
|
||||
util.h utime.h utmp.h utmpx.h)
|
||||
util.h utime.h utmp.h utmpx.h vis.h)
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
|
||||
@@ -517,18 +556,6 @@ AC_CHECK_FUNC(getspnam, ,
|
||||
AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
|
||||
AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
|
||||
|
||||
AC_ARG_WITH(rpath,
|
||||
[ --without-rpath Disable auto-added -R linker paths],
|
||||
[
|
||||
if test "x$withval" = "xno" ; then
|
||||
need_dash_r=""
|
||||
fi
|
||||
if test "x$withval" = "xyes" ; then
|
||||
need_dash_r=1
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
dnl zlib is required
|
||||
AC_ARG_WITH(zlib,
|
||||
[ --with-zlib=PATH Use zlib in PATH],
|
||||
@@ -714,7 +741,7 @@ dnl Checks for library functions. Please keep in alphabetical order
|
||||
AC_CHECK_FUNCS(\
|
||||
arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
|
||||
bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
|
||||
gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
|
||||
getaddrinfo getcwd getgrouplist getnameinfo getopt \
|
||||
getpeereid _getpty getrlimit getttyent glob inet_aton \
|
||||
inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
|
||||
mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
|
||||
@@ -726,6 +753,21 @@ AC_CHECK_FUNCS(\
|
||||
truncate utimes vhangup vsnprintf waitpid \
|
||||
)
|
||||
|
||||
# IRIX has a const char return value for gai_strerror()
|
||||
AC_CHECK_FUNCS(gai_strerror,[
|
||||
AC_DEFINE(HAVE_GAI_STRERROR)
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
const char *gai_strerror(int);],[
|
||||
char *str;
|
||||
|
||||
str = gai_strerror(0);],[
|
||||
AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
|
||||
[Define if gai_strerror() returns const char *])])])
|
||||
|
||||
AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
|
||||
|
||||
dnl Make sure prototypes are defined for these before using them.
|
||||
@@ -739,6 +781,30 @@ AC_CHECK_DECL(tcsendbreak,
|
||||
[#include <termios.h>]
|
||||
)
|
||||
|
||||
dnl Some platorms have setresuid that isn't implemented
|
||||
AC_MSG_CHECKING(if setresuid seems to work)
|
||||
AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
|
||||
],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_DEFINE(BROKEN_SETRESUID),
|
||||
AC_MSG_RESULT(not implemented)]
|
||||
)
|
||||
|
||||
dnl Some platorms have setresgid that isn't implemented
|
||||
AC_MSG_CHECKING(if setresgid seems to work)
|
||||
AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
|
||||
],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_DEFINE(BROKEN_SETRESGID)
|
||||
AC_MSG_RESULT(not implemented)]
|
||||
)
|
||||
|
||||
dnl Checks for time functions
|
||||
AC_CHECK_FUNCS(gettimeofday time)
|
||||
dnl Checks for utmp functions
|
||||
@@ -2183,11 +2249,15 @@ else
|
||||
fi
|
||||
|
||||
# check for /etc/default/login and use it if present.
|
||||
AC_ARG_ENABLE(etc-default-login,
|
||||
[ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
|
||||
[
|
||||
AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
|
||||
|
||||
if test "x$external_path_file" = "x/etc/default/login"; then
|
||||
AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
|
||||
if test $ac_cv_func_login_getcapbool = "yes" -a \
|
||||
@@ -2205,7 +2275,7 @@ AC_ARG_WITH(default-path,
|
||||
--with-default-path=PATH has no effect on this system.
|
||||
Edit /etc/login.conf instead.])
|
||||
elif test "x$withval" != "xno" ; then
|
||||
if ! test -z "$external_path_file" ; then
|
||||
if test ! -z "$external_path_file" ; then
|
||||
AC_MSG_WARN([
|
||||
--with-default-path=PATH will only be used if PATH is not defined in
|
||||
$external_path_file .])
|
||||
@@ -2217,7 +2287,7 @@ $external_path_file .])
|
||||
[ if test "x$external_path_file" = "x/etc/login.conf" ; then
|
||||
AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
|
||||
else
|
||||
if ! test -z "$external_path_file" ; then
|
||||
if test ! -z "$external_path_file" ; then
|
||||
AC_MSG_WARN([
|
||||
If PATH is defined in $external_path_file, ensure the path to scp is included,
|
||||
otherwise scp will not work.])
|
||||
@@ -2652,7 +2722,7 @@ echo " At runtime, sshd will use the path defined in $external_path_file"
|
||||
echo " Make sure the path to scp is present, otherwise scp will not work"
|
||||
else
|
||||
echo " sshd default user PATH: $I"
|
||||
if ! test -z "$external_path_file"; then
|
||||
if test ! -z "$external_path_file"; then
|
||||
echo " (If PATH is set in $external_path_file it will be used instead. If"
|
||||
echo " used, ensure the path to scp is present, otherwise scp will not work.)"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# PAM configuration file /etc/pam.conf
|
||||
# Example for OpenSSH on AIX 5.2
|
||||
#
|
||||
|
||||
# Authentication Management
|
||||
sshd auth required /usr/lib/security/pam_aix
|
||||
OTHER auth required /usr/lib/security/pam_aix
|
||||
|
||||
# Account Management
|
||||
sshd account required /usr/lib/security/pam_aix
|
||||
OTHER account required /usr/lib/security/pam_aix
|
||||
|
||||
# Session Management
|
||||
sshd password required /usr/lib/security/pam_aix
|
||||
OTHER password required /usr/lib/security/pam_aix
|
||||
|
||||
# Password Management
|
||||
sshd session required /usr/lib/security/pam_aix
|
||||
OTHER session required /usr/lib/security/pam_aix
|
||||
@@ -17,9 +17,9 @@
|
||||
#old cvs stuff. please update before use. may be deprecated.
|
||||
%define use_stable 1
|
||||
%if %{use_stable}
|
||||
%define version 3.6.1p2
|
||||
%define version 3.7.1p2
|
||||
%define cvs %{nil}
|
||||
%define release 2
|
||||
%define release 1
|
||||
%else
|
||||
%define version 2.9.9p2
|
||||
%define cvs cvs20011009
|
||||
@@ -180,7 +180,6 @@ CFLAGS="$RPM_OPT_FLAGS" \
|
||||
%configure \
|
||||
--with-pam \
|
||||
--with-tcp-wrappers \
|
||||
--with-ipv4-default \
|
||||
--with-privsep-path=%{_var}/empty/sshd \
|
||||
#leave this line for easy edits.
|
||||
|
||||
@@ -364,4 +363,4 @@ fi
|
||||
* Mon Jan 01 1998 ...
|
||||
Template Version: 1.31
|
||||
|
||||
$Id: openssh.spec,v 1.43 2003/04/29 13:22:40 djm Exp $
|
||||
$Id: openssh.spec,v 1.43.2.5 2003/10/04 05:31:02 tim Exp $
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
srcdir=../..
|
||||
prefix=/usr
|
||||
exec_prefix=$(prefix)
|
||||
bindir=$(prefix)/bin
|
||||
datadir=$(prefix)/share
|
||||
docdir=$(datadir)/doc
|
||||
sshdocdir=$(docdir)/openssh
|
||||
cygdocdir=$(docdir)/Cygwin
|
||||
sysconfdir=/etc
|
||||
defaultsdir=$(sysconfdir)/defaults/etc
|
||||
PRIVSEP_PATH=/var/empty
|
||||
INSTALL=/usr/bin/install -c
|
||||
|
||||
DESTDIR=
|
||||
|
||||
all:
|
||||
@echo
|
||||
@echo "Use \`make cygwin-postinstall DESTDIR=[package directory]'"
|
||||
@echo "Be sure having DESTDIR set correctly!"
|
||||
@echo
|
||||
|
||||
move-config-files: $(DESTDIR)$(sysconfdir)/ssh_config $(DESTDIR)$(sysconfdir)/sshd_config
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(defaultsdir)
|
||||
mv $(DESTDIR)$(sysconfdir)/ssh_config $(DESTDIR)$(defaultsdir)
|
||||
mv $(DESTDIR)$(sysconfdir)/sshd_config $(DESTDIR)$(defaultsdir)
|
||||
|
||||
remove-empty-dir:
|
||||
rm -rf $(DESTDIR)$(PRIVSEP_PATH)
|
||||
|
||||
install-sshdoc:
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(sshdocdir)
|
||||
$(INSTALL) -m 644 $(srcdir)/CREDITS $(DESTDIR)$(sshdocdir)/CREDITS
|
||||
$(INSTALL) -m 644 $(srcdir)/ChangeLog $(DESTDIR)$(sshdocdir)/ChangeLog
|
||||
$(INSTALL) -m 644 $(srcdir)/LICENCE $(DESTDIR)$(sshdocdir)/LICENCE
|
||||
$(INSTALL) -m 644 $(srcdir)/OVERVIEW $(DESTDIR)$(sshdocdir)/OVERVIEW
|
||||
$(INSTALL) -m 644 $(srcdir)/README $(DESTDIR)$(sshdocdir)/README
|
||||
$(INSTALL) -m 644 $(srcdir)/README.dns $(DESTDIR)$(sshdocdir)/README.dns
|
||||
$(INSTALL) -m 644 $(srcdir)/README.privsep $(DESTDIR)$(sshdocdir)/README.privsep
|
||||
$(INSTALL) -m 644 $(srcdir)/README.smartcard $(DESTDIR)$(sshdocdir)/README.smartcard
|
||||
$(INSTALL) -m 644 $(srcdir)/RFC.nroff $(DESTDIR)$(sshdocdir)/RFC.nroff
|
||||
$(INSTALL) -m 644 $(srcdir)/TODO $(DESTDIR)$(sshdocdir)/TODO
|
||||
$(INSTALL) -m 644 $(srcdir)/WARNING.RNG $(DESTDIR)$(sshdocdir)/WARNING.RNG
|
||||
|
||||
install-cygwindoc: README
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(cygdocdir)
|
||||
$(INSTALL) -m 644 README $(DESTDIR)$(cygdocdir)/openssh.README
|
||||
|
||||
install-doc: install-sshdoc install-cygwindoc
|
||||
|
||||
install-scripts: ssh-host-config ssh-user-config
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
|
||||
$(INSTALL) -m 755 ssh-host-config $(DESTDIR)$(bindir)/ssh-host-config
|
||||
$(INSTALL) -m 755 ssh-user-config $(DESTDIR)$(bindir)/ssh-user-config
|
||||
|
||||
cygwin-postinstall: move-config-files remove-empty-dir install-doc install-scripts
|
||||
@echo "Cygwin specific configuration finished."
|
||||
+67
-53
@@ -1,4 +1,49 @@
|
||||
This package is the actual port of OpenSSH to Cygwin 1.3.
|
||||
This package describes important Cygwin specific stuff concerning OpenSSH.
|
||||
|
||||
The binary package is usually built for recent Cygwin versions and might
|
||||
not run on older versions. Please check http://cygwin.com/ for information
|
||||
about current Cygwin releases.
|
||||
|
||||
Build instructions are at the end of the file.
|
||||
|
||||
===========================================================================
|
||||
Important change since 3.7.1p2-2:
|
||||
|
||||
The ssh-host-config file doesn't create the /etc/ssh_config and
|
||||
/etc/sshd_config files from builtin here-scripts anymore, but it uses
|
||||
skeleton files installed in /etc/defaults/etc.
|
||||
|
||||
Also it now tries hard to create appropriate permissions on files.
|
||||
Same applies for ssh-user-config.
|
||||
|
||||
After creating the sshd service with ssh-host-config, it's advisable to
|
||||
call ssh-user-config for all affected users, also already exising user
|
||||
configurations. In the latter case, file and directory permissions are
|
||||
checked and changed, if requireed to match the host configuration.
|
||||
|
||||
Important note for Windows 2003 Server users:
|
||||
---------------------------------------------
|
||||
|
||||
2003 Server has a funny new feature. When starting services under SYSTEM
|
||||
account, these services have nearly all user rights which SYSTEM holds...
|
||||
except for the "Create a token object" right, which is needed to allow
|
||||
public key authentication :-(
|
||||
|
||||
There's no way around this, except for creating a substitute account which
|
||||
has the appropriate privileges. Basically, this account should be member
|
||||
of the administrators group, plus it should have the following user rights:
|
||||
|
||||
Create a token object
|
||||
Logon as a service
|
||||
Replace a process level token
|
||||
Increase Quota
|
||||
|
||||
The ssh-host-config script asks you, if it should create such an account,
|
||||
called "sshd_server". If you say "no" here, you're on your own. Please
|
||||
follow the instruction in ssh-host-config exactly if possible. Note that
|
||||
ssh-user-config sets the permissions on 2003 Server machines dependent of
|
||||
whether a sshd_server account exists or not.
|
||||
===========================================================================
|
||||
|
||||
===========================================================================
|
||||
Important change since 3.4p1-2:
|
||||
@@ -114,54 +159,6 @@ ${SYSTEMROOT}/system32/drivers/etc/services file:
|
||||
|
||||
ssh 22/tcp #SSH daemon
|
||||
|
||||
===========================================================================
|
||||
The following restrictions only apply to Cygwin versions up to 1.3.1
|
||||
===========================================================================
|
||||
|
||||
Authentication to sshd is possible in one of two ways.
|
||||
You'll have to decide before starting sshd!
|
||||
|
||||
- If you want to authenticate via RSA and you want to login to that
|
||||
machine to exactly one user account you can do so by running sshd
|
||||
under that user account. You must change /etc/sshd_config
|
||||
to contain the following:
|
||||
|
||||
RSAAuthentication yes
|
||||
|
||||
Moreover it's possible to use rhosts and/or rhosts with
|
||||
RSA authentication by setting the following in sshd_config:
|
||||
|
||||
RhostsAuthentication yes
|
||||
RhostsRSAAuthentication yes
|
||||
|
||||
- If you want to be able to login to different user accounts you'll
|
||||
have to start sshd under system account or any other account that
|
||||
is able to switch user context. Note that administrators are _not_
|
||||
able to do that by default! You'll have to give the following
|
||||
special user rights to the user:
|
||||
"Act as part of the operating system"
|
||||
"Replace process level token"
|
||||
"Increase quotas"
|
||||
and if used via service manager
|
||||
"Logon as a service".
|
||||
|
||||
The system account does of course own that user rights by default.
|
||||
|
||||
Unfortunately, if you choose that way, you can only logon with
|
||||
NT password authentification and you should change
|
||||
/etc/sshd_config to contain the following:
|
||||
|
||||
PasswordAuthentication yes
|
||||
RhostsAuthentication no
|
||||
RhostsRSAAuthentication no
|
||||
RSAAuthentication no
|
||||
|
||||
However you can login to the user which has started sshd with
|
||||
RSA authentication anyway. If you want that, change the RSA
|
||||
authentication setting back to "yes":
|
||||
|
||||
RSAAuthentication yes
|
||||
|
||||
Please note that OpenSSH does never use the value of $HOME to
|
||||
search for the users configuration files! It always uses the
|
||||
value of the pw_dir field in /etc/passwd as the home directory.
|
||||
@@ -169,7 +166,7 @@ If no home diretory is set in /etc/passwd, the root directory
|
||||
is used instead!
|
||||
|
||||
You may use all features of the CYGWIN=ntsec setting the same
|
||||
way as they are used by the `login' port on sources.redhat.com:
|
||||
way as they are used by Cygwin's login(1) port:
|
||||
|
||||
The pw_gecos field may contain an additional field, that begins
|
||||
with (upper case!) "U-", followed by the domain and the username
|
||||
@@ -186,6 +183,8 @@ way as they are used by the `login' port on sources.redhat.com:
|
||||
|
||||
locuser::1104:513:John Doe,U-user,S-1-5-21-...
|
||||
|
||||
Note that the CYGWIN=ntsec setting is required for public key authentication.
|
||||
|
||||
SSH2 server and user keys are generated by the `ssh-*-config' scripts
|
||||
as well.
|
||||
|
||||
@@ -194,15 +193,30 @@ configure are used for the Cygwin binary distribution:
|
||||
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--libexecdir='${exec_prefix}/sbin'
|
||||
--libexecdir='$(sbindir)' \
|
||||
--localstatedir=/var \
|
||||
--datadir='$(prefix)/share' \
|
||||
--mandir='$(datadir)/man' \
|
||||
--with-tcp-wrappers
|
||||
|
||||
You must have installed the zlib and openssl packages to be able to
|
||||
If you want to create a Cygwin package, equivalent to the one
|
||||
in the Cygwin binary distribution, install like this:
|
||||
|
||||
mkdir /tmp/cygwin-ssh
|
||||
cd $(builddir)
|
||||
make install DESTDIR=/tmp/cygwin-ssh
|
||||
cd $(srcdir)/contrib/cygwin
|
||||
make cygwin-postinstall DESTDIR=/tmp/cygwin-ssh
|
||||
cd /tmp/cygwin-ssh
|
||||
find * \! -type d | tar cvjfT my-openssh.tar.bz2 -
|
||||
|
||||
You must have installed the zlib and openssl-devel packages to be able to
|
||||
build OpenSSH!
|
||||
|
||||
Please send requests, error reports etc. to [email protected].
|
||||
|
||||
Have fun,
|
||||
|
||||
Corinna Vinschen <[email protected]>
|
||||
Corinna Vinschen
|
||||
Cygwin Developer
|
||||
Red Hat Inc.
|
||||
|
||||
+262
-260
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# ssh-host-config, Copyright 2000, Red Hat Inc.
|
||||
# ssh-host-config, Copyright 2000, 2001, 2002, 2003 Red Hat Inc.
|
||||
#
|
||||
# This file is part of the Cygwin port of OpenSSH.
|
||||
|
||||
@@ -9,10 +9,7 @@ PREFIX=/usr
|
||||
|
||||
# Directory where the config files are stored
|
||||
SYSCONFDIR=/etc
|
||||
|
||||
# Subdirectory where an old package might be installed
|
||||
OLDPREFIX=/usr/local
|
||||
OLDSYSCONFDIR=${OLDPREFIX}/etc
|
||||
LOCALSTATEDIR=/var
|
||||
|
||||
progname=$0
|
||||
auto_answer=""
|
||||
@@ -27,9 +24,11 @@ request()
|
||||
{
|
||||
if [ "${auto_answer}" = "yes" ]
|
||||
then
|
||||
echo "$1 (yes/no) yes"
|
||||
return 0
|
||||
elif [ "${auto_answer}" = "no" ]
|
||||
then
|
||||
echo "$1 (yes/no) no"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -37,7 +36,7 @@ request()
|
||||
while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ]
|
||||
do
|
||||
echo -n "$1 (yes/no) "
|
||||
read answer
|
||||
read -e answer
|
||||
done
|
||||
if [ "X${answer}" = "Xyes" ]
|
||||
then
|
||||
@@ -60,7 +59,7 @@ do
|
||||
option=$1
|
||||
shift
|
||||
|
||||
case "$option" in
|
||||
case "${option}" in
|
||||
-d | --debug )
|
||||
set -x
|
||||
;;
|
||||
@@ -73,21 +72,33 @@ do
|
||||
auto_answer=no
|
||||
;;
|
||||
|
||||
-c | --cygwin )
|
||||
cygwin_value="$1"
|
||||
shift
|
||||
;;
|
||||
|
||||
-p | --port )
|
||||
port_number=$1
|
||||
shift
|
||||
;;
|
||||
|
||||
-w | --pwd )
|
||||
password_value="$1"
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "usage: ${progname} [OPTION]..."
|
||||
echo
|
||||
echo "This script creates an OpenSSH host configuration."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " --debug -d Enable shell's debug output."
|
||||
echo " --yes -y Answer all questions with \"yes\" automatically."
|
||||
echo " --no -n Answer all questions with \"no\" automatically."
|
||||
echo " --port -p <n> sshd listens on port n."
|
||||
echo " --debug -d Enable shell's debug output."
|
||||
echo " --yes -y Answer all questions with \"yes\" automatically."
|
||||
echo " --no -n Answer all questions with \"no\" automatically."
|
||||
echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var."
|
||||
echo " --port -p <n> sshd listens on port n."
|
||||
echo " --pwd -w <passwd> Use \"pwd\" as password for user 'sshd_server'."
|
||||
echo
|
||||
exit 1
|
||||
;;
|
||||
@@ -96,8 +107,13 @@ do
|
||||
done
|
||||
|
||||
# Check if running on NT
|
||||
_sys="`uname -a`"
|
||||
_nt=`expr "$_sys" : "CYGWIN_NT"`
|
||||
_sys="`uname`"
|
||||
_nt=`expr "${_sys}" : "CYGWIN_NT"`
|
||||
# If running on NT, check if running under 2003 Server or later
|
||||
if [ ${_nt} -gt 0 ]
|
||||
then
|
||||
_nt2003=`uname | awk -F- '{print ( $2 >= 5.2 ) ? 1 : 0;}'`
|
||||
fi
|
||||
|
||||
# Check for running ssh/sshd processes first. Refuse to do anything while
|
||||
# some ssh processes are still running
|
||||
@@ -137,87 +153,33 @@ fi
|
||||
|
||||
# Create /var/log and /var/log/lastlog if not already existing
|
||||
|
||||
if [ -f /var/log ]
|
||||
if [ -f ${LOCALSTATEDIR}/log ]
|
||||
then
|
||||
echo "Creating /var/log failed\!"
|
||||
echo "Creating ${LOCALSTATEDIR}/log failed!"
|
||||
else
|
||||
if [ ! -d /var/log ]
|
||||
if [ ! -d ${LOCALSTATEDIR}/log ]
|
||||
then
|
||||
mkdir -p /var/log
|
||||
mkdir -p ${LOCALSTATEDIR}/log
|
||||
fi
|
||||
if [ -d /var/log/lastlog ]
|
||||
if [ -d ${LOCALSTATEDIR}/log/lastlog ]
|
||||
then
|
||||
echo "Creating /var/log/lastlog failed\!"
|
||||
elif [ ! -f /var/log/lastlog ]
|
||||
chmod 777 ${LOCALSTATEDIR}/log/lastlog
|
||||
elif [ ! -f ${LOCALSTATEDIR}/log/lastlog ]
|
||||
then
|
||||
cat /dev/null > /var/log/lastlog
|
||||
cat /dev/null > ${LOCALSTATEDIR}/log/lastlog
|
||||
chmod 666 ${LOCALSTATEDIR}/log/lastlog
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create /var/empty file used as chroot jail for privilege separation
|
||||
if [ -f /var/empty ]
|
||||
if [ -f ${LOCALSTATEDIR}/empty ]
|
||||
then
|
||||
echo "Creating /var/empty failed\!"
|
||||
echo "Creating ${LOCALSTATEDIR}/empty failed!"
|
||||
else
|
||||
mkdir -p /var/empty
|
||||
# On NT change ownership of that dir to user "system"
|
||||
if [ $_nt -gt 0 ]
|
||||
mkdir -p ${LOCALSTATEDIR}/empty
|
||||
if [ ${_nt} -gt 0 ]
|
||||
then
|
||||
chmod 755 /var/empty
|
||||
chown system.system /var/empty
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for an old installation in ${OLDPREFIX} unless ${OLDPREFIX} isn't
|
||||
# the same as ${PREFIX}
|
||||
|
||||
old_install=0
|
||||
if [ "${OLDPREFIX}" != "${PREFIX}" ]
|
||||
then
|
||||
if [ -f "${OLDPREFIX}/sbin/sshd" ]
|
||||
then
|
||||
echo
|
||||
echo "You seem to have an older installation in ${OLDPREFIX}."
|
||||
echo
|
||||
# Check if old global configuration files exist
|
||||
if [ -f "${OLDSYSCONFDIR}/ssh_host_key" ]
|
||||
then
|
||||
if request "Do you want to copy your config files to your new installation?"
|
||||
then
|
||||
cp -f ${OLDSYSCONFDIR}/ssh_host_key ${SYSCONFDIR}
|
||||
cp -f ${OLDSYSCONFDIR}/ssh_host_key.pub ${SYSCONFDIR}
|
||||
cp -f ${OLDSYSCONFDIR}/ssh_host_dsa_key ${SYSCONFDIR}
|
||||
cp -f ${OLDSYSCONFDIR}/ssh_host_dsa_key.pub ${SYSCONFDIR}
|
||||
cp -f ${OLDSYSCONFDIR}/ssh_config ${SYSCONFDIR}
|
||||
cp -f ${OLDSYSCONFDIR}/sshd_config ${SYSCONFDIR}
|
||||
fi
|
||||
fi
|
||||
if request "Do you want to erase your old installation?"
|
||||
then
|
||||
rm -f ${OLDPREFIX}/bin/ssh.exe
|
||||
rm -f ${OLDPREFIX}/bin/ssh-config
|
||||
rm -f ${OLDPREFIX}/bin/scp.exe
|
||||
rm -f ${OLDPREFIX}/bin/ssh-add.exe
|
||||
rm -f ${OLDPREFIX}/bin/ssh-agent.exe
|
||||
rm -f ${OLDPREFIX}/bin/ssh-keygen.exe
|
||||
rm -f ${OLDPREFIX}/bin/slogin
|
||||
rm -f ${OLDSYSCONFDIR}/ssh_host_key
|
||||
rm -f ${OLDSYSCONFDIR}/ssh_host_key.pub
|
||||
rm -f ${OLDSYSCONFDIR}/ssh_host_dsa_key
|
||||
rm -f ${OLDSYSCONFDIR}/ssh_host_dsa_key.pub
|
||||
rm -f ${OLDSYSCONFDIR}/ssh_config
|
||||
rm -f ${OLDSYSCONFDIR}/sshd_config
|
||||
rm -f ${OLDPREFIX}/man/man1/ssh.1
|
||||
rm -f ${OLDPREFIX}/man/man1/scp.1
|
||||
rm -f ${OLDPREFIX}/man/man1/ssh-add.1
|
||||
rm -f ${OLDPREFIX}/man/man1/ssh-agent.1
|
||||
rm -f ${OLDPREFIX}/man/man1/ssh-keygen.1
|
||||
rm -f ${OLDPREFIX}/man/man1/slogin.1
|
||||
rm -f ${OLDPREFIX}/man/man8/sshd.8
|
||||
rm -f ${OLDPREFIX}/sbin/sshd.exe
|
||||
rm -f ${OLDPREFIX}/sbin/sftp-server.exe
|
||||
fi
|
||||
old_install=1
|
||||
chmod 755 ${LOCALSTATEDIR}/empty
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -255,50 +217,16 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create default ssh_config from here script
|
||||
# Create default ssh_config from skeleton file in /etc/defaults/etc
|
||||
|
||||
if [ ! -f "${SYSCONFDIR}/ssh_config" ]
|
||||
then
|
||||
echo "Generating ${SYSCONFDIR}/ssh_config file"
|
||||
cat > ${SYSCONFDIR}/ssh_config << EOF
|
||||
# This is the ssh client system-wide configuration file. See
|
||||
# ssh_config(5) for more information. This file provides defaults for
|
||||
# users, and the values can be changed in per-user configuration files
|
||||
# or on the command line.
|
||||
|
||||
# Configuration data is parsed as follows:
|
||||
# 1. command line options
|
||||
# 2. user-specific file
|
||||
# 3. system-wide file
|
||||
# Any configuration value is only changed the first time it is set.
|
||||
# Thus, host-specific definitions should be at the beginning of the
|
||||
# configuration file, and defaults at the end.
|
||||
|
||||
# Site-wide defaults for various options
|
||||
|
||||
# Host *
|
||||
# ForwardAgent no
|
||||
# ForwardX11 no
|
||||
# RhostsAuthentication no
|
||||
# RhostsRSAAuthentication no
|
||||
# RSAAuthentication yes
|
||||
# PasswordAuthentication yes
|
||||
# BatchMode no
|
||||
# CheckHostIP yes
|
||||
# StrictHostKeyChecking ask
|
||||
# IdentityFile ~/.ssh/identity
|
||||
# IdentityFile ~/.ssh/id_dsa
|
||||
# IdentityFile ~/.ssh/id_rsa
|
||||
# Port 22
|
||||
# Protocol 2,1
|
||||
# Cipher 3des
|
||||
# Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
|
||||
# EscapeChar ~
|
||||
EOF
|
||||
if [ "$port_number" != "22" ]
|
||||
cp ${SYSCONFDIR}/defaults/etc/ssh_config ${SYSCONFDIR}/ssh_config
|
||||
if [ "${port_number}" != "22" ]
|
||||
then
|
||||
echo "Host localhost" >> ${SYSCONFDIR}/ssh_config
|
||||
echo " Port $port_number" >> ${SYSCONFDIR}/ssh_config
|
||||
echo " Port ${port_number}" >> ${SYSCONFDIR}/ssh_config
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -320,35 +248,35 @@ fi
|
||||
|
||||
# Prior to creating or modifying sshd_config, care for privilege separation
|
||||
|
||||
if [ "$privsep_configured" != "yes" ]
|
||||
if [ "${privsep_configured}" != "yes" ]
|
||||
then
|
||||
if [ $_nt -gt 0 ]
|
||||
if [ ${_nt} -gt 0 ]
|
||||
then
|
||||
echo "Privilege separation is set to yes by default since OpenSSH 3.3."
|
||||
echo "However, this requires a non-privileged account called 'sshd'."
|
||||
echo "For more info on privilege separation read /usr/doc/openssh/README.privsep."
|
||||
echo "For more info on privilege separation read /usr/share/doc/openssh/README.privsep."
|
||||
echo
|
||||
if request "Shall privilege separation be used?"
|
||||
if request "Should privilege separation be used?"
|
||||
then
|
||||
privsep_used=yes
|
||||
grep -q '^sshd:' ${SYSCONFDIR}/passwd && sshd_in_passwd=yes
|
||||
net user sshd >/dev/null 2>&1 && sshd_in_sam=yes
|
||||
if [ "$sshd_in_passwd" != "yes" ]
|
||||
if [ "${sshd_in_passwd}" != "yes" ]
|
||||
then
|
||||
if [ "$sshd_in_sam" != "yes" ]
|
||||
if [ "${sshd_in_sam}" != "yes" ]
|
||||
then
|
||||
echo "Warning: The following function requires administrator privileges!"
|
||||
if request "Shall this script create a local user 'sshd' on this machine?"
|
||||
if request "Should this script create a local user 'sshd' on this machine?"
|
||||
then
|
||||
dos_var_empty=`cygpath -w /var/empty`
|
||||
net user sshd /add /fullname:"sshd privsep" "/homedir:$dos_var_empty" /active:no > /dev/null 2>&1 && sshd_in_sam=yes
|
||||
if [ "$sshd_in_sam" != "yes" ]
|
||||
dos_var_empty=`cygpath -w ${LOCALSTATEDIR}/empty`
|
||||
net user sshd /add /fullname:"sshd privsep" "/homedir:${dos_var_empty}" /active:no > /dev/null 2>&1 && sshd_in_sam=yes
|
||||
if [ "${sshd_in_sam}" != "yes" ]
|
||||
then
|
||||
echo "Warning: Creating the user 'sshd' failed!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "$sshd_in_sam" != "yes" ]
|
||||
if [ "${sshd_in_sam}" != "yes" ]
|
||||
then
|
||||
echo "Warning: Can't create user 'sshd' in ${SYSCONFDIR}/passwd!"
|
||||
echo " Privilege separation set to 'no' again!"
|
||||
@@ -363,119 +291,48 @@ then
|
||||
fi
|
||||
else
|
||||
# On 9x don't use privilege separation. Since security isn't
|
||||
# available it just adds useless addtional processes.
|
||||
# available it just adds useless additional processes.
|
||||
privsep_used=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create default sshd_config from here script or modify to add the
|
||||
# missing privsep configuration option
|
||||
# Create default sshd_config from skeleton files in /etc/defaults/etc or
|
||||
# modify to add the missing privsep configuration option
|
||||
|
||||
if [ ! -f "${SYSCONFDIR}/sshd_config" ]
|
||||
then
|
||||
echo "Generating ${SYSCONFDIR}/sshd_config file"
|
||||
cat > ${SYSCONFDIR}/sshd_config << EOF
|
||||
# This is the sshd server system-wide configuration file. See
|
||||
# sshd_config(5) for more information.
|
||||
|
||||
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
# The strategy used for options in the default sshd_config shipped with
|
||||
# OpenSSH is to specify options with their default value where
|
||||
# possible, but leave them commented. Uncommented options change a
|
||||
# default value.
|
||||
|
||||
Port $port_number
|
||||
#Protocol 2,1
|
||||
#ListenAddress 0.0.0.0
|
||||
#ListenAddress ::
|
||||
|
||||
# HostKey for protocol version 1
|
||||
#HostKey ${SYSCONFDIR}/ssh_host_key
|
||||
# HostKeys for protocol version 2
|
||||
#HostKey ${SYSCONFDIR}/ssh_host_rsa_key
|
||||
#HostKey ${SYSCONFDIR}/ssh_host_dsa_key
|
||||
|
||||
# Lifetime and size of ephemeral version 1 server key
|
||||
#KeyRegenerationInterval 3600
|
||||
#ServerKeyBits 768
|
||||
|
||||
# Logging
|
||||
#obsoletes QuietMode and FascistLogging
|
||||
#SyslogFacility AUTH
|
||||
#LogLevel INFO
|
||||
|
||||
# Authentication:
|
||||
|
||||
#LoginGraceTime 120
|
||||
#PermitRootLogin yes
|
||||
# The following setting overrides permission checks on host key files
|
||||
# and directories. For security reasons set this to "yes" when running
|
||||
# NT/W2K, NTFS and CYGWIN=ntsec.
|
||||
StrictModes no
|
||||
|
||||
#RSAAuthentication yes
|
||||
#PubkeyAuthentication yes
|
||||
#AuthorizedKeysFile .ssh/authorized_keys
|
||||
|
||||
# rhosts authentication should not be used
|
||||
#RhostsAuthentication no
|
||||
# Don't read the user's ~/.rhosts and ~/.shosts files
|
||||
#IgnoreRhosts yes
|
||||
# For this to work you will also need host keys in ${SYSCONFDIR}/ssh_known_hosts
|
||||
#RhostsRSAAuthentication no
|
||||
# similar for protocol version 2
|
||||
#HostbasedAuthentication no
|
||||
# Change to yes if you don't trust ~/.ssh/known_hosts for
|
||||
# RhostsRSAAuthentication and HostbasedAuthentication
|
||||
#IgnoreUserKnownHosts no
|
||||
|
||||
# To disable tunneled clear text passwords, change to no here!
|
||||
#PasswordAuthentication yes
|
||||
#PermitEmptyPasswords no
|
||||
|
||||
# Change to no to disable s/key passwords
|
||||
#ChallengeResponseAuthentication yes
|
||||
|
||||
#X11Forwarding no
|
||||
#X11DisplayOffset 10
|
||||
#X11UseLocalhost yes
|
||||
#PrintMotd yes
|
||||
#PrintLastLog yes
|
||||
#KeepAlive yes
|
||||
#UseLogin no
|
||||
UsePrivilegeSeparation $privsep_used
|
||||
#PermitUserEnvironment no
|
||||
#Compression yes
|
||||
|
||||
#MaxStartups 10
|
||||
# no default banner path
|
||||
#Banner /some/path
|
||||
#VerifyReverseMapping no
|
||||
|
||||
# override default of no subsystems
|
||||
Subsystem sftp /usr/sbin/sftp-server
|
||||
EOF
|
||||
elif [ "$privsep_configured" != "yes" ]
|
||||
sed -e "s/^#UsePrivilegeSeparation yes/UsePrivilegeSeparation ${privsep_used}/
|
||||
s/^#Port 22/Port ${port_number}/
|
||||
s/^#StrictModes yes/StrictModes no/" \
|
||||
< ${SYSCONFDIR}/defaults/etc/sshd_config \
|
||||
> ${SYSCONFDIR}/sshd_config
|
||||
elif [ "${privsep_configured}" != "yes" ]
|
||||
then
|
||||
echo >> ${SYSCONFDIR}/sshd_config
|
||||
echo "UsePrivilegeSeparation $privsep_used" >> ${SYSCONFDIR}/sshd_config
|
||||
echo "UsePrivilegeSeparation ${privsep_used}" >> ${SYSCONFDIR}/sshd_config
|
||||
fi
|
||||
|
||||
# Care for services file
|
||||
if [ $_nt -gt 0 ]
|
||||
_my_etcdir="/ssh-host-config.$$"
|
||||
if [ ${_nt} -gt 0 ]
|
||||
then
|
||||
_wservices="${SYSTEMROOT}\\system32\\drivers\\etc\\services"
|
||||
_wserv_tmp="${SYSTEMROOT}\\system32\\drivers\\etc\\srv.out.$$"
|
||||
_win_etcdir="${SYSTEMROOT}\\system32\\drivers\\etc"
|
||||
_services="${_my_etcdir}/services"
|
||||
# On NT, 27 spaces, no space after the hash
|
||||
_spaces=" #"
|
||||
else
|
||||
_wservices="${WINDIR}\\SERVICES"
|
||||
_wserv_tmp="${WINDIR}\\SERV.$$"
|
||||
_win_etcdir="${WINDIR}"
|
||||
_services="${_my_etcdir}/SERVICES"
|
||||
# On 9x, 18 spaces (95 is very touchy), a space after the hash
|
||||
_spaces=" # "
|
||||
fi
|
||||
_services=`cygpath -u "${_wservices}"`
|
||||
_serv_tmp=`cygpath -u "${_wserv_tmp}"`
|
||||
_serv_tmp="${_my_etcdir}/srv.out.$$"
|
||||
|
||||
mount -t -f "${_wservices}" "${_services}"
|
||||
mount -t -f "${_wserv_tmp}" "${_serv_tmp}"
|
||||
mount -t -f "${_win_etcdir}" "${_my_etcdir}"
|
||||
|
||||
# Depends on the above mount
|
||||
_wservices=`cygpath -w "${_services}"`
|
||||
|
||||
# Remove sshd 22/port from services
|
||||
if [ `grep -q 'sshd[ \t][ \t]*22' "${_services}"; echo $?` -eq 0 ]
|
||||
@@ -485,36 +342,34 @@ then
|
||||
then
|
||||
if mv "${_serv_tmp}" "${_services}"
|
||||
then
|
||||
echo "Removing sshd from ${_services}"
|
||||
echo "Removing sshd from ${_wservices}"
|
||||
else
|
||||
echo "Removing sshd from ${_services} failed\!"
|
||||
echo "Removing sshd from ${_wservices} failed!"
|
||||
fi
|
||||
rm -f "${_serv_tmp}"
|
||||
else
|
||||
echo "Removing sshd from ${_services} failed\!"
|
||||
echo "Removing sshd from ${_wservices} failed!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add ssh 22/tcp and ssh 22/udp to services
|
||||
if [ `grep -q 'ssh[ \t][ \t]*22' "${_services}"; echo $?` -ne 0 ]
|
||||
then
|
||||
awk '{ if ( $2 ~ /^23\/tcp/ ) print "ssh 22/tcp #SSH Remote Login Protocol\nssh 22/udp #SSH Remote Login Protocol"; print $0; }' < "${_services}" > "${_serv_tmp}"
|
||||
if [ -f "${_serv_tmp}" ]
|
||||
if awk '{ if ( $2 ~ /^23\/tcp/ ) print "ssh 22/tcp'"${_spaces}"'SSH Remote Login Protocol\nssh 22/udp'"${_spaces}"'SSH Remote Login Protocol"; print $0; }' < "${_services}" > "${_serv_tmp}"
|
||||
then
|
||||
if mv "${_serv_tmp}" "${_services}"
|
||||
then
|
||||
echo "Added ssh to ${_services}"
|
||||
echo "Added ssh to ${_wservices}"
|
||||
else
|
||||
echo "Adding ssh to ${_services} failed\!"
|
||||
echo "Adding ssh to ${_wservices} failed!"
|
||||
fi
|
||||
rm -f "${_serv_tmp}"
|
||||
else
|
||||
echo "Adding ssh to ${_services} failed\!"
|
||||
echo "WARNING: Adding ssh to ${_wservices} failed!"
|
||||
fi
|
||||
fi
|
||||
|
||||
umount "${_services}"
|
||||
umount "${_serv_tmp}"
|
||||
umount "${_my_etcdir}"
|
||||
|
||||
# Care for inetd.conf file
|
||||
_inetcnf="${SYSCONFDIR}/inetd.conf"
|
||||
@@ -535,11 +390,11 @@ then
|
||||
then
|
||||
echo "Removed sshd from ${_inetcnf}"
|
||||
else
|
||||
echo "Removing sshd from ${_inetcnf} failed\!"
|
||||
echo "Removing sshd from ${_inetcnf} failed!"
|
||||
fi
|
||||
rm -f "${_inetcnf_tmp}"
|
||||
else
|
||||
echo "Removing sshd from ${_inetcnf} failed\!"
|
||||
echo "Removing sshd from ${_inetcnf} failed!"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -557,34 +412,181 @@ then
|
||||
fi
|
||||
|
||||
# On NT ask if sshd should be installed as service
|
||||
if [ $_nt -gt 0 ]
|
||||
if [ ${_nt} -gt 0 ]
|
||||
then
|
||||
echo
|
||||
echo "Do you want to install sshd as service?"
|
||||
if request "(Say \"no\" if it's already installed as service)"
|
||||
# But only if it is not already installed
|
||||
if ! cygrunsrv -Q sshd > /dev/null 2>&1
|
||||
then
|
||||
echo
|
||||
echo "Which value should the environment variable CYGWIN have when"
|
||||
echo "sshd starts? It's recommended to set at least \"ntsec\" to be"
|
||||
echo "able to change user context without password."
|
||||
echo -n "Default is \"binmode ntsec tty\". CYGWIN="
|
||||
read _cygwin
|
||||
[ -z "${_cygwin}" ] && _cygwin="binmode ntsec tty"
|
||||
if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd -a -D -e "CYGWIN=${_cygwin}"
|
||||
echo
|
||||
echo "Warning: The following functions require administrator privileges!"
|
||||
echo
|
||||
echo "Do you want to install sshd as service?"
|
||||
if request "(Say \"no\" if it's already installed as service)"
|
||||
then
|
||||
chown system ${SYSCONFDIR}/ssh*
|
||||
echo
|
||||
echo "The service has been installed under LocalSystem account."
|
||||
if [ $_nt2003 -gt 0 ]
|
||||
then
|
||||
grep -q '^sshd_server:' ${SYSCONFDIR}/passwd && sshd_server_in_passwd=yes
|
||||
if [ "${sshd_server_in_passwd}" = "yes" ]
|
||||
then
|
||||
# Drop sshd_server from passwd since it could have wrong settings
|
||||
grep -v '^sshd_server:' ${SYSCONFDIR}/passwd > ${SYSCONFDIR}/passwd.$$
|
||||
rm -f ${SYSCONFDIR}/passwd
|
||||
mv ${SYSCONFDIR}/passwd.$$ ${SYSCONFDIR}/passwd
|
||||
chmod g-w,o-w ${SYSCONFDIR}/passwd
|
||||
fi
|
||||
net user sshd_server >/dev/null 2>&1 && sshd_server_in_sam=yes
|
||||
if [ "${sshd_server_in_sam}" != "yes" ]
|
||||
then
|
||||
echo
|
||||
echo "You appear to be running Windows 2003 Server or later. On 2003 and"
|
||||
echo "later systems, it's not possible to use the LocalSystem account"
|
||||
echo "if sshd should allow passwordless logon (e. g. public key authentication)."
|
||||
echo "If you want to enable that functionality, it's required to create a new"
|
||||
echo "account 'sshd_server' with special privileges, which is then used to run"
|
||||
echo "the sshd service under."
|
||||
echo
|
||||
echo "Should this script create a new local account 'sshd_server' which has"
|
||||
if request "the required privileges?"
|
||||
then
|
||||
_admingroup=`awk -F: '{if ( $2 == "S-1-5-32-544" ) print $1;}' ${SYSCONFDIR}/group`
|
||||
if [ -z "${_admingroup}" ]
|
||||
then
|
||||
echo "There's no group with SID S-1-5-32-544 (Local administrators group) in"
|
||||
echo "your ${SYSCONFDIR}/group file. Please regenerate this entry using 'mkgroup -l'"
|
||||
echo "and restart this script."
|
||||
exit 1
|
||||
fi
|
||||
dos_var_empty=`cygpath -w ${LOCALSTATEDIR}/empty`
|
||||
while [ "${sshd_server_in_sam}" != "yes" ]
|
||||
do
|
||||
if [ -n "${password_value}" ]
|
||||
then
|
||||
_password="${password_value}"
|
||||
# Allow to ask for password if first try fails
|
||||
password_value=""
|
||||
else
|
||||
echo
|
||||
echo "Please enter a password for new user 'sshd_server'. Please be sure that"
|
||||
echo "this password matches the password rules given on your system."
|
||||
echo -n "Entering no password will exit the configuration. PASSWORD="
|
||||
read -e _password
|
||||
if [ -z "${_password}" ]
|
||||
then
|
||||
echo
|
||||
echo "Exiting configuration. No user sshd_server has been created,"
|
||||
echo "no sshd service installed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
net user sshd_server "${_password}" /add /fullname:"sshd server account" "/homedir:${dos_var_empty}" /yes > /tmp/nu.$$ 2>&1 && sshd_server_in_sam=yes
|
||||
if [ "${sshd_server_in_sam}" != "yes" ]
|
||||
then
|
||||
echo "Creating the user 'sshd_server' failed! Reason:"
|
||||
cat /tmp/nu.$$
|
||||
rm /tmp/nu.$$
|
||||
fi
|
||||
done
|
||||
net localgroup "${_admingroup}" sshd_server /add > /dev/null 2>&1 && sshd_server_in_admingroup=yes
|
||||
if [ "${sshd_server_in_admingroup}" != "yes" ]
|
||||
then
|
||||
echo "WARNING: Adding user sshd_server to local group ${_admingroup} failed!"
|
||||
echo "Please add sshd_server to local group ${_admingroup} before"
|
||||
echo "starting the sshd service!"
|
||||
echo
|
||||
fi
|
||||
passwd_has_expiry_flags=`passwd -v | awk '/^passwd /{print ( $3 >= 1.5 ) ? "yes" : "no";}'`
|
||||
if [ "${passwd_has_expiry_flags}" != "yes" ]
|
||||
then
|
||||
echo
|
||||
echo "WARNING: User sshd_server has password expiry set to system default."
|
||||
echo "Please check that password never expires or set it to your needs."
|
||||
elif ! passwd -e sshd_server
|
||||
then
|
||||
echo
|
||||
echo "WARNING: Setting password expiry for user sshd_server failed!"
|
||||
echo "Please check that password never expires or set it to your needs."
|
||||
fi
|
||||
editrights -a SeAssignPrimaryTokenPrivilege -u sshd_server &&
|
||||
editrights -a SeCreateTokenPrivilege -u sshd_server &&
|
||||
editrights -a SeDenyInteractiveLogonRight -u sshd_server &&
|
||||
editrights -a SeDenyNetworkLogonRight -u sshd_server &&
|
||||
editrights -a SeDenyRemoteInteractiveLogonRight -u sshd_server &&
|
||||
editrights -a SeIncreaseQuotaPrivilege -u sshd_server &&
|
||||
editrights -a SeServiceLogonRight -u sshd_server &&
|
||||
sshd_server_got_all_rights="yes"
|
||||
if [ "${sshd_server_got_all_rights}" != "yes" ]
|
||||
then
|
||||
echo
|
||||
echo "Assigning the appropriate privileges to user 'sshd_server' failed!"
|
||||
echo "Can't create sshd service!"
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
echo "User 'sshd_server' has been created with password '${_password}'."
|
||||
echo "If you change the password, please keep in mind to change the password"
|
||||
echo "for the sshd service, too."
|
||||
echo
|
||||
echo "Also keep in mind that the user sshd_server needs read permissions on all"
|
||||
echo "users' .ssh/authorized_keys file to allow public key authentication for"
|
||||
echo "these users!. (Re-)running ssh-user-config for each user will set the"
|
||||
echo "required permissions correctly."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
if [ "${sshd_server_in_sam}" = "yes" ]
|
||||
then
|
||||
mkpasswd -l -u sshd_server | sed -e 's/bash$/false/' >> ${SYSCONFDIR}/passwd
|
||||
fi
|
||||
fi
|
||||
if [ -n "${cygwin_value}" ]
|
||||
then
|
||||
_cygwin="${cygwin_value}"
|
||||
else
|
||||
echo
|
||||
echo "Which value should the environment variable CYGWIN have when"
|
||||
echo "sshd starts? It's recommended to set at least \"ntsec\" to be"
|
||||
echo "able to change user context without password."
|
||||
echo -n "Default is \"ntsec\". CYGWIN="
|
||||
read -e _cygwin
|
||||
fi
|
||||
[ -z "${_cygwin}" ] && _cygwin="ntsec"
|
||||
if [ $_nt2003 -gt 0 -a "${sshd_server_in_sam}" = "yes" ]
|
||||
then
|
||||
if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd -a -D -u sshd_server -w "${_password}" -e "CYGWIN=${_cygwin}"
|
||||
then
|
||||
echo
|
||||
echo "The service has been installed under sshd_server account."
|
||||
echo "To start the service, call \`net start sshd' or \`cygrunsrv -S sshd'."
|
||||
fi
|
||||
else
|
||||
if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd -a -D -e "CYGWIN=${_cygwin}"
|
||||
then
|
||||
echo
|
||||
echo "The service has been installed under LocalSystem account."
|
||||
echo "To start the service, call \`net start sshd' or \`cygrunsrv -S sshd'."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Now check if sshd has been successfully installed. This allows to
|
||||
# set the ownership of the affected files correctly.
|
||||
if cygrunsrv -Q sshd > /dev/null 2>&1
|
||||
then
|
||||
if [ $_nt2003 -gt 0 -a "${sshd_server_in_sam}" = "yes" ]
|
||||
then
|
||||
_user="sshd_server"
|
||||
else
|
||||
_user="system"
|
||||
fi
|
||||
chown "${_user}" ${SYSCONFDIR}/ssh*
|
||||
chown "${_user}".544 ${LOCALSTATEDIR}/empty
|
||||
if [ -f ${LOCALSTATEDIR}/log/sshd.log ]
|
||||
then
|
||||
chown "${_user}".544 ${LOCALSTATEDIR}/log/sshd.log
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${old_install}" = "1" ]
|
||||
then
|
||||
echo
|
||||
echo "Note: If you have used sshd as service or from inetd, don't forget to"
|
||||
echo " change the path to sshd.exe in the service entry or in inetd.conf."
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Host configuration finished. Have fun!"
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ssh-user-config, Copyright 2000, Red Hat Inc.
|
||||
# ssh-user-config, Copyright 2000, 2001, 2002, 2003, Red Hat Inc.
|
||||
#
|
||||
# This file is part of the Cygwin port of OpenSSH.
|
||||
|
||||
# Directory where the config files are stored
|
||||
SYSCONFDIR=/etc
|
||||
|
||||
progname=$0
|
||||
auto_answer=""
|
||||
auto_passphrase="no"
|
||||
@@ -33,6 +36,15 @@ request()
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if running on NT
|
||||
_sys="`uname -a`"
|
||||
_nt=`expr "$_sys" : "CYGWIN_NT"`
|
||||
# If running on NT, check if running under 2003 Server or later
|
||||
if [ $_nt -gt 0 ]
|
||||
then
|
||||
_nt2003=`uname | awk -F- '{print ( $2 >= 5.2 ) ? 1 : 0;}'`
|
||||
fi
|
||||
|
||||
# Check options
|
||||
|
||||
while :
|
||||
@@ -84,27 +96,27 @@ done
|
||||
|
||||
# Ask user if user identity should be generated
|
||||
|
||||
if [ ! -f /etc/passwd ]
|
||||
if [ ! -f ${SYSCONFDIR}/passwd ]
|
||||
then
|
||||
echo '/etc/passwd is nonexistant. Please generate an /etc/passwd file'
|
||||
echo "${SYSCONFDIR}/passwd is nonexistant. Please generate an ${SYSCONFDIR}/passwd file"
|
||||
echo 'first using mkpasswd. Check if it contains an entry for you and'
|
||||
echo 'please care for the home directory in your entry as well.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uid=`id -u`
|
||||
pwdhome=`awk -F: '{ if ( $3 == '${uid}' ) print $6; }' < /etc/passwd`
|
||||
pwdhome=`awk -F: '{ if ( $3 == '${uid}' ) print $6; }' < ${SYSCONFDIR}/passwd`
|
||||
|
||||
if [ "X${pwdhome}" = "X" ]
|
||||
then
|
||||
echo 'There is no home directory set for you in /etc/passwd.'
|
||||
echo "There is no home directory set for you in ${SYSCONFDIR}/passwd."
|
||||
echo 'Setting $HOME is not sufficient!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${pwdhome}" ]
|
||||
then
|
||||
echo "${pwdhome} is set in /etc/passwd as your home directory"
|
||||
echo "${pwdhome} is set in ${SYSCONFDIR}/passwd as your home directory"
|
||||
echo 'but it is not a valid directory. Cannot create user identity files.'
|
||||
exit 1
|
||||
fi
|
||||
@@ -114,7 +126,7 @@ fi
|
||||
if [ "X${pwdhome}" = "X/" ]
|
||||
then
|
||||
# But first raise a warning!
|
||||
echo 'Your home directory in /etc/passwd is set to root (/). This is not recommended!'
|
||||
echo "Your home directory in ${SYSCONFDIR}/passwd is set to root (/). This is not recommended!"
|
||||
if request "Would you like to proceed anyway?"
|
||||
then
|
||||
pwdhome=''
|
||||
@@ -123,6 +135,17 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "${pwdhome}" -a $_nt -gt 0 -a -n "`chmod -c g-w,o-w "${pwdhome}"`" ]
|
||||
then
|
||||
echo
|
||||
echo 'WARNING: group and other have been revoked write permission to your home'
|
||||
echo " directory ${pwdhome}."
|
||||
echo ' This is required by OpenSSH to allow public key authentication using'
|
||||
echo ' the key files stored in your .ssh subdirectory.'
|
||||
echo ' Revert this change ONLY if you know what you are doing!'
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ -e "${pwdhome}/.ssh" -a ! -d "${pwdhome}/.ssh" ]
|
||||
then
|
||||
echo "${pwdhome}/.ssh is existant but not a directory. Cannot create user identity files."
|
||||
@@ -139,6 +162,21 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $_nt -gt 0 ]
|
||||
then
|
||||
_user="system"
|
||||
if [ $_nt2003 -gt 0 ]
|
||||
then
|
||||
grep -q '^sshd_server:' ${SYSCONFDIR}/passwd && _user="sshd_server"
|
||||
fi
|
||||
if ! setfacl -m "u::rwx,u:${_user}:r--,g::---,o::---" "${pwdhome}/.ssh"
|
||||
then
|
||||
echo "${pwdhome}/.ssh couldn't be given the correct permissions."
|
||||
echo "Please try to solve this problem first."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "${pwdhome}/.ssh/identity" ]
|
||||
then
|
||||
if request "Shall I create an SSH1 RSA identity file for you?"
|
||||
@@ -196,5 +234,17 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $_nt -gt 0 -a -e "${pwdhome}/.ssh/authorized_keys" ]
|
||||
then
|
||||
if ! setfacl -m "u::rw-,u:${_user}:r--,g::---,o::---" "${pwdhome}/.ssh/authorized_keys"
|
||||
then
|
||||
echo
|
||||
echo "WARNING: Setting correct permissions to ${pwdhome}/.ssh/authorized_keys"
|
||||
echo "failed. Please care for the correct permissions. The minimum requirement"
|
||||
echo "is, the owner and ${_user} both need read permissions."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Configuration finished. Have fun!"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%define ver 3.6.1p2
|
||||
%define rel 3
|
||||
%define ver 3.7.1p2
|
||||
%define rel 1
|
||||
|
||||
# OpenSSH privilege separation requires a user & group ID
|
||||
%define sshd_uid 74
|
||||
@@ -84,7 +84,7 @@ BuildPreReq: /bin/login
|
||||
%if ! %{build6x}
|
||||
BuildPreReq: glibc-devel, pam
|
||||
%else
|
||||
BuildPreReq: db1-devel, /usr/include/security/pam_appl.h
|
||||
BuildPreReq: /usr/include/security/pam_appl.h
|
||||
%endif
|
||||
%if ! %{no_x11_askpass}
|
||||
BuildPreReq: XFree86-devel
|
||||
@@ -185,11 +185,12 @@ CFLAGS="$RPM_OPT_FLAGS -Os"; export CFLAGS
|
||||
--with-default-path=/usr/local/bin:/bin:/usr/bin \
|
||||
--with-superuser-path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin \
|
||||
--with-privsep-path=%{_var}/empty/sshd \
|
||||
--with-md5-passwords \
|
||||
%if %{scard}
|
||||
--with-smartcard \
|
||||
%endif
|
||||
%if %{rescue}
|
||||
--without-pam --with-md5-passwords \
|
||||
--without-pam \
|
||||
%else
|
||||
--with-pam \
|
||||
%endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Summary: OpenSSH, a free Secure Shell (SSH) protocol implementation
|
||||
Name: openssh
|
||||
Version: 3.6.1p2
|
||||
Version: 3.7.1p2
|
||||
URL: http://www.openssh.com/
|
||||
Release: 1
|
||||
Source0: openssh-%{version}.tar.gz
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: deattack.c,v 1.18 2002/03/04 17:27:39 stevesk Exp $");
|
||||
RCSID("$OpenBSD: deattack.c,v 1.19 2003/09/18 08:49:45 markus Exp $");
|
||||
|
||||
#include "deattack.h"
|
||||
#include "log.h"
|
||||
@@ -100,12 +100,12 @@ detect_attack(u_char *buf, u_int32_t len, u_char *IV)
|
||||
|
||||
if (h == NULL) {
|
||||
debug("Installing crc compensation attack detector.");
|
||||
h = (u_int16_t *) xmalloc(l * HASH_ENTRYSIZE);
|
||||
n = l;
|
||||
h = (u_int16_t *) xmalloc(n * HASH_ENTRYSIZE);
|
||||
} else {
|
||||
if (l > n) {
|
||||
h = (u_int16_t *) xrealloc(h, l * HASH_ENTRYSIZE);
|
||||
n = l;
|
||||
h = (u_int16_t *) xrealloc(h, n * HASH_ENTRYSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef _DEFINES_H
|
||||
#define _DEFINES_H
|
||||
|
||||
/* $Id: defines.h,v 1.103 2003/09/16 01:52:19 dtucker Exp $ */
|
||||
/* $Id: defines.h,v 1.103.2.1 2003/12/18 23:56:44 dtucker Exp $ */
|
||||
|
||||
|
||||
/* Constants */
|
||||
@@ -240,6 +240,7 @@ typedef unsigned char u_char;
|
||||
#ifndef HAVE_SIZE_T
|
||||
typedef unsigned int size_t;
|
||||
# define HAVE_SIZE_T
|
||||
# define SIZE_T_MAX UINT_MAX
|
||||
#endif /* HAVE_SIZE_T */
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
|
||||
@@ -40,6 +40,9 @@ RCSID("$OpenBSD: log.c,v 1.28 2003/05/24 09:02:22 djm Exp $");
|
||||
#include "xmalloc.h"
|
||||
|
||||
#include <syslog.h>
|
||||
#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H)
|
||||
# include <vis.h>
|
||||
#endif
|
||||
|
||||
static LogLevel log_level = SYSLOG_LEVEL_INFO;
|
||||
static int log_on_stderr = 1;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: misc.c,v 1.21 2003/04/12 10:15:36 markus Exp $");
|
||||
RCSID("$OpenBSD: misc.c,v 1.22 2003/09/18 08:49:45 markus Exp $");
|
||||
|
||||
#include "misc.h"
|
||||
#include "log.h"
|
||||
@@ -308,18 +308,21 @@ addargs(arglist *args, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buf[1024];
|
||||
int nalloc;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
nalloc = args->nalloc;
|
||||
if (args->list == NULL) {
|
||||
args->nalloc = 32;
|
||||
nalloc = 32;
|
||||
args->num = 0;
|
||||
} else if (args->num+2 >= args->nalloc)
|
||||
args->nalloc *= 2;
|
||||
} else if (args->num+2 >= nalloc)
|
||||
nalloc *= 2;
|
||||
|
||||
args->list = xrealloc(args->list, args->nalloc * sizeof(char *));
|
||||
args->list = xrealloc(args->list, nalloc * sizeof(char *));
|
||||
args->nalloc = nalloc;
|
||||
args->list[args->num++] = xstrdup(buf);
|
||||
args->list[args->num] = NULL;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
RCSID("$Id: fake-rfc2553.c,v 1.4 2003/06/13 22:43:23 djm Exp $");
|
||||
RCSID("$Id: fake-rfc2553.c,v 1.4.2.1 2003/09/22 02:09:18 dtucker Exp $");
|
||||
|
||||
#ifndef HAVE_GETNAMEINFO
|
||||
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
@@ -77,7 +77,11 @@ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
#endif /* !HAVE_GETNAMEINFO */
|
||||
|
||||
#ifndef HAVE_GAI_STRERROR
|
||||
#ifdef HAVE_CONST_GAI_STRERROR_PROTO
|
||||
const char *
|
||||
#else
|
||||
char *
|
||||
#endif
|
||||
gai_strerror(int err)
|
||||
{
|
||||
switch (err) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: fake-rfc2553.h,v 1.6 2003/08/29 16:59:52 mouring Exp $ */
|
||||
/* $Id: fake-rfc2553.h,v 1.6.2.1 2003/09/22 02:09:18 dtucker Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000-2003 Damien Miller. All rights reserved.
|
||||
@@ -137,7 +137,7 @@ int getaddrinfo(const char *, const char *,
|
||||
const struct addrinfo *, struct addrinfo **);
|
||||
#endif /* !HAVE_GETADDRINFO */
|
||||
|
||||
#ifndef HAVE_GAI_STRERROR
|
||||
#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO)
|
||||
char *gai_strerror(int);
|
||||
#endif /* !HAVE_GAI_STRERROR */
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ static char rcsid[] = "$OpenBSD: inet_ntoa.c,v 1.4 2003/06/02 20:18:35 millert E
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdio.h>
|
||||
#include "inet_ntoa.h"
|
||||
|
||||
char *inet_ntoa(struct in_addr in)
|
||||
{
|
||||
|
||||
@@ -27,11 +27,12 @@
|
||||
#include "ssh.h"
|
||||
#include "log.h"
|
||||
#include "servconf.h"
|
||||
#include "canohost.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#ifdef _AIX
|
||||
|
||||
#include <uinfo.h>
|
||||
#include <../xmalloc.h>
|
||||
#include "port-aix.h"
|
||||
|
||||
extern ServerOptions options;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: port-aix.h,v 1.14 2003/08/29 16:59:52 mouring Exp $ */
|
||||
/* $Id: port-aix.h,v 1.14.2.1 2003/09/19 10:46:22 dtucker Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -30,10 +30,10 @@
|
||||
#ifdef WITH_AIXAUTHENTICATE
|
||||
# include <login.h>
|
||||
# include <userpw.h>
|
||||
# include <usersec.h>
|
||||
# ifdef HAVE_SYS_AUDIT_H
|
||||
# if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG)
|
||||
# include <sys/audit.h>
|
||||
# endif
|
||||
# include <usersec.h>
|
||||
#endif
|
||||
|
||||
/* Some versions define r_type in the above headers, which causes a conflict */
|
||||
|
||||
@@ -104,10 +104,6 @@ shadow_pw(struct passwd *pw)
|
||||
|
||||
if (spw != NULL)
|
||||
pw_password = spw->ufld.fd_encrypt;
|
||||
# elif defined(__hpux) && !defined(HAVE_SECUREWARE)
|
||||
struct pr_passwd *spw;
|
||||
if (iscomsec() && (spw = getprpwnam(pw->pw_name)) != NULL)
|
||||
pw_password = spw->ufld.fd_encrypt;
|
||||
# endif
|
||||
|
||||
return pw_password;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: packet.c,v 1.109 2003/07/10 14:42:28 markus Exp $");
|
||||
RCSID("$OpenBSD: packet.c,v 1.110 2003/09/19 09:02:02 markus Exp $");
|
||||
|
||||
#include "openbsd-compat/sys-queue.h"
|
||||
|
||||
@@ -1020,7 +1020,9 @@ packet_read_poll2(u_int32_t *seqnr_p)
|
||||
cp = buffer_ptr(&incoming_packet);
|
||||
packet_length = GET_32BIT(cp);
|
||||
if (packet_length < 1 + 4 || packet_length > 256 * 1024) {
|
||||
#ifdef PACKET_DEBUG
|
||||
buffer_dump(&incoming_packet);
|
||||
#endif
|
||||
packet_disconnect("Bad packet length %u.", packet_length);
|
||||
}
|
||||
DBG(debug("input: packet len %u", packet_length+4));
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: progressmeter.c,v 1.15 2003/08/31 12:14:22 markus Exp $");
|
||||
RCSID("$OpenBSD: progressmeter.c,v 1.16 2003/09/23 20:18:52 markus Exp $");
|
||||
|
||||
#include "progressmeter.h"
|
||||
#include "atomicio.h"
|
||||
@@ -200,7 +200,7 @@ refresh_progress_meter(void)
|
||||
strlcat(buf, " ", win_size);
|
||||
}
|
||||
|
||||
atomicio(vwrite, STDOUT_FILENO, buf, win_size);
|
||||
atomicio(vwrite, STDOUT_FILENO, buf, win_size - 1);
|
||||
last_update = now;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.24 2003/07/03 08:24:13 markus Exp $
|
||||
# $OpenBSD: Makefile,v 1.25 2003/10/07 01:52:13 dtucker Exp $
|
||||
|
||||
REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec
|
||||
tests: $(REGRESS_TARGETS)
|
||||
@@ -14,6 +14,7 @@ LTESTS= connect \
|
||||
proto-mismatch \
|
||||
exit-status \
|
||||
transfer \
|
||||
banner \
|
||||
rekey \
|
||||
stderr-data \
|
||||
stderr-after-eof \
|
||||
@@ -40,7 +41,7 @@ CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
|
||||
ssh_config ssh_proxy sshd_config sshd_proxy \
|
||||
rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
|
||||
rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
|
||||
ls.copy remote_pid
|
||||
ls.copy banner.in banner.out remote_pid
|
||||
|
||||
#LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
|
||||
|
||||
|
||||
+11
-2
@@ -5,7 +5,7 @@ tid="disallow agent ptrace attach"
|
||||
|
||||
if have_prog uname ; then
|
||||
case `uname` in
|
||||
Linux|HP-UX|SunOS|NetBSD|AIX|CYGWIN*)
|
||||
AIX|CYGWIN*)
|
||||
echo "skipped (not supported on this platform)"
|
||||
exit 0
|
||||
;;
|
||||
@@ -19,6 +19,15 @@ else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$SUDO" ; then
|
||||
echo "skipped (SUDO not set)"
|
||||
exit 0
|
||||
else
|
||||
$SUDO chown 0 ${SSHAGENT}
|
||||
$SUDO chgrp 0 ${SSHAGENT}
|
||||
$SUDO chmod 2755 ${SSHAGENT}
|
||||
fi
|
||||
|
||||
trace "start agent"
|
||||
eval `${SSHAGENT} -s` > /dev/null
|
||||
r=$?
|
||||
@@ -32,7 +41,7 @@ EOF
|
||||
if [ $? -ne 0 ]; then
|
||||
fail "gdb failed: exit code $?"
|
||||
fi
|
||||
grep 'ptrace: Operation not permitted.' >/dev/null ${OBJ}/gdb.out
|
||||
egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace attach: Permission denied.' >/dev/null ${OBJ}/gdb.out
|
||||
r=$?
|
||||
rm -f ${OBJ}/gdb.out
|
||||
if [ $r -ne 0 ]; then
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# $OpenBSD: banner.sh,v 1.1 2003/10/07 01:52:13 dtucker Exp $
|
||||
# Placed in the Public Domain.
|
||||
|
||||
tid="banner"
|
||||
echo "Banner $OBJ/banner.in" >> $OBJ/sshd_proxy
|
||||
|
||||
for s in 0 10 100 1000 10000 100000 ; do
|
||||
if [ "$s" = "0" ]; then
|
||||
# create empty banner
|
||||
rm -f $OBJ/banner.in
|
||||
touch $OBJ/banner.in
|
||||
elif [ "$s" = "10" ]; then
|
||||
# create 10-byte banner file
|
||||
echo "abcdefghi" >$OBJ/banner.in
|
||||
else
|
||||
# increase size 10x
|
||||
cp $OBJ/banner.in $OBJ/banner.out
|
||||
for i in 0 1 2 3 4 5 6 7 8 ; do
|
||||
cat $OBJ/banner.out >> $OBJ/banner.in
|
||||
done
|
||||
fi
|
||||
|
||||
trace "test banner size $s"
|
||||
verbose "test $tid: size $s"
|
||||
${SSH} -2 -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out
|
||||
cmp $OBJ/banner.in $OBJ/banner.out || fail "banner size $s mismatch"
|
||||
done
|
||||
|
||||
rm -f $OBJ/banner.out $OBJ/banner.in
|
||||
+15
-1
@@ -1,4 +1,4 @@
|
||||
# $OpenBSD: sftp-cmds.sh,v 1.5 2003/07/19 00:46:31 djm Exp $
|
||||
# $OpenBSD: sftp-cmds.sh,v 1.6 2003/10/07 07:04:52 djm Exp $
|
||||
# Placed in the Public Domain.
|
||||
|
||||
# XXX - TODO:
|
||||
@@ -79,6 +79,20 @@ echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|
||||
|| fail "get failed"
|
||||
cmp $DATA ${COPY} || fail "corrupted copy after get"
|
||||
|
||||
rm -f ${COPY}
|
||||
verbose "$tid: get quoted"
|
||||
echo "get \"$DATA\" $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|
||||
|| fail "get failed"
|
||||
cmp $DATA ${COPY} || fail "corrupted copy after get"
|
||||
|
||||
rm -f ${QUOTECOPY}
|
||||
cp $DATA ${QUOTECOPY}
|
||||
verbose "$tid: get filename with quotes"
|
||||
echo "get \"$QUOTECOPY_ARG\" ${COPY}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|
||||
|| fail "put failed"
|
||||
cmp ${COPY} ${QUOTECOPY} || fail "corrupted copy after get with quotes"
|
||||
rm -f ${QUOTECOPY} ${COPY}
|
||||
|
||||
rm -f ${COPY}.dd/*
|
||||
verbose "$tid: get to directory"
|
||||
echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ fill_default_server_options(ServerOptions *options)
|
||||
{
|
||||
/* Portable-specific options */
|
||||
if (options->use_pam == -1)
|
||||
options->use_pam = 1;
|
||||
options->use_pam = 0;
|
||||
|
||||
/* Standard Options */
|
||||
if (options->protocol == SSH_PROTO_UNKNOWN)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: session.c,v 1.163 2003/08/31 13:29:05 markus Exp $");
|
||||
RCSID("$OpenBSD: session.c,v 1.164 2003/09/18 08:49:45 markus Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
@@ -798,8 +798,9 @@ void
|
||||
child_set_env(char ***envp, u_int *envsizep, const char *name,
|
||||
const char *value)
|
||||
{
|
||||
u_int i, namelen;
|
||||
char **env;
|
||||
u_int envsize;
|
||||
u_int i, namelen;
|
||||
|
||||
/*
|
||||
* If we're passed an uninitialized list, allocate a single null
|
||||
@@ -826,12 +827,13 @@ child_set_env(char ***envp, u_int *envsizep, const char *name,
|
||||
xfree(env[i]);
|
||||
} else {
|
||||
/* New variable. Expand if necessary. */
|
||||
if (i >= (*envsizep) - 1) {
|
||||
if (*envsizep >= 1000)
|
||||
fatal("child_set_env: too many env vars,"
|
||||
" skipping: %.100s", name);
|
||||
(*envsizep) += 50;
|
||||
env = (*envp) = xrealloc(env, (*envsizep) * sizeof(char *));
|
||||
envsize = *envsizep;
|
||||
if (i >= envsize - 1) {
|
||||
if (envsize >= 1000)
|
||||
fatal("child_set_env: too many env vars");
|
||||
envsize += 50;
|
||||
env = (*envp) = xrealloc(env, envsize * sizeof(char *));
|
||||
*envsizep = envsize;
|
||||
}
|
||||
/* Need to set the NULL pointer at end of array beyond the new slot. */
|
||||
env[i + 1] = NULL;
|
||||
@@ -912,9 +914,8 @@ static void
|
||||
read_etc_default_login(char ***env, u_int *envsize, uid_t uid)
|
||||
{
|
||||
char **tmpenv = NULL, *var;
|
||||
u_int i;
|
||||
size_t tmpenvsize = 0;
|
||||
mode_t mask;
|
||||
u_int i, tmpenvsize = 0;
|
||||
u_long mask;
|
||||
|
||||
/*
|
||||
* We don't want to copy the whole file to the child's environment,
|
||||
@@ -923,6 +924,9 @@ read_etc_default_login(char ***env, u_int *envsize, uid_t uid)
|
||||
*/
|
||||
read_environment_file(&tmpenv, &tmpenvsize, "/etc/default/login");
|
||||
|
||||
if (tmpenv == NULL)
|
||||
return;
|
||||
|
||||
if (uid == 0)
|
||||
var = child_get_env(tmpenv, "SUPATH");
|
||||
else
|
||||
@@ -932,7 +936,7 @@ read_etc_default_login(char ***env, u_int *envsize, uid_t uid)
|
||||
|
||||
if ((var = child_get_env(tmpenv, "UMASK")) != NULL)
|
||||
if (sscanf(var, "%5lo", &mask) == 1)
|
||||
umask(mask);
|
||||
umask((mode_t)mask);
|
||||
|
||||
for (i = 0; tmpenv[i] != NULL; i++)
|
||||
xfree(tmpenv[i]);
|
||||
|
||||
+3
-1
@@ -25,7 +25,7 @@
|
||||
/* XXX: recursive operations */
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sftp-int.c,v 1.62 2003/08/25 08:13:09 fgsch Exp $");
|
||||
RCSID("$OpenBSD: sftp-int.c,v 1.63 2003/10/07 07:04:16 djm Exp $");
|
||||
|
||||
#include "buffer.h"
|
||||
#include "xmalloc.h"
|
||||
@@ -350,7 +350,9 @@ get_pathname(const char **cpp, char **path)
|
||||
/* Search for terminating quote, unescape some chars */
|
||||
for (i = j = 0; i <= strlen(cp); i++) {
|
||||
if (cp[i] == quot) { /* Found quote */
|
||||
i++;
|
||||
(*path)[j] = '\0';
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
if (cp[i] == '\0') { /* End of string */
|
||||
|
||||
+9
-8
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include "openbsd-compat/sys-queue.h"
|
||||
RCSID("$OpenBSD: ssh-agent.c,v 1.111 2003/06/12 19:12:03 markus Exp $");
|
||||
RCSID("$OpenBSD: ssh-agent.c,v 1.112 2003/09/18 08:49:45 markus Exp $");
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/md5.h>
|
||||
@@ -784,7 +784,7 @@ process_message(SocketEntry *e)
|
||||
static void
|
||||
new_socket(sock_type type, int fd)
|
||||
{
|
||||
u_int i, old_alloc;
|
||||
u_int i, old_alloc, new_alloc;
|
||||
|
||||
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
|
||||
error("fcntl O_NONBLOCK: %s", strerror(errno));
|
||||
@@ -795,25 +795,26 @@ new_socket(sock_type type, int fd)
|
||||
for (i = 0; i < sockets_alloc; i++)
|
||||
if (sockets[i].type == AUTH_UNUSED) {
|
||||
sockets[i].fd = fd;
|
||||
sockets[i].type = type;
|
||||
buffer_init(&sockets[i].input);
|
||||
buffer_init(&sockets[i].output);
|
||||
buffer_init(&sockets[i].request);
|
||||
sockets[i].type = type;
|
||||
return;
|
||||
}
|
||||
old_alloc = sockets_alloc;
|
||||
sockets_alloc += 10;
|
||||
new_alloc = sockets_alloc + 10;
|
||||
if (sockets)
|
||||
sockets = xrealloc(sockets, sockets_alloc * sizeof(sockets[0]));
|
||||
sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0]));
|
||||
else
|
||||
sockets = xmalloc(sockets_alloc * sizeof(sockets[0]));
|
||||
for (i = old_alloc; i < sockets_alloc; i++)
|
||||
sockets = xmalloc(new_alloc * sizeof(sockets[0]));
|
||||
for (i = old_alloc; i < new_alloc; i++)
|
||||
sockets[i].type = AUTH_UNUSED;
|
||||
sockets[old_alloc].type = type;
|
||||
sockets_alloc = new_alloc;
|
||||
sockets[old_alloc].fd = fd;
|
||||
buffer_init(&sockets[old_alloc].input);
|
||||
buffer_init(&sockets[old_alloc].output);
|
||||
buffer_init(&sockets[old_alloc].request);
|
||||
sockets[old_alloc].type = type;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
+3
-2
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sshconnect.c,v 1.147 2003/06/29 12:44:38 markus Exp $");
|
||||
RCSID("$OpenBSD: sshconnect.c,v 1.148 2003/09/18 07:52:54 markus Exp $");
|
||||
|
||||
#include <openssl/bn.h>
|
||||
|
||||
@@ -271,9 +271,10 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
|
||||
optval = 0;
|
||||
optlen = sizeof(optval);
|
||||
if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval,
|
||||
&optlen) == -1)
|
||||
&optlen) == -1) {
|
||||
debug("getsockopt: %s", strerror(errno));
|
||||
break;
|
||||
}
|
||||
if (optval != 0) {
|
||||
errno = optval;
|
||||
break;
|
||||
|
||||
+18
-6
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sshconnect2.c,v 1.124 2003/08/25 10:33:33 djm Exp $");
|
||||
RCSID("$OpenBSD: sshconnect2.c,v 1.127 2003/10/11 08:26:43 markus Exp $");
|
||||
|
||||
#include "openbsd-compat/sys-queue.h"
|
||||
|
||||
@@ -358,10 +358,12 @@ void
|
||||
input_userauth_banner(int type, u_int32_t seq, void *ctxt)
|
||||
{
|
||||
char *msg, *lang;
|
||||
|
||||
debug3("input_userauth_banner");
|
||||
msg = packet_get_string(NULL);
|
||||
lang = packet_get_string(NULL);
|
||||
logit("%s", msg);
|
||||
if (options.log_level > SYSLOG_LEVEL_QUIET)
|
||||
fprintf(stderr, "%s", msg);
|
||||
xfree(msg);
|
||||
xfree(lang);
|
||||
}
|
||||
@@ -372,10 +374,14 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt)
|
||||
Authctxt *authctxt = ctxt;
|
||||
if (authctxt == NULL)
|
||||
fatal("input_userauth_success: no authentication context");
|
||||
if (authctxt->authlist)
|
||||
if (authctxt->authlist) {
|
||||
xfree(authctxt->authlist);
|
||||
if (authctxt->methoddata)
|
||||
authctxt->authlist = NULL;
|
||||
}
|
||||
if (authctxt->methoddata) {
|
||||
xfree(authctxt->methoddata);
|
||||
authctxt->methoddata = NULL;
|
||||
}
|
||||
authctxt->success = 1; /* break out */
|
||||
}
|
||||
|
||||
@@ -447,7 +453,12 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
|
||||
debug2("input_userauth_pk_ok: fp %s", fp);
|
||||
xfree(fp);
|
||||
|
||||
TAILQ_FOREACH(id, &authctxt->keys, next) {
|
||||
/*
|
||||
* search keys in the reverse order, because last candidate has been
|
||||
* moved to the end of the queue. this also avoids confusion by
|
||||
* duplicate keys
|
||||
*/
|
||||
TAILQ_FOREACH_REVERSE(id, &authctxt->keys, next, idlist) {
|
||||
if (key_equal(key, id->key)) {
|
||||
sent = sign_and_send_pubkey(authctxt, id);
|
||||
break;
|
||||
@@ -608,7 +619,7 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt)
|
||||
|
||||
packet_check_eom();
|
||||
|
||||
status=ssh_gssapi_init_ctx(gssctxt, options.gss_deleg_creds,
|
||||
status = ssh_gssapi_init_ctx(gssctxt, options.gss_deleg_creds,
|
||||
&recv_tok, &send_tok, NULL);
|
||||
|
||||
xfree(recv_tok.value);
|
||||
@@ -1080,6 +1091,7 @@ userauth_pubkey(Authctxt *authctxt)
|
||||
while ((id = TAILQ_FIRST(&authctxt->keys))) {
|
||||
if (id->tried++)
|
||||
return (0);
|
||||
/* move key to the end of the queue */
|
||||
TAILQ_REMOVE(&authctxt->keys, id, next);
|
||||
TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
|
||||
/*
|
||||
|
||||
+2
-2
@@ -68,8 +68,8 @@
|
||||
|
||||
# Set this to 'yes' to enable PAM authentication (via challenge-response)
|
||||
# and session processing. Depending on your PAM configuration, this may
|
||||
# bypass the setting of 'PasswordAuthentication'
|
||||
#UsePAM yes
|
||||
# bypass the setting of 'PasswordAuthentication' and 'PermitEmptyPasswords'
|
||||
#UsePAM no
|
||||
|
||||
#AllowTcpForwarding yes
|
||||
#GatewayPorts no
|
||||
|
||||
+2
-1
@@ -613,7 +613,8 @@ If you enable this, you should probably disable
|
||||
.Cm PasswordAuthentication .
|
||||
If you enable
|
||||
.CM UsePAM
|
||||
then you will not be able to run sshd as a non-root user.
|
||||
then you will not be able to run sshd as a non-root user. The default is
|
||||
.Dq no .
|
||||
.It Cm UsePrivilegeSeparation
|
||||
Specifies whether
|
||||
.Nm sshd
|
||||
|
||||
@@ -151,7 +151,7 @@ permanently_set_uid(struct passwd *pw)
|
||||
debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
|
||||
(u_int)pw->pw_gid);
|
||||
|
||||
#if defined(HAVE_SETRESGID)
|
||||
#if defined(HAVE_SETRESGID) && !defined(BROKEN_SETRESGID)
|
||||
if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0)
|
||||
fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
|
||||
#elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID)
|
||||
@@ -164,7 +164,7 @@ permanently_set_uid(struct passwd *pw)
|
||||
fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SETRESUID)
|
||||
#if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID)
|
||||
if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
|
||||
fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
|
||||
#elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID)
|
||||
@@ -191,10 +191,12 @@ permanently_set_uid(struct passwd *pw)
|
||||
(u_int)pw->pw_gid);
|
||||
}
|
||||
|
||||
#ifndef HAVE_CYGWIN
|
||||
/* Try restoration of UID if changed (test clearing of saved uid) */
|
||||
if (old_uid != pw->pw_uid &&
|
||||
(setuid(old_uid) != -1 || seteuid(old_uid) != -1))
|
||||
fatal("%s: was able to restore old [e]uid", __func__);
|
||||
#endif
|
||||
|
||||
/* Verify UID drop was successful */
|
||||
if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) {
|
||||
|
||||
Reference in New Issue
Block a user