Commit Graph

485 Commits

Author SHA1 Message Date
Manoj Ampalam 1e0c864707
session process path changes (#319)
Added utility to build session process command line - this accounts for restrictions from various shells. With these changes, scp and sftp-server are expected to be machine wide PATH if a custom shell (other than cmd.exe) is defined. Added comprehensive test cases.
Fixed issue with USERNAME env variable containing domain prefix too.

PowerShell/Win32-OpenSSH#1165
PowerShell/Win32-OpenSSH#1165
PowerShell/Win32-OpenSSH#1171
2018-06-04 12:16:13 -07:00
Manoj Ampalam 3fb0c252c3
Refactor session logic (default shell, non PTY, child spawning) (#312)
Changes include:
- Removing sid from pwd structure to comply with Unix structure
- Integrating default shell logic within pwd
- pwd placeholder to allow logins using usernames not associated with Windows account (possible via custom LSA authentication)
- Moving all nonPTY logic from shellhost to session.c. 
- ssh-shellhost is now exclusively for implementing PTY
- Spawning all session processes from within a shell
- Validation checks in safely_chroot
2018-05-22 21:49:58 -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
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
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
Darren Tucker 3c51143c63 Whitespace sync with upstream. 2018-02-13 09:07:29 +11:00
Darren Tucker 19edfd4af7 Whitespace sync with upstream. 2018-02-13 08:25:46 +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 b7548b12a6 upstream commit
Expose devices allocated for tun/tap forwarding.

At the client, the device may be obtained from a new %T expansion
for LocalCommand.

At the server, the allocated devices will be listed in a
SSH_TUNNEL variable exposed to the environment of any user sessions
started after the tunnel forwarding was established.

ok markus

Upstream-ID: e61e53f8ae80566e9ddc0d67a5df5bdf2f3c9f9e
2017-10-23 16:14:30 +11:00
Manoj Ampalam 97565d8b4f Ported upstream changes to Windows fork 2017-10-03 14:37:25 -07: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 de4ae07f12 upstream commit
Move several subprocess-related functions from various
locations to misc.c. Extend subprocess() to offer a little more control over
stdio disposition.

feedback & ok dtucker@

Upstream-ID: 3573dd7109d13ef9bd3bed93a3deb170fbfce049
2017-08-23 19:47:06 +10:00
Damien Miller 94bc1e7ffb Expose list of completed auth methods to PAM
bz#2408; ok dtucker@
2017-07-28 15:04:00 +10:00
Manoj Ampalam 3dd748c035 Merge branch 'master' of https://github.com/openssh/openssh-portable into latestw 2017-07-08 23:18:28 -07: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
djm@openbsd.org 8f57495927 upstream commit
refactor authentication logging

optionally record successful auth methods and public credentials
used in a file accessible to user sessions

feedback and ok markus@

Upstream-ID: 090b93036967015717b9a54fd0467875ae9d32fb
2017-06-24 16:56:11 +10:00
djm@openbsd.org 8904ffce05 upstream commit
no need to call log_init to reinitialise logged PID in
child sessions, since we haven't called openlog() in log_init() since 1999;
ok markus@

Upstream-ID: 0906e4002af5d83d3d544df75e1187c932a3cf2e
2017-06-24 16:48:39 +10:00
bagajjal 98eca17c65 terminal support for the accepting unicode input (#162)
Support the unicode characters as input to the ssh client.
PowerShell/Win32-OpenSSH#711
Remove the bAnsi related code changes to the ssh-shellhost.c as that code never executes..
Fixed "long pressing key issue for the slow ssh connections"
PowerShell/Win32-OpenSSH#701
fixed warning message in the latestw_all recent commits.
Fixed the issue with ssh failures in the latestw_all recent commits.
2017-06-13 21:25:01 -07:00
Manoj Ampalam dd88d8d5d4 Move to LibreSSL, Fixed issues arising from compiling Windows specific code at warling level 3 2017-06-13 10:33:47 -07:00
bagajjal f8077a9f8e Added support for SFTP only server for Windows
https://github.com/PowerShell/Win32-OpenSSH/issues/757
2017-06-08 11:48:54 -07:00
Manoj Ampalam f7e6475b96 Merge remote-tracking branch 'openssh/master' into latestw 2017-06-07 21:46:18 -07:00
deraadt@openbsd.org 9e509d4ec9 upstream commit
Switch to recallocarray() for a few operations.  Both
growth and shrinkage are handled safely, and there also is no need for
preallocation dances. Future changes in this area will be less error prone.
Review and one bug found by markus

Upstream-ID: 822d664d6a5a1d10eccb23acdd53578a679d5065
2017-06-01 14:55:22 +10: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 Kuhn a4250afadc strip drive letter from %HOMEPATH% (#103)
Many programs access the user's home directory as %HOMEDRIVE%%HOMEPATH%.

Without removing the drive letter from %HOMEPATH%, the result of this
concatenation is something like "C:C:\Users\mgkuhn" and results
in applications not finding the home directory.

After this change, OpenSSH will set %HOMEPATH% without a drive letter,
like Windows does, as documented at

  https://support.microsoft.com/en-us/help/101507/how-windows-nt-determines-a-user-s-home-directory

I also added a safety check to test that pw_dir_w is not empty.
2017-05-23 12:04:23 -07:00
Manoj Ampalam 894f6dd79c Changes to remove Impersonation Privilege requirement in sshd (#142)
https://github.com/PowerShell/Win32-OpenSSH/issues/726
2017-05-18 22:57:42 -07:00
Clouds 77cdb7086d Fix RegEnumValueW returned 234 (#131)
RegEnumValueW may return ERROR_MORE_DATA (234).
If lpData is NULL and lpcbData is non-NULL, the function stores the size of the data, in bytes, in the variable pointed to by lpcbData. This enables an application to determine the best way to allocate a buffer for the data.
If the buffer specified by lpData is not large enough to hold the data, the function returns ERROR_MORE_DATA and stores the required buffer size in the variable pointed to by lpcbData. In this case, the contents of lpData are undefined.
2017-05-09 22:00:32 -07:00
Manoj Ampalam c3c5c1fa7f Support I/O redirection in all ssh clients (ssh.exe, sftp.exe and scp.exe) (#113)
PowerShell/Win32-OpenSSH#668
2017-04-14 16:15:32 -07: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 71dd8145f3 Fixes to CI validation failures 2017-02-16 22:57:05 -08:00
Manoj Ampalam f80a467c20 Multiple Fixes (#82)
PowerShell/Win32-OpenSSH#524
PowerShell/Win32-OpenSSH#518
PowerShell/Win32-OpenSSH#517
2017-02-15 21:32:50 -08:00
Manoj Ampalam 9906e0515d Tidied do_exex_windows in session.c (https://github.com/PowerShell/Win32-OpenSSH/issues/510) 2017-02-02 15:03:21 -08:00
Manoj Ampalam c6b57c018c Got rid of w32posix.h and defs.h (https://github.com/PowerShell/Win32-OpenSSH/issues/498) 2017-01-25 14:43:55 -08:00
Manoj Ampalam 5ad8a2c358 Sources Merged from Win32 Fork 2016-12-19 14:46:28 -08:00
djm@openbsd.org 7844f357cd upstream commit
Add a sshd_config DisableForwaring option that disables
X11, agent, TCP, tunnel and Unix domain socket forwarding, as well as
anything else we might implement in the future.

This, like the 'restrict' authorized_keys flag, is intended to be a
simple and future-proof way of restricting an account. Suggested as
a complement to 'restrict' by Jann Horn; ok markus@

Upstream-ID: 203803f66e533a474086b38a59ceb4cf2410fcf7
2016-11-30 19:44:01 +11:00
otto@openbsd.org fc041c4714 upstream commit
fix previous, a condition was modified incorrectly; ok
markus@ deraadt@

Upstream-ID: c443e339768e7ed396dff3bb55f693e7d3641453
2016-08-29 11:20:28 +10:00
djm@openbsd.org 83b581862a upstream commit
remove UseLogin option and support for having /bin/login
manage login sessions; ok deraadt markus dtucker

Upstream-ID: bea7213fbf158efab7e602d9d844fba4837d2712
2016-08-23 14:29:07 +10:00
markus@openbsd.org 6cb6dcffe1 upstream commit
remove ssh1 server code; ok djm@

Upstream-ID: c24c0c32c49b91740d5a94ae914fb1898ea5f534
2016-08-14 11:19:14 +10:00
Darren Tucker aa37768f17 get_remote_name_or_ip inside LOGIN_NEEDS_UTMPX
Apply the same get_remote_name_or_ip -> session_get_remote_name_or_ip
change as commit 95767262 to the code inside #ifdef LOGIN_NEEDS_UTMPX.
Fixes build on AIX.
2016-06-20 15:55:34 +10:00
Damien Miller 85bdcd7c92 ignore PAM environment vars when UseLogin=yes
If PAM is configured to read user-specified environment variables
and UseLogin=yes in sshd_config, then a hostile local user may
attack /bin/login via LD_PRELOAD or similar environment variables
set via PAM.

CVE-2015-8325, found by Shayan Sadigh, via Colin Watson
2016-04-13 10:44:42 +10:00
djm@openbsd.org 4b4bfb01cd upstream commit
sanitise characters destined for xauth reported by
 github.com/tintinweb feedback and ok deraadt and markus

Upstream-ID: 18ad8d0d74cbd2ea3306a16595a306ee356aa261
2016-03-15 03:23:46 +11:00
djm@openbsd.org 95767262ca upstream commit
refactor canohost.c: move functions that cache results closer
 to the places that use them (authn and session code). After this, no state is
 cached in canohost.c

feedback and ok markus@

Upstream-ID: 5f2e4df88d4803fc8ec59ec53629105e23ce625e
2016-03-08 06:20:35 +11:00
djm@openbsd.org 5a0fcb7728 upstream commit
add a "Close session" log entry (at loglevel=verbose) to
 correspond to the existing "Starting session" one. Also include the session
 id number to make multiplexed sessions more apparent.

feedback and ok dtucker@

Upstream-ID: e72d2ac080e02774376325136e532cb24c2e617c
2016-02-17 16:37:55 +11:00
djm@openbsd.org 44fc7cd7dc upstream commit
skip "Could not chdir to home directory" message when
 chrooted

patch from Christian Hesse in bz#2485 ok dtucker@

Upstream-ID: 86783c1953da426dff5b03b03ce46e699d9e5431
2015-10-25 11:42:06 +11:00
deraadt@openbsd.org 657a5fbc0d upstream commit
rename xrealloc() to xreallocarray() since it follows
 that form. ok djm
2015-04-29 18:15:23 +10:00
deraadt@openbsd.org 2ae4f337b2 upstream commit
Replace <sys/param.h> with <limits.h> and other less
 dirty headers where possible.  Annotate <sys/param.h> lines with their
 current reasons.  Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1,
 LOGIN_NAME_MAX, etc.  Change MIN() and MAX() to local definitions of
 MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution.
 These are the files confirmed through binary verification. ok guenther,
 millert, doug (helped with the verification protocol)
2015-01-16 18:24:48 +11:00
djm@openbsd.org 141efe4954 upstream commit
move authfd.c and its tentacles to the new buffer/key
 API; ok markus@
2015-01-15 21:37:34 +11:00