Portable OpenSSH
Go to file
Daniil Tatianin 6c49e5f7dc
Add support for locking memory on Linux
Linux wakes up kcompactd threads in order to make more contiguous memory
available on the system, it does this by migrating live movable pages
(actively modifying live processes' page tables and constantly flooding
them with page invalidation IPIs, which can be up to millions per
second), which causes the process to become unresponsive for up to
seconds or even minutes in some severe cases. In case of sshd, we want
to always be able to connect to the system, even if it's under heavy
kcompactd load.

Introduce an option to protect sshd and its children sessions from being
compacted by kcompactd (this works in cojunction with
compact_unevictable_allowed = 0). Note that we depend on MCL_ONFAULT
being available, which was introduced in linux 4.4. MCL_ONFAULT allows
the system to lock pages lazily, thus drastically reducing memory usage
of a locked process (without MCL_ONFAULT, every existing mapping in the
process is instantly write-faulted).
2025-03-23 11:24:03 +11:00
.github Fix workflow syntax again. 2025-03-19 17:41:28 +11:00
contrib openssh-9.9p2 2025-02-18 19:12:14 +11:00
m4
openbsd-compat Add support for locking memory on Linux 2025-03-23 11:24:03 +11:00
regress upstream: Prime caches for DNS names needed for tests. 2025-03-11 23:04:38 +11:00
.depend rebuild .depend 2025-03-13 10:45:53 +11:00
.git_allowed_signers Add new hardware-backed signing key for myself. 2024-12-06 23:54:45 +11:00
.git_allowed_signers.asc
.gitignore don't ignore changes in regress Makefiles 2024-12-05 01:01:04 +11:00
.skipped-commit-ids upstream: turn off CDIAGFLAGS and turn back on INSTALL_STRIP 2024-11-27 08:24:49 +11:00
addr.c
addr.h
addrmatch.c
atomicio.c
atomicio.h
audit-bsm.c
audit-linux.c
audit.c
audit.h
auth2-chall.c
auth2-gss.c
auth2-hostbased.c
auth2-kbdint.c
auth2-methods.c
auth2-none.c
auth2-passwd.c
auth2-pubkey.c upstream: Plug leak on error path, spotted by Coverity. ok djm@ 2024-12-12 21:23:32 +11:00
auth2-pubkeyfile.c
auth2.c upstream: Fix debug logging of user specific delay. Patch from 2025-02-06 09:41:20 +11:00
auth-bsdauth.c
auth-krb5.c
auth-options.c
auth-options.h
auth-pam.c
auth-pam.h
auth-passwd.c
auth-rhosts.c
auth-shadow.c
auth-sia.c
auth-sia.h
auth.c
auth.h
authfd.c
authfd.h
authfile.c
authfile.h
bitmap.c
bitmap.h
buildpkg.sh.in fix old typo (s/SYSVINITSTOPT/SYSVINITSTOP/) 2024-12-16 15:36:54 -08:00
canohost.c
canohost.h
chacha.c
chacha.h
channels.c upstream: De-magic the x11 base port number into a define. ok djm@ 2024-12-05 19:13:45 +11:00
channels.h
cipher-aes.c
cipher-aesctr.c
cipher-aesctr.h
cipher-chachapoly-libcrypto.c
cipher-chachapoly.c
cipher-chachapoly.h
cipher.c upstream: Fix EVP_CIPHER_CTX_ctrl() return checks 2025-03-18 15:56:36 +11:00
cipher.h
cleanup.c
clientloop.c upstream: spelling; ok djm@ 2024-12-05 01:28:54 +11:00
clientloop.h
compat.c
compat.h
config.guess
config.sub
configure.ac Add support for locking memory on Linux 2025-03-23 11:24:03 +11:00
CREDITS
crypto_api.h
defines.h Check for le32toh, le64toh, htole64 individually. 2025-02-26 18:16:03 +11:00
dh.c upstream: Remove fallback to compiled-in gropup for dhgex when the 2024-12-05 01:28:47 +11:00
dh.h
digest-libc.c
digest-openssl.c
digest.h
dispatch.c
dispatch.h
dns.c
dns.h
ed25519.c
ed25519.sh
entropy.c
entropy.h
fatal.c
fixalgorithms
fixpaths
groupaccess.c upstream: Ignore extra groups that don't fit in the buffer passed 2024-11-07 10:01:05 +11:00
groupaccess.h
gss-genr.c
gss-serv-krb5.c upstream: sshd: switch GSSAPI to sshbuf API; ok djm@ 2018-07-10 15:28:30 +10:00
gss-serv.c
hash.c
hmac.c
hmac.h
hostfile.c
hostfile.h
includes.h
INSTALL Update readme files to better reflect reality. 2024-12-04 21:37:22 +11:00
install-sh
kex-names.c
kex.c
kex.h
kexc25519.c
kexdh.c
kexecdh.c
kexgen.c
kexgex.c
kexgexc.c
kexgexs.c
kexmlkem768x25519.c
kexsntrup761x25519.c
krl.c upstream: Fix cases where error codes were not correctly set 2025-02-18 19:03:28 +11:00
krl.h
libcrux_mlkem768_sha3.h include __builtin_popcount replacement function 2025-03-02 22:06:53 +11:00
LICENCE
log.c upstream: add infrastructure for ratelimited logging; feedback/ok 2024-12-07 21:22:56 +11:00
log.h upstream: add infrastructure for ratelimited logging; feedback/ok 2024-12-07 21:22:56 +11:00
loginrec.c Add wtmpdb support as Y2038 safe wtmp replacement 2024-12-03 02:55:36 +11:00
loginrec.h Add wtmpdb support as Y2038 safe wtmp replacement 2024-12-03 02:55:36 +11:00
logintest.c
mac.c
mac.h
Makefile.in platform: introduce a way to hook new session start 2025-03-23 11:23:33 +11:00
match.c
match.h
mdoc2man.awk mdoc2man: balance nested square brackets 2024-11-28 19:20:10 +11:00
misc.c
misc.h
mkinstalldirs
mlkem768.sh include __builtin_popcount replacement function 2025-03-02 22:06:53 +11:00
moduli upstream: Import regenerated moduli. 2024-11-29 18:34:47 +11:00
moduli.5
moduli.c
monitor_fdpass.c
monitor_fdpass.h
monitor_wrap.c
monitor_wrap.h
monitor.c upstream: spelling; ok djm@ 2024-12-05 01:28:54 +11:00
monitor.h
msg.c
msg.h
mux.c
myproposal.h upstream: unbreak 2024-12-03 01:07:08 +11:00
nchan2.ms
nchan.c
nchan.ms
openssh.xml.in
opensshd.init.in
OVERVIEW
packet.c upstream: Don't reply to PING in preauth phase or during KEX 2025-02-18 19:03:28 +11:00
packet.h
pathnames.h
pkcs11.h
platform-listen.c Add support for locking memory on Linux 2025-03-23 11:24:03 +11:00
platform-misc.c
platform-pledge.c
platform-tracing.c
platform.c
platform.h platform: introduce a way to hook new session start 2025-03-23 11:23:33 +11:00
poly1305.c
poly1305.h
progressmeter.c
progressmeter.h
PROTOCOL
PROTOCOL.agent upstream: new name/link for agent I-D 2024-11-28 03:09:01 +11:00
PROTOCOL.certkeys upstream: clarify encoding of options/extensions; bz2389 2024-12-07 21:16:01 +11:00
PROTOCOL.chacha20poly1305
PROTOCOL.key
PROTOCOL.krl
PROTOCOL.mux
PROTOCOL.sshsig
PROTOCOL.u2f
readconf.c upstream: fix NULL dereference for Match conditions missing 2025-03-18 15:56:37 +11:00
readconf.h upstream: "Match command ..." support for ssh_config to allow 2025-02-15 13:11:33 +11:00
README openssh-9.9p2 2025-02-18 19:12:14 +11:00
README.dns
README.md Update readme files to better reflect reality. 2024-12-04 21:37:22 +11:00
README.platform
README.privsep
README.tun
readpass.c
rijndael.c
rijndael.h
sandbox-capsicum.c
sandbox-darwin.c upstream: Split per-connection sshd-session binary 2024-10-14 14:01:37 +11:00
sandbox-null.c
sandbox-rlimit.c
sandbox-seccomp-filter.c
sandbox-solaris.c
scp.1 upstream: sync -o option lists with ssh.1; requested jmc@ 2024-12-07 21:16:00 +11:00
scp.c upstream: Prevent theoretical NULL deref in throughlocal_sftp. 2025-03-19 17:41:29 +11:00
SECURITY.md
servconf.c upstream: ressurect fix for "match invalid-user" that got clobbered 2025-02-25 20:57:26 +11:00
servconf.h
serverloop.c upstream: Explicitly specify the signature algorithm when signing 2024-11-27 09:03:27 +11:00
serverloop.h
session.c upstream: Change "login again" to "log in again" 2024-12-06 20:19:46 +11:00
session.h
sftp-client.c upstream: Set highwater when resuming a "put". Prevents bogus "server 2025-03-11 19:12:54 +11:00
sftp-client.h
sftp-common.c
sftp-common.h
sftp-glob.c
sftp-realpath.c
sftp-server-main.c
sftp-server.8
sftp-server.c
sftp-usergroup.c
sftp-usergroup.h
sftp.1 upstream: sync -o option lists with ssh.1; requested jmc@ 2024-12-07 21:16:00 +11:00
sftp.c
sftp.h
sk-api.h
sk-usbhid.c upstream: support FIDO tokens that return no attestation data, e.g. 2024-12-03 19:32:18 +11:00
smult_curve25519_ref.c
sntrup761.c
sntrup761.sh
srclimit.c upstream: fix PerSourcePenalty incorrectly using "crash" penalty when 2025-03-03 09:44:34 +11:00
srclimit.h
ssh2.h
ssh_api.c
ssh_api.h
ssh_config
ssh_config.5 upstream: Add %-token and environment variable expansion to SetEnv. 2025-03-03 18:05:05 +11:00
ssh-add.1
ssh-add.c
ssh-agent.1 upstream: In a section 1 manual, use the plain English words 2025-02-11 10:26:20 +11:00
ssh-agent.c upstream: Fix cases where error codes were not correctly set 2025-02-18 19:03:28 +11:00
ssh-dss.c
ssh-ecdsa-sk.c Fix compilation with DEBUG_SK enabled 2024-12-02 20:41:28 +11:00
ssh-ecdsa.c
ssh-ed25519-sk.c
ssh-ed25519.c
ssh-gss.h
ssh-keygen.1 upstream: mention that biometrics may be used for FIDO key user 2024-11-28 03:09:00 +11:00
ssh-keygen.c upstream: don't screw up ssh-keygen -l output when the file 2024-12-05 01:28:55 +11:00
ssh-keyscan.1
ssh-keyscan.c upstream: ignore SIGPIPE here; some downstreams have had this for 2024-12-07 21:16:01 +11:00
ssh-keysign.8
ssh-keysign.c upstream: "Match command ..." support for ssh_config to allow 2025-02-15 13:11:33 +11:00
ssh-pkcs11-client.c
ssh-pkcs11-helper.8
ssh-pkcs11-helper.c
ssh-pkcs11.c
ssh-pkcs11.h
ssh-rsa.c
ssh-sandbox.h
ssh-sk-client.c upstream: Fix cases where error codes were not correctly set 2025-02-18 19:03:28 +11:00
ssh-sk-helper.8
ssh-sk-helper.c
ssh-sk.c
ssh-sk.h
ssh-xmss.c
ssh.1 upstream: sync the list of options accepted by -o with ssh_config.5 2024-12-05 01:38:33 +11:00
ssh.c upstream: Add %-token and environment variable expansion to SetEnv. 2025-03-03 18:05:05 +11:00
ssh.h
sshbuf-getput-basic.c
sshbuf-getput-crypto.c
sshbuf-io.c
sshbuf-misc.c
sshbuf.c
sshbuf.h
sshconnect2.c upstream: Fix cases where error codes were not correctly set 2025-02-18 19:03:28 +11:00
sshconnect.c upstream: support VersionAddendum in the client, mirroring the 2024-12-07 21:16:02 +11:00
sshconnect.h upstream: Allow %-token and environment variable expansion in User, 2025-03-02 22:06:30 +11:00
sshd_config upstream: Improve description of KbdInteractiveAuthentication. 2024-12-04 01:55:30 +11:00
sshd_config.5 upstream: add "Match version" support to ssh_config. Allows 2025-02-15 13:12:22 +11:00
sshd-auth.c upstream: Call log_init in sshd-auth and sshd-session immediately 2025-02-06 09:41:19 +11:00
sshd-debug.sh upstream: spelling; ok djm@ 2024-12-05 01:28:54 +11:00
sshd-session.c platform: introduce a way to hook new session start 2025-03-23 11:23:33 +11:00
sshd.8
sshd.c upstream: remove assumption that the sshd_config and any configs 2025-03-13 10:40:29 +11:00
ssherr.c
ssherr.h
sshkey-xmss.c
sshkey-xmss.h
sshkey.c upstream: Remove redundant field of definition check 2024-12-05 01:28:46 +11:00
sshkey.h
sshlogin.c
sshlogin.h
sshpty.c
sshpty.h
sshsig.c upstream: Fix cases where error codes were not correctly set 2025-02-18 19:03:28 +11:00
sshsig.h
sshtty.c
survey.sh.in
TODO
ttymodes.c
ttymodes.h
uidswap.c
uidswap.h
umac128.c
umac.c
umac.h
utf8.c
utf8.h
version.h openssh-9.9p2 2025-02-18 19:12:14 +11:00
xmalloc.c
xmalloc.h
xmss_commons.c
xmss_commons.h
xmss_fast.c
xmss_fast.h
xmss_hash_address.c
xmss_hash_address.h
xmss_hash.c
xmss_hash.h
xmss_wots.c
xmss_wots.h

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

Release tarballs and release branches in git 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 the git master branch, 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.