Commit Graph

575 Commits

Author SHA1 Message Date
Manoj Ampalam 84e87be8ae
ConPTY changes and support for auto-updating known_hosts;
- Logic to support conpty (currently disabled until validation is complete)
- fdopen() and fchmod() support for file handles
- support for auto updating known_hosts via ssh and ssh-keygen
- Support for dynamic Windows-size changes with PTY
- Changes to support OneCore SDK
- Test cases
2018-07-25 15:15:05 -07:00
Manoj Ampalam 8bb672aa4d
Optimized group membership resolution (#327)
Current group membership resolution though very effective, is very slow. In a typical domain joined enterprise machine, adding a simple entry like the following in sshd_config
AllowGroups administrators
will incur a long delay in remote session establishment as sshd tried to pull all groups associated with the domain user.

Changes in this PR optimize the general case scenarios where no wild cards are in use. Specifically rules like this are processed promptly:

AllowGroups group1, group2, group3 //with no wild cards
Match Group group1 //single group with no negation and wild cards

Optimization is done by resolve the groupname in rule immediately to SID and checking its membership against user token. Enumerating the entire group membership is done on a lazy on-demand basis.

Beyond the optimization, there are 2 functional changes

- removed domain prefix for builtin groups
- removed domain prefix'ed versions of local groups since we are strictly following the convention that local principals shouldn't have any domain qualification.
2018-07-03 10:15:07 -07:00
Manoj Ampalam 7b28a316eb
Enable SFTP chroot support (#308)
- Added chroot implementation that simply stores the path in internal state and sets an environment variable
- Spawned processes pickup chroot from environment variable
- Core change in realpath and resolved_path_utf16 now take into account chroot path.
- Unit tests
- Other miscellaneous changes to account for chroot enabled logic in core code

PowerShell/Win32-OpenSSH#190
PowerShell/Win32-OpenSSH#292
2018-05-11 14:45:20 -07:00
Manoj Ampalam 2474b9130b Merge branch 'master' of https://github.com/openssh/openssh-portable into up_merge 2018-04-02 13:13:47 -07:00
Manoj Ampalam 7a8e119275
Fix for orphaned unprivileged workers on sshd login timeout (#290)
Issue: When sshd times out due to login grace timeout, it leaves behind the unprivileged worker orphaned.
Fix: Add missing child's reference in monitor.
2018-03-20 09:41:52 -07:00
Manoj Ampalam 2c559a2b6c
Added support for ETW based logging (#280)
https://github.com/PowerShell/Win32-OpenSSH/issues/95
2018-03-06 15:33:19 -08:00
djm@openbsd.org 7c85685760 upstream: switch over to the new authorized_keys options API and
remove the legacy one.

Includes a fairly big refactor of auth2-pubkey.c to retain less state
between key file lines.

feedback and ok markus@

OpenBSD-Commit-ID: dece6cae0f47751b9892080eb13d6625599573df
2018-03-03 14:37:16 +11:00
markus@openbsd.org 1b11ea7c58 upstream: Add experimental support for PQC XMSS keys (Extended
Hash-Based Signatures) The code is not compiled in by default (see WITH_XMSS
in Makefile.inc) Joint work with stefan-lukas_gazdag at genua.eu See
https://tools.ietf.org/html/draft-irtf-cfrg-xmss-hash-based-signatures-12 ok
djm@

OpenBSD-Commit-ID: ef3eccb96762a5d6f135d7daeef608df7776a7ac
2018-02-26 11:40:41 +11:00
Manoj Ampalam b3a3a5cc66
Multiple Fixes (#273)
PowerShell/Win32-OpenSSH#1065
Fix: In recent sshd architectural changes, post authentication changes that process user specific changes were missing in authenticated sshd worker. Added missing call.
PowerShell/Win32-OpenSSH#1052
Fix: getpwd* functions will now strip off domain of any local user account.
2018-02-21 10:09:18 -08:00
Darren Tucker ddc0f38148 Remove UNICOS support.
The code required to support it is quite invasive to the mainline
code that is synced with upstream and is an ongoing maintenance burden.
Both the hardware and software are literal museum pieces these days and
we could not find anyone still running OpenSSH on one.
2018-02-15 20:04:02 +11:00
dtucker@openbsd.org 05046d907c upstream Don't reset signal handlers inside handlers.
The signal handlers from the original ssh1 code on which OpenSSH
is based assume unreliable signals and reinstall their handlers.
Since OpenBSD (and pretty much every current system) has reliable
signals this is not needed.  In the unlikely even that -portable
is still being used on such systems we will deal with it in the
compat layer.  ok deraadt@

OpenBSD-Commit-ID: f53a1015cb6908431b92116130d285d71589612c
2018-02-13 09:29:09 +11:00
bagajjal b10f2232e5 fix lsa auth provider and minor bug fixes (#270)
https://github.com/PowerShell/Win32-OpenSSH/issues/1046
2018-02-02 15:45:32 -08:00
stsp@openbsd.org c9c1bba06a upstream commit
Fix a logic bug in sshd_exchange_identification which
prevented clients using major protocol version 2 from connecting to the
server. ok millert@

OpenBSD-Commit-ID: 8668dec04586e27f1c0eb039ef1feb93d80a5ee9
2018-01-24 11:59:01 +11:00
djm@openbsd.org 14b5c635d1 upstream commit
Drop compatibility hacks for some ancient SSH
implementations, including ssh.com <=2.* and OpenSSH <= 3.*.

These versions were all released in or before 2001 and predate the
final SSH RFCs. The hacks in question aren't necessary for RFC-
compliant SSH implementations.

ok markus@

OpenBSD-Commit-ID: 4be81c67db57647f907f4e881fb9341448606138
2018-01-23 16:40:29 +11:00
djm@openbsd.org 9e9c4a7e57 upstream commit
unbreak support for clients that advertise a protocol
version of "1.99" (indicating both v2 and v1 support). Busted by me during
SSHv1 purge in r1.358; bz2810, ok dtucker

OpenBSD-Commit-ID: e8f9c2bee11afc16c872bb79d6abe9c555bd0e4b
2018-01-23 16:40:28 +11:00
djm@openbsd.org d6364f6fb1 upstream commit
avoid modifying pw->pw_passwd; let endpwent() clean up
for us, but keep a scrubbed copy; bz2777, ok dtucker@

OpenBSD-Commit-ID: 715afc0f59c6b82c4929a73279199ed241ce0752
2018-01-23 16:40:28 +11:00
Manoj Ampalam fdd54b6334
Implement Unix styled privilege separation in Windows (#258)
OpenSSh privilege separation model - http://www.citi.umich.edu/u/provos/ssh/privsep.html 
Posix_spawn is implemented in POSIX adapter as an alternative to fork() that is heavily used in Privilege separation. 
Additional state info is added to sshd to accommodate distinguishing the various modes (privileged monitor, unprivileged child, authenticated child).
Required service state (like config and host keys) is transmitted over pipes from monitor to child processes.
Changes to installation scripts and tests to accomodate new architectural changes
2018-01-15 13:57:31 -08:00
Manoj Ampalam 2846d75e56 Merge branch 'master' of https://github.com/openssh/openssh-portable into m_temp 2017-11-16 14:03:24 -08:00
djm@openbsd.org@openbsd.org 548d3a66fe upstream commit
fix problem in configuration parsing when in config dump mode
(sshd -T) without providing a full connection specification (sshd -T -C ...)

spotted by bluhm@

OpenBSD-Commit-ID: 7125faf5740eaa9d3a2f25400a0bc85e94e28b8f
2017-11-14 11:46:38 +11:00
dtucker@openbsd.org@openbsd.org 0208a48517 upstream commit
When doing a config test with sshd -T, only require the
attributes that are actually used in Match criteria rather than (an
incomplete list of) all criteria.  ok djm@, man page help jmc@

OpenBSD-Commit-ID: b4e773c4212d3dea486d0259ae977551aab2c1fc
2017-11-03 16:20:41 +11:00
djm@openbsd.org@openbsd.org b77c29a07f upstream commit
improve printing of rdomain on accept() a little

OpenBSD-Commit-ID: 5da58db2243606899cedaa646c70201b2d12247a
2017-10-31 09:08:50 +11:00
Damien Miller 43c29bb7cf provide hooks and fallbacks for rdomain support 2017-10-25 13:11:38 +11:00
djm@openbsd.org 68af80e6fd upstream commit
add a "rdomain" criteria for the sshd_config Match
keyword to allow conditional configuration that depends on which rdomain(4) a
connection was recevied on. ok markus@

Upstream-ID: 27d8fd5a3f1bae18c9c6e533afdf99bff887a4fb
2017-10-25 12:26:21 +11:00
djm@openbsd.org 35eb33fb95 upstream commit
add sshd_config RDomain keyword to place sshd and the
subsequent user session (including the shell and any TCP/IP forwardings) into
the specified rdomain(4)

ok markus@

Upstream-ID: be2358e86346b5cacf20d90f59f980b87d1af0f5
2017-10-25 12:26:13 +11:00
djm@openbsd.org acf559e1cf upstream commit
Add optional rdomain qualifier to sshd_config's
ListenAddress option to allow listening on a different rdomain(4), e.g.

ListenAddress 0.0.0.0 rdomain 4

Upstream-ID: 24b6622c376feeed9e9be8b9605e593695ac9091
2017-10-25 12:26:06 +11:00
Damien Miller e3fa20e2e5 avoid -Wsign-compare warning in argv copying 2017-10-23 16:25:24 +11:00
djm@openbsd.org dceabc7ad7 upstream commit
replace statically-sized arrays in ServerOptions with
dynamic ones managed by xrecallocarray, removing some arbitrary (though
large) limits and saving a bit of memory; "much nicer" markus@

Upstream-ID: 1732720b2f478fe929d6687ac7b0a97ff2efe9d2
2017-10-20 12:01:02 +11:00
Manoj Ampalam 6fba3a2ae9 Merge branch 'master' of https://github.com/openssh/openssh-portable into latestw 2017-10-03 14:32:45 -07:00
djm@openbsd.org dbee4119b5 upstream commit
refactor channels.c

Move static state to a "struct ssh_channels" that is allocated at
runtime and tracked as a member of struct ssh.

Explicitly pass "struct ssh" to all channels functions.

Replace use of the legacy packet APIs in channels.c.

Rework sshd_config PermitOpen handling: previously the configuration
parser would call directly into the channels layer. After the refactor
this is not possible, as the channels structures are allocated at
connection time and aren't available when the configuration is parsed.
The server config parser now tracks PermitOpen itself and explicitly
configures the channels code later.

ok markus@

Upstream-ID: 11828f161656b965cc306576422613614bea2d8f
2017-09-12 17:37:02 +10:00
Manoj Ampalam eaf004d1c4 Merge branch 'master' of https://github.com/openssh/openssh-portable into m_temp
Resolved auth2-pubkey.c misc.c ssh-keygen.c
2017-08-27 22:05:23 -07:00
djm@openbsd.org 83fa3a0448 upstream commit
remove post-SSHv1 removal dead code from rsa.c and merge
the remaining bit that it still used into ssh-rsa.c; ok markus

Upstream-ID: ac8a048d24dcd89594b0052ea5e3404b473bfa2f
2017-07-21 14:17:32 +10:00
Manoj Ampalam f8f5e45f02 Decouple key-agent and privileged-agent use in sshd (#173)
PowerShell/Win32-OpenSSH#766
PowerShell/Win32-OpenSSH#783
2017-06-26 21:57:24 -07:00
Manoj Ampalam f7e6475b96 Merge remote-tracking branch 'openssh/master' into latestw 2017-06-07 21:46:18 -07:00
markus@openbsd.org 1e0cdf8efb upstream commit
clear session keys from memory; ok djm@

Upstream-ID: ecd178819868975affd5fd6637458b7c712b6a0f
2017-06-01 14:54:46 +10:00
markus@openbsd.org 92e9fe6331 upstream commit
remove now obsolete ctx from ssh_dispatch_run; ok djm@

Upstream-ID: 9870aabf7f4d71660c31fda91b942b19a8e68d29
2017-06-01 14:53:33 +10:00
markus@openbsd.org 54d90ace1d upstream commit
switch from Key typedef with struct sshkey; ok djm@

Upstream-ID: 3067d33e04efbe5131ce8f70668c47a58e5b7a1f
2017-05-31 10:47:31 +10:00
Manoj Ampalam 4df71693c2 Fix agent to recognize calls from sshd service (#149)
https://github.com/PowerShell/Win32-OpenSSH/issues/734
2017-05-24 21:52:20 -07:00
Manoj Ampalam ba7cf86417 Merge branch 'master' of https://github.com/openssh/openssh-portable into latestw 2017-05-19 23:08:42 -07:00
bagajjal 7d929c2954 Fix sshd logging (#128)
PowerShell/Win32-OpenSSH#709
https://github.com/PowerShell/Win32-OpenSSH/issues/708
2017-05-07 22:51:24 -07:00
djm@openbsd.org 873d3e7d9a upstream commit
remove KEY_RSA1

ok markus@

Upstream-ID: 7408517b077c892a86b581e19f82a163069bf133
2017-05-01 10:05:01 +10:00
djm@openbsd.org 97f4d3083b upstream commit
remove compat20/compat13/compat15 variables

ok markus@

Upstream-ID: 43802c035ceb3fef6c50c400e4ecabf12354691c
2017-05-01 09:42:37 +10:00
Oleg S 107fdd8730 sshd: Unlink unused environments after executing child process (#119) 2017-04-27 21:01:04 -07:00
Oleg S ab9e5f0452 sshd: Fix mem leak after call GetCommandLineW (#112) 2017-04-16 12:55:35 -07:00
Manoj Ampalam b924b42dea Ported recent changes for Windows 2017-04-10 16:10:15 -07:00
Manoj Ampalam e91d1f7ef1 Merge branch 'master' of https://github.com/openssh/openssh-portable into latestw 2017-04-10 15:11:19 -07:00
Darren Tucker d13281f296 Don't check privsep user or path when unprivileged
If running with privsep (mandatory now) as a non-privileged user, we
don't chroot or change to an unprivileged user however we still checked
the existence of the user and directory.  Don't do those checks if we're
not going to use them.  Based in part on a patch from Lionel Fourquaux
via Corinna Vinschen, ok djm@
2017-03-29 12:39:39 +11:00
Yanbing 425bc4033f latestw + Test Infra upgrades
Includes
- CR changes for upstream PR
- Fix in spawn_child logic
- Test Infra upgrades
2017-03-24 12:35:52 -07:00
Manoj Ampalam 78995b5a42 Merge branch 'master' of https://github.com/openssh/openssh-portable into latestw 2017-03-16 10:13:50 -07:00
deraadt@openbsd.org 1a321bfdb9 upstream commit
accidents happen to the best of us; ok djm

Upstream-ID: b7a9dbd71011ffde95e06f6945fe7197dedd1604
2017-03-15 15:04:14 +11:00
djm@openbsd.org a8c5eeacf0 upstream commit
Fix segfault when sshd attempts to load RSA1 keys (can
only happen when protocol v.1 support is enabled for the client). Reported by
Jakub Jelen in bz#2686; ok dtucker

Upstream-ID: 8fdaec2ba4b5f65db1d094f6714ce64b25d871d7
2017-03-15 13:34:20 +11:00