Commit Graph

705 Commits

Author SHA1 Message Date
Manoj Ampalam aaf11e2149
Fixed various unhandled failure paths in Kerb GSS/SSPI adapter (#393) 2019-10-10 11:42:28 -07:00
Manoj Ampalam d9773976a7
fix testbreak with SSH_ASKPASS change (#394)
Added askpass utility to support change around SSH_ASKPASS logic. Since prompt is now passed as a commandline parameter to SSH_ASKPASS, "cmd /c echo" based logic no longer works for automated passing of password.
2019-09-13 14:13:42 -07:00
Manoj Ampalam 9cc51aa7e4
Fixed issue around incorrect handling of Handle and CredHandle types in Kerb GSS/SSPI adapter code
Prior logic was using a common variable to encapsulate both these types and doing a runtime check based on GetTokenInformation call to determine the actual underlying type. These two types are not guaranteed to have different values and any conflict could result in a random crash that would be nearly impossible to debug.
2019-09-10 14:38:16 -07:00
Bryan Berns 8346fc0d43 Correct Unicode Path Handling (#388)
Adjusted realpath() to use _wfullpath() to handle cases where paths may contain unicode characters.
Addresses PowerShell/Win32-OpenSSH#1401.
2019-07-16 11:42:02 -07:00
Bryan Berns b68e74d05c Address GSSAPI Crash When Non-Domain User Is Specified (#385)
Updated gss_release_cred() to test if passed structure is actually a logon token and, if so, release the data properly.
Addresses PowerShell/Win32-OpenSSH#1405
2019-06-27 11:00:57 -07:00
Manoj Ampalam 1137942918
Refactored pester based E2E test setup (#384)
- Set up dedicated test endpoint instead of tweaking main service configuration.
- Got rid of redundant custom test configuration files.
- Cleaned up pester tests directory. Moved test filed to dedicated directory
- Revised TestDaemon start/stop routines to use "netstat" for host process identification. This gets rid of slight flakiness in previous approach.
2019-06-17 22:46:33 -07:00
Bryan Berns 3d35b912a7 Updated Permissions Check For SidHistory (#375)
- Updated check_secure_file_permission() to perform a reverse lookups on the trustee SID within the file security descriptor to account for multiple SIDs that actually point to the same user.
- Updated permissions message to display the resolved SID to help with end user debugging.

Addresses: PowerShell/Win32-OpenSSH#1342
2019-06-10 12:30:11 -07:00
Manoj Ampalam 7ed284f878
Ported v8.0 changes 2019-05-24 23:08:06 -07:00
Manoj Ampalam 7079aed39c Merge branch 'V_8_0' of https://github.com/openssh/openssh-portable 2019-05-22 14:18:23 -07:00
bugale c9c6da0bee Added keystroke mapping Shift+Tab in shellhost (#367) 2019-05-21 14:03:53 -07:00
Bryan Berns 18884b29fd Addressed Thread Hanging Issue (#374)
- Replaced TerminateThread() call with an interrupt routine to gracefully call _endthreadex(0).
- Resolves https://github.com/PowerShell/Win32-OpenSSH/issues/1338.
2019-05-21 13:56:59 -07:00
Bryan Berns 44ba5483cd Enable PKCS11 Support (#331)
- Enable use of PKCS11 library files by adjusting central configuration file.
- Modified dlsym() to return a void pointer instead of an int which is consistent with POSIX. The previous return type caused an issue with 32-bit builds with PKCS11 enabled.
2019-05-21 13:36:24 -07:00
Manoj Ampalam bfd4ddf194
Account for dev/null being reported as a terminal handle
https://github.com/PowerShell/Win32-OpenSSH/issues/1330

Issue: open(dev/nul) returns a handle is passes isatty() test (i.e its being treated as a terminal handle by OS). This handle seems to work fine for as a console handle for console APIs, except when NUL is explicitly redirected. 
This works
ssh -n target hostname

but this hangs due to a deadlock from writing a log entry on a console API failure
ssh -n target hostname < NUL

Fix: Ignore console API failures when the handle is being reported as invalid.
2019-05-21 13:25:49 -07:00
Bryan Berns 22cc95e986 Fixed fileio_fdopen() to simply return the file descriptor for non-disk file types
Addresses issue where an error message in SCP (server side) was not being returned to the pipe which causes the process to hang.  Resolves: https://github.com/PowerShell/Win32-OpenSSH/issues/1345
2019-05-21 13:22:54 -07:00
Chris Spencer 3449eb2152 Added dlerror() and fixed issue with dlopen() handling UTF-8 filenames
dlerror() is supposed to return a char *, but currently returns a
DWORD. Reimplement it using the Win32 FormatMessage function.
Correctly handle UTF-8 filenames in the Win32 implementation of dlopen()
2019-05-21 13:02:53 -07:00
Bryan Berns 959cbe3265 Allow Console Output In UTF-8 (#378)
- Address issue where console output does not display UTF-8 string properly.
- Resolves https://github.com/PowerShell/Win32-OpenSSH/issues/1225
2019-05-20 14:51:05 -07:00
Damien Miller a924de0c49 update versions 2019-04-05 03:41:52 +11:00
Bryan Berns 2abb7748a9 Address Renaming Issue With exFAT File Systems (#381)
- Updated Win32 error translation table to translate ERROR_INVALID_FUNCTION as EOPNOTSUPP which in turn allows the SFTP rename capability to failover to rename() when link()/unlink() combination does not work due to the volume not supporting it.
- Addressed file security descriptor with no defined DACL.
PowerShell/Win32-OpenSSH#1357
2019-03-25 09:53:23 -07:00
Darren Tucker 825ab32f0d On Cygwin run sshd as SYSTEM where possible.
Seteuid now creates user token using S4U.  We don't create a token
from scratch anymore, so we don't need the "Create a process token"
privilege.  The service can run under SYSTEM again...

...unless Cygwin is running on Windows Vista or Windows 7 in the
WOW64 32 bit emulation layer.  It turns out that WOW64 on these systems
didn't implement MsV1_0 S4U Logon so we still need the fallback
to NtCreateToken for these systems.

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
2019-03-14 08:51:17 +11:00
Corinna Vinschen 1d05b4adcb Cygwin: only tweak sshd_config file if it's new, drop creating sshd user
The sshd_config tweaks were executed even if the old file was
still in place.  Fix that.  Also disable sshd user creation.
It's not used on Cygwin.
2019-01-28 09:57:58 +11:00
Corinna Vinschen 89843de0c4 Cygwin: Change service name to cygsshd
Microsoft hijacked the sshd service name without asking.
2019-01-28 09:57:58 +11:00
Manoj Ampalam 68ad673db4
Workaround for PTY regressions
Changes from #353 enabled closing of previously duplicated Console handles - this is causing TTY rendering issues in ssh.exe.
Added a workaround for now to skip closing Console handles.
2019-01-11 12:19:39 -08:00
Manoj Ampalam cc708b2b7c
sshd_config - change default for GSSAPIAuthentication (#370)
As per https://man.openbsd.org/sshd_config, default for GSSAPIAuthentication is "no"
2019-01-10 10:29:12 -08:00
Manoj Ampalam d930619073
Override default location for authorized_keys for administrators (#369) 2019-01-08 22:23:58 -08:00
Bryan Berns 2f551d4535 Kerberos SSPI Support Via GSSAPI
Added an implementation of GSSAPI interface to support Kerberos SSPI within OpenSSH. This is only a partial definition of the full GSSAPI specification since OpenSSH only requires a subset of the overall GSSAPI functionality.
2019-01-08 20:29:58 -08:00
Manoj Ampalam 495db5b7e4
Fixes to ssh-agent issues
PowerShell/Win32-OpenSSH#1263
Issue: ssh-agent is using default sign algorithm, without considering related flags in request
Fix: parse flags and consider sign algorithm input

PowerShell/Win32-OpenSSH#1234
Issue: ssh-agent has old logic to lookup sshd account
Fix: remove this redundant logic
2019-01-05 13:16:51 -08:00
Yan Tesis c6fa13b82e Fix listing agent keys with forwarded agent (#363)
Gracefully fail SSH1 agent requests
2019-01-04 23:44:34 -08:00
Yanbing 54b0ce9b56
fix of issue 1290 (#358)
Fix processid assignment, memory leak and handle leaks on conpty session.
2018-11-16 15:36:31 -08:00
Manoj Ampalam 83bff88b24
Fix Console handle leaks (#357)
Issue: Earlier change missed "return" calls that will end up ignoring singleton logic and re-running console handle generation logic multiple times, leaking previously created handles in the process.

Fix: Add the missing "return" calls
2018-11-15 13:33:22 -08:00
bagajjal 4666c11e0e
Use kernerl32.dll instead of kernelbase.dll for checking conpty support (#356) 2018-11-14 14:49:24 -08:00
Darren Tucker f2970868f8 Improve warnings in cygwin service setup.
bz#2922, patch from vinschen at redhat.com.
2018-11-11 15:58:20 +11:00
Darren Tucker bd2d54fc1e Remove hardcoded service name in cygwin setup.
bz#2922, patch from Christian.Lupien at USherbrooke.ca, sanity check
by vinschen at redhat.com.
2018-11-11 15:54:54 +11:00
Manoj Ampalam 5faac25142
Fixes to PTY session regressions
With recent changes, PTY sessions are no longer working. The issue is due to TTY code in ssh.exe assuming that stdin and stdout are console handles. The reality could be different since these handles always are dup'ed or closed for other reasons.
Fix involves extracting console handles via CreateFile(CONIN\CONOUT).
2018-11-07 12:30:57 -08:00
bagajjal 6cacff8a74 dynamically check for conpty support (#352) 2018-11-07 12:29:29 -08:00
Yanbing a75116b6f8 Fix of 1211 and 1082 (#349)
PowerShell/Win32-OpenSSH#1211
PowerShell/Win32-OpenSSH#1082

Added support for posix_spawnp that executes the command directly instead of appending path. (SH_ASKPASS and proxy command use this). Refactored posix spawn commandline building logic to automatically account for Windows CRT escaping rules on all arguments.
2018-11-05 12:22:20 -08:00
Manoj Ampalam cc16f80123
Converge fork and upstream branches
- Removed #ifdef WINDOWS blocks in base code where the feature support can be conveyed by a failed POSIX API call
- Refactored password authentication code
- Other misc changes - Removed DebugBreak on Release Builds
2018-10-30 14:54:13 -07:00
bagajjal 8ff5517c3a
Fix unicode rendering issue at ssh client (#338) 2018-10-26 10:31:38 -07:00
Manoj Ampalam d74ae2e5dd Ported V7.9 changes 2018-10-25 12:22:09 -07:00
Manoj Ampalam 456c5fc72b Merge branch 'V_7_9' of https://github.com/openssh/openssh-portable 2018-10-25 11:55:02 -07:00
Manoj Ampalam 77a35d0b0d
Remove sshd account dependency (#348)
In Windows, unprivileged worker runs as a runtime generated virtual account. There should be no requirement to have a real account under the name of unprivileged user (sshd).
2018-10-23 22:31:08 +05:30
Damien Miller a7205e68de update version numbers ahead of release 2018-10-12 09:47:20 +11:00
Manoj Ampalam 68719a25df Ported fork to 7.8 2018-10-05 15:11:07 -07:00
Manoj Ampalam 1ce9e2005d Merge branch 'V_7_8' of https://github.com/openssh/openssh-portable into cwb 2018-10-04 14:43:51 -07:00
Manoj Ampalam af4e4113b2
Ported bash based E2E tests and integrated security fix for cve-2018-15473(#346)
- Updated code to dynamic load Lsa functions until RS5 SDK includes them
 - Add conpty support in openssh
- Fixed Wierd characters (?25l) are seen, when logged in from ssh client
- Backspace doesn't work in powershell window
- Changes to support ssh-shellhost as an alternative shell
- Added support to have ssh-shellhost work as a standby shell (ssh-shellhost -c "cmdline") simply executes cmdline via CreateProcess
- Added E2E test cases and fixed unittests broken from prior changes
- Added PTY launch interface that supports both conpty and ssh-shellhost pty.
- Implemented PTY control channel in ssh-shellhost that supports Window resize events.
- Fixed regression with starting a PTY session with an explicit command
- modified ssh-shellhost pty argument to ---pty to remove ambiguity in cases when both -p and -c are present in commandline. Ex. ssh-shellhost.exe -c "myprogram -p -c argument"
2018-10-04 14:16:02 -07:00
Yanbing 0840af06bf
Add support of posix_spawnp (#344)
Added support of posix_spawnp.
1. fix of issue https://github.com/PowerShell/Win32-OpenSSH/issues/1185
2. add End2End tests
2018-09-29 14:28:21 -07:00
Yanbing fc6d825b4d
Revert the isolation changes on Admin and Operational Channels
Revert the isolation changes on Admin and Operational Channels. They are enable by default and setting them to custom isolation adds 2 more independent autologgers on the system.
2018-09-19 11:54:04 -07:00
Yanbing 9e983eadf6
check the full name of the root instead of directory info (#342) 2018-09-17 16:48:52 -07:00
Yanbing 06ba674c67
Fix of issues 1139 (#341)
Fix of PowerShell/Win32-OpenSSH#1139. Now user can build use solution file without manual steps
1. Added prebuildevent to copy libressl
2. When there is no '.git' in the environment, $psscriptroot is the default location to look for the solution and log file
2018-09-17 16:04:13 -07:00
Damien Miller c8313e4923 update version numbers in anticipation of release 2018-08-17 05:45:36 +10:00
Yanbing 48e0cdbd5f
Grant Built-in-Users to log event to channels (#339)
Fix of PowerShell/Win32-OpenSSH#1174 to grant non-admin permission to log events
Change the file type to text so it will show the diff in the future
2018-08-11 00:45:48 -07:00