manu0401 27f6cfa7b0
Add an environement variable to control stdio mode (#759)
* Add an environement variable to control stdio mode

stdio descriptors (stdin, stdout and stderr) can be operated in various
modes by win32compat code. The behavior is set very early in
fd_table_initialize() by setting pio->type.

In https://github.com/PowerShell/Win32-OpenSSH/issues/1427 it was
chosen to set pio->type to NONSOCK_SYNC_FD to resolve an I/O hang
problem. Unfortunately this introduce problems for other ssh usage.

sshfs-wiun uses ssh and has at leas 6 open issues for the same
problem introduced by this NONSOCK_SYNC_FD change:
https://github.com/winfsp/sshfs-win/issues?q=is%3Aissue+cb+%3A87

The sshfs-win workaround it to use an older ssh.exe from cygwin, which
is bundled with sshfs-win. This program is unable to use ssh-agent,
which is quite frustrating. And if PATH is not set to use it, sshfs-win
cannot work.

This change introduce an OPENSSH_STDIO_MODE environment variable that
can be set to the following values: unknown, sock, nonsock, nonsock_sync.
It cause pio->type to be set to UNKNOWN_FD, SOCK_FD, NONSOCK_FD, and
NONSOCK_SYNC_FD respecitively. The default behavior when the variable
is not set is unchanged (which means NONSOCK_SYNC_FD).

Setting OPENSSH_STDIO_MODE="nonsock" lets sshfs-win work again with
openssh-portable ssh.exe. ssh-agent can be used, and this is good.

* Leave out  UNKNOWN_FD as the possible rtpes for stdio descriptors

An assert(pio->type != UNKNOWN_FD) in fd_table_set() causes that
case to fail early anyway.
2024-11-19 16:14:43 -05:00
2024-08-02 17:44:45 -04:00
2024-09-16 11:37:57 -04:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:03:27 -05:00
2024-05-17 14:42:49 +10:00
2024-07-24 10:25:43 -04:00
2023-08-21 16:35:13 -04:00
2024-07-24 10:25:43 -04:00
2019-10-02 10:54:28 +10:00
2023-08-21 16:35:13 -04:00
2021-04-02 10:14:32 -07:00
2024-07-24 10:25:43 -04:00
2024-11-18 16:55:49 -05:00
2017-10-20 12:58:35 +11:00
2017-10-20 12:58:35 +11:00
2020-12-22 19:43:55 +11:00
2016-03-08 06:20:35 +11:00
2024-07-01 14:36:28 +10:00
2024-07-24 10:25:43 -04:00
2023-03-24 13:56:25 +11:00
2024-05-17 14:42:49 +10:00
2023-02-10 10:03:27 -05:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:03:27 -05:00
2024-07-01 14:36:28 +10:00
2019-07-29 09:49:23 +10:00
2023-02-10 10:03:27 -05:00
2021-12-15 10:50:33 +11:00
2021-04-21 11:30:22 -07:00
2017-05-10 11:41:21 +10:00
2023-02-10 10:03:27 -05:00
2024-05-17 14:42:49 +10:00
2023-02-10 10:03:27 -05:00
2024-02-01 13:42:45 +11:00
2023-08-21 16:35:13 -04:00
2021-07-03 20:36:06 +10:00
2023-03-24 13:56:25 +11:00
2023-02-10 10:03:27 -05:00
2024-07-24 10:25:43 -04:00
2022-11-30 11:57:01 -05:00
2023-02-10 10:47:24 -05:00
2024-09-13 16:33:01 -04:00
2024-06-28 08:37:11 +10:00
2019-10-02 10:54:28 +10:00
2016-07-08 13:50:03 +10:00
2024-05-17 14:41:37 +10:00
2023-08-21 16:35:13 -04:00
2024-09-13 16:34:42 -04:00
2024-03-26 13:03:00 +11:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:47:24 -05:00
2024-07-24 10:25:43 -04:00
2015-01-15 21:39:14 +11:00
2024-02-01 13:42:45 +11:00
2022-02-28 23:58:28 -08:00
2018-11-05 12:22:20 -08:00
2024-08-02 14:21:01 -04:00
2023-02-10 10:03:27 -05:00
2024-04-03 14:40:32 +11:00
2023-08-21 16:35:13 -04:00
2024-07-01 14:33:26 +10:00
2020-02-11 12:51:24 +11:00
2023-03-03 14:50:03 +11:00
2019-09-19 15:41:23 +10:00
2024-07-24 10:25:43 -04:00
2015-03-23 17:08:12 +11:00
2023-02-10 10:47:24 -05:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:47:24 -05:00
2024-10-08 16:25:04 -04:00
2024-09-13 16:34:42 -04:00
2017-09-12 17:37:02 +10:00
2023-02-10 10:03:27 -05:00
2024-10-08 16:25:04 -04:00
2023-02-10 10:47:24 -05:00
2023-02-10 10:47:24 -05:00
2024-07-01 14:36:28 +10:00
2024-07-24 10:25:43 -04:00
2023-02-10 10:47:24 -05:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:47:24 -05:00
2023-02-10 10:47:24 -05:00
2023-08-21 16:35:13 -04:00
2023-02-10 10:03:27 -05:00
2023-02-10 10:03:27 -05:00
2024-07-24 10:25:43 -04:00
2024-07-01 14:36:28 +10:00
2024-07-01 14:36:28 +10:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:03:27 -05:00
2023-02-10 10:47:24 -05:00
2024-07-01 14:36:28 +10:00
2024-07-01 14:36:28 +10:00
2024-07-01 14:36:28 +10:00
2024-09-13 16:33:01 -04:00
2023-02-10 10:47:24 -05:00
2023-12-19 20:33:17 -05:00
2023-02-10 10:47:24 -05:00
2024-09-13 16:33:01 -04:00
2023-08-21 16:35:13 -04:00
2024-07-01 14:36:28 +10:00
2023-02-10 10:49:51 -05:00
2024-02-01 13:42:45 +11:00
2021-04-29 12:41:08 -07:00
2022-11-30 11:57:01 -05:00
2023-02-10 10:47:24 -05:00
2023-02-10 10:47:24 -05:00
2024-07-24 10:25:43 -04:00
2023-02-10 10:03:27 -05:00
2024-07-01 14:36:28 +10:00
2024-07-24 10:25:43 -04:00
2024-07-24 10:25:43 -04:00
2024-07-01 14:36:28 +10:00
2024-09-13 16:33:01 -04:00
2023-02-10 10:03:27 -05:00
2023-02-10 10:03:27 -05:00
2023-02-10 10:47:24 -05:00
2020-12-22 18:56:54 +11:00
2016-11-29 16:51:27 +11:00
2024-03-11 11:46:39 -04:00
2017-03-24 12:35:52 -07:00
2018-07-31 12:59:30 +10:00
2017-05-01 10:05:04 +10:00
2021-04-03 17:47:37 +11:00
2018-02-09 20:00:18 +11:00
2022-01-01 15:19:48 +11:00
2024-09-26 17:51:06 -04:00
2023-02-10 10:47:24 -05:00
2018-03-05 10:22:32 +11:00
2024-01-08 13:25:21 +11:00

Portable OpenSSH

C/C++ CI Fuzzing Status Coverity Status

OpenSSH is a complete implementation of the SSH protocol (version 2) for secure remote login, command execution and file transfer. It includes a client ssh and server sshd, file transfer utilities scp and sftp as well as tools for key generation (ssh-keygen), run-time key storage (ssh-agent) and a number of supporting programs.

This is a port of OpenBSD's OpenSSH to most Unix-like operating systems, including Linux, OS X and Cygwin. Portable OpenSSH polyfills OpenBSD APIs that are not available elsewhere, adds sshd sandboxing for more operating systems and includes support for OS-native authentication and auditing (e.g. using PAM).

Documentation

The official documentation for OpenSSH are the man pages for each tool:

Stable Releases

Stable release tarballs are available from a number of download mirrors. We recommend the use of a stable release for most users. Please read the release notes for details of recent changes and potential incompatibilities.

Building Portable OpenSSH

Dependencies

Portable OpenSSH is built using autoconf and make. It requires a working C compiler, standard library and headers.

libcrypto from either LibreSSL or OpenSSL may also be used. OpenSSH may be built without either of these, but the resulting binaries will have only a subset of the cryptographic algorithms normally available.

zlib is optional; without it transport compression is not supported.

FIDO security token support needs libfido2 and its dependencies and will be enabled automatically if they are found.

In addition, certain platforms and build-time options may require additional dependencies; see README.platform for details about your platform.

Building a release

Releases include a pre-built copy of the configure script and may be built using:

tar zxvf openssh-X.YpZ.tar.gz
cd openssh
./configure # [options]
make && make tests

See the Build-time Customisation section below for configure options. If you plan on installing OpenSSH to your system, then you will usually want to specify destination paths.

Building from git

If building from git, you'll need autoconf installed to build the configure script. The following commands will check out and build portable OpenSSH from git:

git clone https://github.com/openssh/openssh-portable # or https://anongit.mindrot.org/openssh.git
cd openssh-portable
autoreconf
./configure
make && make tests

Build-time Customisation

There are many build-time customisation options available. All Autoconf destination path flags (e.g. --prefix) are supported (and are usually required if you want to install OpenSSH).

For a full list of available flags, run ./configure --help but a few of the more frequently-used ones are described below. Some of these flags will require additional libraries and/or headers be installed.

Flag Meaning
--with-pam Enable PAM support. OpenPAM, Linux PAM and Solaris PAM are supported.
--with-libedit Enable libedit support for sftp.
--with-kerberos5 Enable Kerberos/GSSAPI support. Both Heimdal and MIT Kerberos implementations are supported.
--with-selinux Enable SELinux support.

Development

Portable OpenSSH development is discussed on the openssh-unix-dev mailing list (archive mirror). Bugs and feature requests are tracked on our Bugzilla.

Reporting bugs

Non-security bugs may be reported to the developers via Bugzilla or via the mailing list above. Security bugs should be reported to openssh@openssh.com.

Description
Portable OpenSSH, all Win32-OpenSSH releases and wiki are managed at https://github.com/powershell/Win32-OpenSSH
Readme 84 MiB
Languages
C 78.3%
Shell 6.7%
PowerShell 5.3%
Roff 4.9%
M4 2.4%
Other 2.4%