Commit Graph

12707 Commits

Author SHA1 Message Date
Damien Miller
273581210c
declare defeat trying to detect C89 compilers
I can't find a reliable way to detect the features the ML-KEM code
requires in configure. Give up for now and use VLA support (that we
can detect) as a proxy for "old compiler" and turn off ML-KEM if
it isn't supported.
2024-09-09 17:30:38 +10:00
Damien Miller
e8a0f19b56
fix previous; check for C99 compound literals
The previous commit was incorrect (or at least insufficient), the
ML-KEM code is actually using compound literals, so test for them.
2024-09-09 16:46:40 +10:00
Damien Miller
7c07bec144
test for compiler feature needed for ML-KEM
The ML-KEM implementation we uses need the compiler to support
C99-style named struct initialisers (e.g foo = {.bar = 1}). We
still support (barely) building OpenSSH with older compilers, so
add a configure test for this.
2024-09-09 16:06:21 +10:00
djm@openbsd.org
d469d5f348
upstream: test mlkem768x25519-sha256
OpenBSD-Regress-ID: 7baf6bc39ae55648db1a2bfdc55a624954847611
2024-09-09 15:29:09 +10:00
djm@openbsd.org
62fb2b51bb
upstream: pull post-quantum ML-KEM/x25519 key exchange out from
compile-time flag now than an IANA codepoint has been assigned for the
algorithm.

Add mlkem768x25519-sha256 in 2nd KexAlgorithms preference slot.

ok markus@

OpenBSD-Commit-ID: 9f50a0fae7d7ae8b27fcca11f8dc6f979207451a
2024-09-09 12:45:53 +10:00
djm@openbsd.org
a8ad7a2952
upstream: make parsing user@host consistently look for the last '@' in
the string rather than the first. This makes it possible to use usernames
that contain '@' characters.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Prompted by Max Zettlmeißl; feedback/ok millert@

OpenBSD-Commit-ID: 0b16eec246cda15469ebdcf3b1e2479810e394c5
2024-09-06 12:31:19 +10:00
djm@openbsd.org
13cc78d016
upstream: be more strict in parsing key type names. Only allow
shortnames (e.g "rsa") in user-interface code and require full SSH protocol
names (e.g. "ssh-rsa") everywhere else.

Prompted by bz3725; ok markus@

OpenBSD-Commit-ID: b3d8de9dac37992eab78adbf84fab2fe0d84b187
2024-09-04 15:38:50 +10:00
djm@openbsd.org
ef8472309a
upstream: fix RCSID in output
OpenBSD-Commit-ID: 889ae07f2d2193ddc4351711919134664951dd76
2024-09-04 15:38:50 +10:00
jmc@openbsd.org
ba2ef20c75
upstream: envrionment -> environment;
OpenBSD-Commit-ID: b719f39c20e8c671ec6135c832d6cc67a595af9c
2024-09-04 15:38:49 +10:00
Damien Miller
e66c0c5673
add basic fuzzers for our import of sntrup761 2024-09-04 15:36:22 +10:00
djm@openbsd.org
d19dea6330
upstream: regression test for Include variable expansion
OpenBSD-Regress-ID: 35477da3ba1abd9ca64bc49080c50a9c1350c6ca
2024-09-03 16:03:11 +10:00
djm@openbsd.org
8c4d6a6280
upstream: allow the "Include" directive to expand the same set of
%-tokens that "Match Exec" and environment variables.

ok dtucker@

OpenBSD-Commit-ID: 12ef521eaa966a9241e684258564f52f1f3c5d37
2024-09-03 15:38:51 +10:00
djm@openbsd.org
51b82648b6
upstream: missing ifdef
OpenBSD-Commit-ID: 85f09da957dd39fd0abe08fe5ee19393f25c2021
2024-09-02 22:34:08 +10:00
djm@openbsd.org
f68312eb59
upstream: Add experimental support for hybrid post-quantum key exchange
ML-KEM768 with ECDH/X25519 from the Internet-draft:
https://datatracker.ietf.org/doc/html/draft-kampanakis-curdle-ssh-pq-ke-03

This is based on previous patches from markus@ but adapted to use the
final FIPS203 standard ML-KEM using a formally-verified implementation
from libcrux.

Note this key exchange method is still a draft and thus subject to
change. It is therefore disabled by default; set MLKEM=yes to build it.
We're making it available now to make it easy for other SSH
implementations to test against it.

ok markus@ deraadt@

OpenBSD-Commit-ID: 02a8730a570b63fa8acd9913ec66353735dea42c
2024-09-02 22:32:44 +10:00
Antonio Larrosa
05f2b141cf
Don't skip audit before exitting cleanup_exit
This fixes an issue where the SSH_CONNECTION_ABANDON event is not
audited because cleanup_exit overrides the regular _exit too soon and
as a result, failed auth attempts are not logged correctly.

The problem was introduced in 81c1099d22
where the code from upstream was merged before the audit_event call when
it should have been merged right before the _exit call in order to honor
the comment that just mentions an override of the exit value.
2024-08-28 22:09:46 +10:00
djm@openbsd.org
16eaf9d401
upstream: fix test: -F is the argument to specify a non-default
ssh_config, not -f (this is sadly not a new bug)

OpenBSD-Regress-ID: 45a7bda4cf33f2cea218507d8b6a55cddbcfb322
2024-08-28 22:09:31 +10:00
deraadt@openbsd.org
10ccf611ab
upstream: As defined in the RFC, the SSH protocol has negotiable
compression support (which is requested as the name "zlib"). Compression
starts very early in the session. Relative early in OpenSSH lifetime, privsep
was added to sshd, and this required a shared-memory hack so the two
processes could see what was going on in the dataflow.  This shared-memory
hack was soon recognized as a tremendous complexity risk, because it put libz
(which very much trusts it's memory) in a dangerous place, and a new option
("zlib@openssh.com") was added begins compression after authentication (aka
delayed-compression).  That change also permitted removal of the
shared-memory hack. Despite removal from the server, the old "zlib" support
remained in the client, to allow negotiation with non-OpenSSH daemons which
lack the delayed-compression option. This commit deletes support for the
older "zlib" option in the client. It reduces our featureset in a small way,
and encourages other servers to move to a better design. The SSH protocol is
different enough that compressed-key-material attacks like BEAST are
unlikely, but who wants to take the chance? We encourage other ssh servers
who care about optional compression support to add delayed-zlib support.
(Some already do "zlib@openssh.com") ok djm markus

OpenBSD-Commit-ID: 6df986f38e4ab389f795a6e39e7c6857a763ba72
2024-08-27 09:05:43 +10:00
djm@openbsd.org
aee5487825
upstream: sntrup761x25519-sha512 now has an IANA codepoint assigned, so
we can make the algorithm available without the @openssh.com suffix too. ok
markus@ deraadt@

OpenBSD-Commit-ID: eeed8fcde688143a737729d3d56d20ab4353770f
2024-08-23 09:27:35 +10:00
Darren Tucker
a76a6b8510
Move rekey test into valgrind-2.
Now that the rekey test has been optimized it's fast enough to not be in
its own valgrind test, so move it into valgrind-2, which is currently
the quickest of the others, bringing all of them to roughly the same
runtime of ~1.1 hours.
2024-08-22 20:36:12 +10:00
dtucker@openbsd.org
7e75e3f57c
upstream: Use aes128-ctr for MAC tests since default has implicit MAC.
Also verify that the Cipher or MAC we intended to use is actually the one
selected during the test.

OpenBSD-Regress-ID: ff43fed30552afe23d1364526fe8cf88cbfafe1d
2024-08-22 20:32:21 +10:00
Damien Miller
ebc890b8b4
fix incorrect default for PasswordAuthentication
merge botch spotted by gsgleason
2024-08-22 09:46:30 +10:00
dtucker@openbsd.org
15ace435ea
upstream: Some awks won't match on the \r so delete it instead. Fixes
regress in portable on, eg Solaris.

OpenBSD-Regress-ID: 44a96d6d2f8341d89b7d5fff777502b92ac9e9ba
2024-08-21 21:01:50 +10:00
dtucker@openbsd.org
51c96b6ed6
upstream: Import regenerated moduli.
OpenBSD-Commit-ID: 5db7049ad5558dee5b2079d3422e8ddab187c1cc
2024-08-21 20:24:24 +10:00
dtucker@openbsd.org
25c52f37a8
upstream: Use curve25519-sha256 kex where possible.
Except where we're explicitly testing a different kex, use
curve25519-sha256 since it's faster than the default and supported even
when configured without OpenSSL.  Add a check to ensure that the kex we
intended to test is the one we actually tested. Speeds test up by ~5%.

OpenBSD-Regress-ID: 3b27fcc2ae953cb08fd82a0d3155c498b226d6e0
2024-08-21 17:08:06 +10:00
dtucker@openbsd.org
3eb62b7ba4
upstream: Send only as much data as needed to trigger rekeying. Speeds
up tests by about 10% in the common case, hopefully more when instrumented
with something like valgrind.

OpenBSD-Regress-ID: 7bf9292b4803357efcf0baf7cfbdc8521f212da1
2024-08-21 09:24:44 +10:00
Damien Miller
cbd3f034bb
simplify sshkey_prekey_alloc(); always use mmap 2024-08-21 09:22:28 +10:00
dtucker@openbsd.org
4442bbc2fc
upstream: Merge AEAD test into main test loop.
Removes 3 duplicate tests and speeds overall test up by about 1%.

OpenBSD-Regress-ID: 5e5c9ff3f7588091ed369e34ac28520490ad2619
2024-08-20 22:39:40 +10:00
dtucker@openbsd.org
829976a63f
upstream: Set a default RekeyLimit of 256k.
Used unless overridden by a command-line flag, which simplifies some of
the ssh command lines.

OpenBSD-Regress-ID: e7cffa57027088e10336e412b34113969f88cb87
2024-08-20 22:39:28 +10:00
dtucker@openbsd.org
57d02c9ea3
upstream: Add Compression=no to default ssh_config.
All of the rekey tests use it (otherwise the encrypted byte counts would
not match) so this lets us simplify the command lines.

OpenBSD-Regress-ID: dab7ce10f4cf6c68827eb8658141272aab3ea262
2024-08-20 22:39:14 +10:00
dtucker@openbsd.org
7254eb26f7
upstream: Remove duplicate curve25519-sha256 kex.
curve25519-sha256@libssh.org is the pre-standardization name for the same
thing, so remove it as a duplicate.  Speeds up test by a tiny amount.

OpenBSD-Regress-ID: 5a5ee5fa1595a6e140b1cc16040bedf5996a5715
2024-08-20 22:39:07 +10:00
dtucker@openbsd.org
749896b874
upstream: Unnest rekey param parsing test and use ssh not sshd.
ssh uses the same parsing code, now has "-G" to dump its config and is
slightly faster to start up.  This speeds up the test slightly (~5%) in the
common case but should help more during instrumented tests, eg under
valgrind, where startup costs are magnified.

OpenBSD-Regress-ID: 07c3acaf4c728e641033071f4441afc88141b0d0
2024-08-20 22:38:57 +10:00
djm@openbsd.org
2b17621154
upstream: actually use the length parameter that was passed in rather
than a constant (this makes no difference in practice because the length is
always the same); reported by martin AT nmkd.net

OpenBSD-Commit-ID: 4aecce232c2fe9b16e9217ff6bcb3c848d853e7e
2024-08-20 21:11:38 +10:00
Damien Miller
d922762ca1
private key coredump protection for Linux/FreeBSD
platforms not supporting coredump exclusion using mmap/madvise flags
fall back to plain old malloc(3).
2024-08-20 13:55:30 +10:00
djm@openbsd.org
cc048ca536
upstream: place shielded keys (i.e. keys at rest in RAM) into memory
allocated using mmap(3) with MAP_CONCEAL set. This prevents exposure of the
key material in coredumps, etc (this is in addition to other measures we take
in this area).

ok deraadt@

OpenBSD-Commit-ID: cbbae59f337a00c9858d6358bc65f74e62261369
2024-08-20 13:50:15 +10:00
djm@openbsd.org
a0b35c791c
upstream: mention that ed25519 is the default key type generated and
clarify that rsa-sha2-512 is the default signature scheme when RSA is in use.
Based on GHPR505 from SebastianRzk

OpenBSD-Commit-ID: 1d90df71636a04601685d2a10a8233bcc8d4f4c5
2024-08-17 18:35:31 +10:00
djm@openbsd.org
127a50f2c8
upstream: fix minor memory leak in Subsystem option parsing; from
Antonio Larrosa via GHPR515

OpenBSD-Commit-ID: fff3bbefd1b2c45c98cbe45c6b857b15d8a2d364
2024-08-17 18:24:00 +10:00
djm@openbsd.org
171427261d
upstream: fix swapping of source and destination addresses in some sshd
log messages

OpenBSD-Commit-ID: 24d4cbb86325275df1f037545aa3b91456e52d25
2024-08-17 18:16:53 +10:00
Darren Tucker
2a50a8f1fa
Add compat functions for EVP_Digest{Sign,Verify}.
This should make LibreSSL 3.1.x through 3.3.x work again.  Code from
tb@, ok djm@.  Restore the test configs covering those.
2024-08-17 11:25:36 +10:00
Philip Hands
1c3a714526
make sure that usage & man page match
SSH-Copy-ID-Upstream: da5b1abe55b72a16e0430e7598e1573da01779c0
2024-08-17 11:19:40 +10:00
Philip Hands
cd0d681645
update copyright notices
Bump the year to 2024, but also reflect the fact that hands.com Ltd. has
been wound up in the UK, and its assets (including this copyright) have
now reverted to its owner, Philip Hands.

SSH-Copy-ID-Upstream: 0e4c4d072747a6568b11a790c29dd1b4ce663d7f
2024-08-17 11:19:39 +10:00
Philip Hands
7fc9ccdce1
restore optionality of -i's argument
SSH-Copy-ID-Upstream: f70e3abb510e4eeb040b47894e41828246c1b720
2024-08-17 11:19:37 +10:00
Philip Hands
c37aa7012b
avoid exploring .ssh/id*.pub subdirectories
SSH-Copy-ID-Upstream: 0b9e08b7707ad16de3c8e6a0410d9f42fbd56997
2024-08-17 11:19:36 +10:00
Philip Hands
777dce9e2e
ensure that we're always told the source of keys
SSH-Copy-ID-Upstream: 1bee96f4793e8ec3fab9f9361204ae58f5cc7cae
2024-08-17 11:19:33 +10:00
Philip Hands
fb94fd2339
add $HOME to ERROR if one cannot write to ~/.ssh
SSH-Copy-ID-Upstream: ebef3e9c06e0447bff06e9d84b33023cf592e0ba
2024-08-17 11:19:32 +10:00
Philip Hands
eb5aafa1ff
assert that SCRATCH_DIR is a writable directory
SSH-Copy-ID-Upstream: ecb2b9d10883b9a16df56c83896c9bb47a80cde2
2024-08-17 11:19:31 +10:00
Philip Hands
abcc460a2a
quote to avoid potential for word splitting
SSH-Copy-ID-Upstream: f379adbe06ac2ef1daf0f130752234c7f8b97e3c
2024-08-17 11:19:30 +10:00
Philip Hands
b3f91411fd
ensure ERROR output goes to STDERR
SSH-Copy-ID-Upstream: ac394b05eead3b91feb7c2ae4129a3e9b892f1e2
2024-08-17 11:19:29 +10:00
Philip Hands
674b8f30f0
avoid extra space when no arg given to -i option
SSH-Copy-ID-Upstream: feca9e67e6e37c5653445d1c733569d7abb1770e
2024-08-17 11:19:28 +10:00
Philip Hands
0efa0e1c41
put the -i before -[pP] (matching man pages)
The man pages (ssh, sftp & ssh-copy-id) all list -i before the port
setting, so make the output match that order, which also seems more
natural with the port being next to the server.

SSH-Copy-ID-Upstream: 34d5d614172c78f9a42249466c4b81975b8883a1
2024-08-17 11:19:27 +10:00
Shreyas Mahangade
87831345e9
Minor space issue fixed
SSH-Copy-ID-Upstream: 335e44d7be78b03962a54c3a5c99a2ff45294a54
2024-08-17 11:19:26 +10:00