diff --git a/backport-Allow-writev-is-seccomp-sandbox.patch b/backport-Allow-writev-is-seccomp-sandbox.patch new file mode 100644 index 0000000000000000000000000000000000000000..fe35f7d10867a159fe7d05ddd443cc7e27823e32 --- /dev/null +++ b/backport-Allow-writev-is-seccomp-sandbox.patch @@ -0,0 +1,30 @@ +From 6283f4bd83eee714d0f5fc55802eff836b06fea8 Mon Sep 17 00:00:00 2001 +From: Darren Tucker +Date: Sat, 14 Jan 2023 22:02:44 +1100 +Subject: [PATCH] Allow writev is seccomp sandbox. + +This seems to be used by recent glibcs at least in some configurations. +From bz#3512, ok djm@ +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=6283f4bd83eee714d0f5fc55802eff836b06fea8 +--- + sandbox-seccomp-filter.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c +index cec43c46..4ab49eb6 100644 +--- a/sandbox-seccomp-filter.c ++++ b/sandbox-seccomp-filter.c +@@ -312,6 +312,9 @@ static const struct sock_filter preauth_insns[] = { + #ifdef __NR_write + SC_ALLOW(__NR_write), + #endif ++#ifdef __NR_writev ++ SC_ALLOW(__NR_writev), ++#endif + #ifdef __NR_socketcall + SC_ALLOW_ARG(__NR_socketcall, 0, SYS_SHUTDOWN), + SC_DENY(__NR_socketcall, EACCES), +-- +2.27.0 + diff --git a/backport-CVE-2023-51385-upstream-ban-user-hostnames-with-most-shell-metachar.patch b/backport-CVE-2023-51385-upstream-ban-user-hostnames-with-most-shell-metachar.patch index 223a10b154eacd50864e69f94cf5c6710b00ba8f..d1af12204d93d140f602568ef4dfa7ca8004d4e5 100644 --- a/backport-CVE-2023-51385-upstream-ban-user-hostnames-with-most-shell-metachar.patch +++ b/backport-CVE-2023-51385-upstream-ban-user-hostnames-with-most-shell-metachar.patch @@ -38,7 +38,7 @@ index 35c48e62d..48d93ddf2 100644 --- a/ssh.c +++ b/ssh.c @@ -1,4 +1,4 @@ --/* $OpenBSD: ssh.c,v 1.575 2022/07/01 00:36:30 djm Exp $ */ +-/* $OpenBSD: ssh.c,v 1.578 2022/10/13 09:09:28 jsg Exp $ */ +/* $OpenBSD: ssh.c,v 1.599 2023/12/18 14:47:44 djm Exp $ */ /* * Author: Tatu Ylonen diff --git a/backport-Defer-seed_rng-until-after-closefrom-call.patch b/backport-Defer-seed_rng-until-after-closefrom-call.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd61de33e98df34aafc5f5e4c60c012c865010b9 --- /dev/null +++ b/backport-Defer-seed_rng-until-after-closefrom-call.patch @@ -0,0 +1,39 @@ +From cf1a9852d7fc93e4abc4168aed09529a57427cdc Mon Sep 17 00:00:00 2001 +From: Darren Tucker +Date: Wed, 9 Nov 2022 09:23:47 +1100 +Subject: [PATCH] Defer seed_rng until after closefrom call. + +seed_rng will initialize OpenSSL, and some engine providers (eg Intel's +QAT) will open descriptors for their own use. bz#3483, patch from +joel.d.schuetze at intel.com, ok djm@ +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=cf1a9852d7fc93e4abc4168aed09529a57427cdc +--- + sshd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sshd.c b/sshd.c +index b4bb7d65..808d91ef 100644 +--- a/sshd.c ++++ b/sshd.c +@@ -1580,8 +1580,6 @@ main(int ac, char **av) + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ + sanitise_stdfd(); + +- seed_rng(); +- + /* Initialize configuration options to their default values. */ + initialize_server_options(&options); + +@@ -1703,6 +1701,8 @@ main(int ac, char **av) + else + closefrom(REEXEC_DEVCRYPTO_RESERVED_FD); + ++ seed_rng(); ++ + /* If requested, redirect the logs to the specified logfile. */ + if (logfile != NULL) + log_redirect_stderr_to(logfile); +-- +2.27.0 + diff --git a/backport-adapt-compat_kex_proposal-test-to-portable.patch b/backport-adapt-compat_kex_proposal-test-to-portable.patch new file mode 100644 index 0000000000000000000000000000000000000000..287163963a3638f8b3c41df74f987cbcf1b865a1 --- /dev/null +++ b/backport-adapt-compat_kex_proposal-test-to-portable.patch @@ -0,0 +1,51 @@ +From 9fe207565b4ab0fe5d1ac5bb85e39188d96fb214 Mon Sep 17 00:00:00 2001 +From: Damien Miller +Date: Thu, 2 Feb 2023 23:17:49 +1100 +Subject: [PATCH] adapt compat_kex_proposal() test to portable + +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=9fe207565b4ab0fe5d1ac5bb85e39188d96fb214 +--- + Makefile.in | 1 + + regress/unittests/kex/test_proposal.c | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 18f6ac9e..c0ebfa04 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -616,6 +616,7 @@ regress/unittests/conversion/test_conversion$(EXEEXT): \ + UNITTESTS_TEST_KEX_OBJS=\ + regress/unittests/kex/tests.o \ + regress/unittests/kex/test_kex.o \ ++ regress/unittests/kex/test_proposal.o \ + $(SKOBJS) + + regress/unittests/kex/test_kex$(EXEEXT): ${UNITTESTS_TEST_KEX_OBJS} \ +diff --git a/regress/unittests/kex/test_proposal.c b/regress/unittests/kex/test_proposal.c +index b89ff59b..d6cf0f5d 100644 +--- a/regress/unittests/kex/test_proposal.c ++++ b/regress/unittests/kex/test_proposal.c +@@ -5,14 +5,18 @@ + * Placed in the public domain + */ + ++#include "includes.h" ++ + #include + #include + #include ++#ifdef HAVE_STDINT_H + #include ++#endif + #include + #include + +-#include "test_helper.h" ++#include "../test_helper/test_helper.h" + + #include "compat.h" + #include "ssherr.h" +-- +2.27.0 + diff --git a/backport-don-t-test-IPv6-addresses-if-platform-lacks-support.patch b/backport-don-t-test-IPv6-addresses-if-platform-lacks-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ae18855d13c3d232c1bd278d6d7185afe69608f --- /dev/null +++ b/backport-don-t-test-IPv6-addresses-if-platform-lacks-support.patch @@ -0,0 +1,52 @@ +From dd1249bd5c45128a908395c61b26996a70f82205 Mon Sep 17 00:00:00 2001 +From: Damien Miller +Date: Sun, 8 Jan 2023 12:08:59 +1100 +Subject: [PATCH] don't test IPv6 addresses if platform lacks support + +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=dd1249bd5c45128a908395c61b26996a70f82205 + +--- + regress/dynamic-forward.sh | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh +index f6c2393..1bfe05a 100644 +--- a/regress/dynamic-forward.sh ++++ b/regress/dynamic-forward.sh +@@ -17,6 +17,11 @@ else + fi + trace "will use ProxyCommand $proxycmd" + ++# This is a reasonable proxy for IPv6 support. ++if ! config_defined HAVE_STRUCT_IN6_ADDR ; then ++ SKIP_IPV6=yes ++fi ++ + start_ssh() { + direction="$1" + arg="$2" +@@ -96,14 +101,16 @@ for d in D R; do + stop_ssh + + verbose "PermitRemoteOpen=explicit" +- start_ssh $d \ +- PermitRemoteOpen="127.0.0.1:$PORT [::1]:$PORT localhost:$PORT" ++ permit="127.0.0.1:$PORT [::1]:$PORT localhost:$PORT" ++ test -z "$SKIP_IPV6" || permit="127.0.0.1:$PORT localhost:$PORT" ++ start_ssh $d PermitRemoteOpen="$permit" + check_socks $d Y + stop_ssh + + verbose "PermitRemoteOpen=disallowed" +- start_ssh $d \ +- PermitRemoteOpen="127.0.0.1:1 [::1]:1 localhost:1" ++ permit="127.0.0.1:1 [::1]:1 localhost:1" ++ test -z "$SKIP_IPV6" || permit="127.0.0.1:1 localhost:1" ++ start_ssh $d PermitRemoteOpen="$permit" + check_socks $d N + stop_ssh + done +-- +2.27.0 + diff --git a/backport-upstream-Add-scp-s-path-to-test-sshd-s-PATH.patch b/backport-upstream-Add-scp-s-path-to-test-sshd-s-PATH.patch new file mode 100644 index 0000000000000000000000000000000000000000..ff5a0c97cc727cb444af1a15298287f1b9c270c5 --- /dev/null +++ b/backport-upstream-Add-scp-s-path-to-test-sshd-s-PATH.patch @@ -0,0 +1,37 @@ +From 6e6f88647042b3cde54a628545c2f5fb656a9327 Mon Sep 17 00:00:00 2001 +From: "dtucker@openbsd.org" +Date: Fri, 13 Jan 2023 04:23:00 +0000 +Subject: [PATCH] upstream: Add scp's path to test sshd's PATH. + +If the scp we're testing is fully qualified (eg it's not in the system +PATH) then add its path to the under-test sshd's PATH so we can find +it. Prompted by bz#3518. + +OpenBSD-Regress-ID: 7df4f5a0be3aa135495b7e5a6719d3cbc26cc4c0 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=6e6f88647042b3cde54a628545c2f5fb656a9327 +--- + regress/test-exec.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/regress/test-exec.sh b/regress/test-exec.sh +index c51f8eac..5a6afac5 100644 +--- a/regress/test-exec.sh ++++ b/regress/test-exec.sh +@@ -529,6 +529,13 @@ cat << EOF > $OBJ/sshd_config + Subsystem sftp $SFTPSERVER + EOF + ++# If we're testing a non-installed scp, add its directory to sshd's PATH ++# so we can test it. ++case "$SCP" in ++/*) PATH_WITH_SCP="`dirname $SCP`:$PATH" ++ echo " SetEnv PATH='$PATH_WITH_SCP'" >>$OBJ/sshd_config ;; ++esac ++ + # This may be necessary if /usr/src and/or /usr/obj are group-writable, + # but if you aren't careful with permissions then the unit tests could + # be abused to locally escalate privileges. +-- +2.27.0 + diff --git a/backport-upstream-Clear-signal-mask-early-in-main-sshd-may-ha.patch b/backport-upstream-Clear-signal-mask-early-in-main-sshd-may-ha.patch new file mode 100644 index 0000000000000000000000000000000000000000..22db42881f9635cea427c98e2dfb49ba4c656885 --- /dev/null +++ b/backport-upstream-Clear-signal-mask-early-in-main-sshd-may-ha.patch @@ -0,0 +1,53 @@ +From 93f2ce8c050a7a2a628646c00b40b9b53fef93ef Mon Sep 17 00:00:00 2001 +From: "djm@openbsd.org" +Date: Fri, 16 Dec 2022 06:56:47 +0000 +Subject: [PATCH] upstream: Clear signal mask early in main(); sshd may have + been + +started with one or more signals masked (sigprocmask(2) is not cleared +on fork/exec) and this could interfere with various things, e.g. the +login grace timer. + +Execution environments that fail to clear the signal mask before running +sshd are clearly broken, but apparently they do exist. + +Reported by Sreedhar Balasubramanian; ok dtucker@ + +OpenBSD-Commit-ID: 77078c0b1c53c780269fc0c416f121d05e3010ae +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=93f2ce8c050a7a2a628646c00b40b9b53fef93ef +--- + sshd.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sshd.c b/sshd.c +index 6bb3a962..72525525 100644 +--- a/sshd.c ++++ b/sshd.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: sshd.c,v 1.589 2022/07/01 03:39:44 dtucker Exp $ */ ++/* $OpenBSD: sshd.c,v 1.594 2022/12/16 06:56:47 djm Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -1546,13 +1546,17 @@ main(int ac, char **av) + int keytype; + Authctxt *authctxt; + struct connection_info *connection_info = NULL; ++ sigset_t sigmask; + + #ifdef HAVE_SECUREWARE + (void)set_auth_parameters(ac, av); + #endif + __progname = ssh_get_progname(av[0]); + ++ sigemptyset(&sigmask); ++ sigprocmask(SIG_SETMASK, &sigmask, NULL); ++ + OpenSSL_add_all_algorithms(); + /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ + saved_argc = ac; + rexec_argc = ac; +-- +2.27.0 + diff --git a/backport-upstream-Copy-bytes-from-the_banana-rather-than-bana.patch b/backport-upstream-Copy-bytes-from-the_banana-rather-than-bana.patch new file mode 100644 index 0000000000000000000000000000000000000000..f1c5b506b07c5a4eece9b5de7478b15ab23ae9af --- /dev/null +++ b/backport-upstream-Copy-bytes-from-the_banana-rather-than-bana.patch @@ -0,0 +1,32 @@ +From 018d671d78145f03d6f07ae9d64d51321da70325 Mon Sep 17 00:00:00 2001 +From: "tb@openbsd.org" +Date: Wed, 4 Jan 2023 22:48:57 +0000 +Subject: [PATCH] upstream: Copy bytes from the_banana[] rather than banana() + +Fixes test failure due to segfault seen on arm64 with xonly snap. + +ok djm + +OpenBSD-Regress-ID: 86e2aa4bbd1dff1bc4ebb2969c0d6474485be046 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=018d671d78145f03d6f07ae9d64d51321da70325 +--- + regress/unittests/sshkey/test_sshkey.c | 2 +- + 1 file changed, 1 insertions(+), 1 deletions(-) + +diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c +index 982907ce..cc359aea 100644 +--- a/regress/unittests/sshkey/test_sshkey.c ++++ b/regress/unittests/sshkey/test_sshkey.c +@@ -144,7 +144,7 @@ banana(u_char *s, size_t l) + memcpy(s + o, "nanananana", l - o); + break; + } +- memcpy(s + o, banana, sizeof(the_banana)); ++ memcpy(s + o, the_banana, sizeof(the_banana)); + } + } + +-- +2.27.0 + diff --git a/backport-upstream-Ensure-that-there-is-a-terminating-newline-.patch b/backport-upstream-Ensure-that-there-is-a-terminating-newline-.patch new file mode 100644 index 0000000000000000000000000000000000000000..a577b15e58dad25872779dd6bd8d6e828995bc8b --- /dev/null +++ b/backport-upstream-Ensure-that-there-is-a-terminating-newline-.patch @@ -0,0 +1,48 @@ +From 3c379c9a849a635cc7f05cbe49fe473ccf469ef9 Mon Sep 17 00:00:00 2001 +From: "dtucker@openbsd.org" +Date: Thu, 9 Feb 2023 09:54:11 +0000 +Subject: [PATCH] upstream: Ensure that there is a terminating newline when + adding a new + +entry to known_hosts. bz#3529, with git+openssh at limpsquid.nl, ok deraadt@ +markus@ + +OpenBSD-Commit-ID: fa8d90698da1886570512b96f051e266eac105e0 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=3c379c9a849a635cc7f05cbe49fe473ccf469ef9 +--- + hostfile.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/hostfile.c b/hostfile.c +index bd49e3ac..f5fa8084 100644 +--- a/hostfile.c ++++ b/hostfile.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: hostfile.c,v 1.91 2021/07/05 01:16:46 dtucker Exp $ */ ++/* $OpenBSD: hostfile.c,v 1.94 2023/02/09 09:54:11 dtucker Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -520,9 +520,17 @@ add_host_to_hostfile(const char *filename, const char *host, + if (key == NULL) + return 1; /* XXX ? */ + hostfile_create_user_ssh_dir(filename, 0); +- f = fopen(filename, "a"); ++ f = fopen(filename, "a+"); + if (!f) + return 0; ++ /* Make sure we have a terminating newline. */ ++ if (fseek(f, -1L, SEEK_END) == 0 && fgetc(f) != '\n') ++ if (fputc('\n', f) != '\n') { ++ error("Failed to add terminating newline to %s: %s", ++ filename, strerror(errno)); ++ fclose(f); ++ return 0; ++ } + success = write_host_entry(f, host, NULL, key, store_hash); + fclose(f); + return success; +-- +2.27.0 + diff --git a/backport-upstream-Handle-dynamic-remote-port-forwarding-in-es.patch b/backport-upstream-Handle-dynamic-remote-port-forwarding-in-es.patch new file mode 100644 index 0000000000000000000000000000000000000000..3abd87043c31dcffc496ff1ff03762254d09369a --- /dev/null +++ b/backport-upstream-Handle-dynamic-remote-port-forwarding-in-es.patch @@ -0,0 +1,46 @@ +From 650de7ecd3567b5a5dbf16dd1eb598bd8c20bca8 Mon Sep 17 00:00:00 2001 +From: "dtucker@openbsd.org" +Date: Thu, 10 Nov 2022 23:03:10 +0000 +Subject: [PATCH] upstream: Handle dynamic remote port forwarding in escape + commandline's + +-R processing. bz#3499, ok djm@ + +OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=650de7ecd3567b5a5dbf16dd1eb598bd8c20bca8 +--- + clientloop.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/clientloop.c b/clientloop.c +index 289d0b68..02349ccb 100644 +--- a/clientloop.c ++++ b/clientloop.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: clientloop.c,v 1.370 2021/08/29 23:44:07 djm Exp $ */ ++/* $OpenBSD: clientloop.c,v 1.382 2022/11/10 23:03:10 dtucker Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -846,8 +846,15 @@ process_cmdline(struct ssh *ssh) + } + logit("Canceled forwarding."); + } else { +- if (!parse_forward(&fwd, s, dynamic, remote)) { +- logit("Bad forwarding specification."); ++ /* -R specs can be both dynamic or not, so check both. */ ++ if (remote) { ++ if (!parse_forward(&fwd, s, 0, remote) && ++ !parse_forward(&fwd, s, 1, remote)) { ++ logit("Bad remote forwarding specification."); ++ goto out; ++ } ++ } else if (!parse_forward(&fwd, s, dynamic, remote)) { ++ logit("Bad local forwarding specification."); + goto out; + } + if (local || dynamic) { +-- +2.27.0 + diff --git a/backport-upstream-Instead-of-skipping-the-all-tokens-test-if-.patch b/backport-upstream-Instead-of-skipping-the-all-tokens-test-if-.patch new file mode 100644 index 0000000000000000000000000000000000000000..6e8d770452428f28f905c490ad7653f9f7b70110 --- /dev/null +++ b/backport-upstream-Instead-of-skipping-the-all-tokens-test-if-.patch @@ -0,0 +1,44 @@ +From 4d87a00f704e0365e11c3c38b170c1275ec461fc Mon Sep 17 00:00:00 2001 +From: "dtucker@openbsd.org" +Date: Sat, 14 Jan 2023 09:57:08 +0000 +Subject: [PATCH] upstream: Instead of skipping the all-tokens test if we don't + have + +OpenSSL (since we use it to compute the hash), put the hash at the end and +just omit it if we don't have it. Prompted by bz#3521. + +OpenBSD-Regress-ID: c79ecba64250ed3b6417294b6c965e6b12ca5eea +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=4d87a00f704e0365e11c3c38b170c1275ec461fc +--- +diff --git a/regress/percent.sh b/regress/percent.sh +index ed5c604d..3dfa8d2d 100644 +--- a/regress/percent.sh ++++ b/regress/percent.sh +@@ -12,6 +12,7 @@ USER=`id -u -n` + USERID=`id -u` + HOST=`hostname | cut -f1 -d.` + HOSTNAME=`hostname` ++HASH="" + + # Localcommand is evaluated after connection because %T is not available + # until then. Because of this we use a different method of exercising it, +@@ -98,10 +99,13 @@ for i in matchexec localcommand remotecommand controlpath identityagent \ + # containing %d for UserKnownHostsFile + if [ "$i" != "userknownhostsfile" ]; then + trial $i '%d' $HOME ++ in='%%/%i/%h/%d/%L/%l/%n/%p/%r/%u' ++ out="%/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER" + if [ ! -z "${HASH}" ]; then +- trial $i '%%/%C/%i/%h/%d/%L/%l/%n/%p/%r/%u' \ +- "%/$HASH/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER" ++ in="$in/%C" ++ out="$out/$HASH" + fi ++ trial $i "$in" "$out" + fi + done + +-- +2.27.0 + diff --git a/backport-upstream-Refactor-creation-of-KEX-proposal.patch b/backport-upstream-Refactor-creation-of-KEX-proposal.patch index 29be8622d410a96ad330fa2dcaf0d605b508d74d..43322e53ea2d522456288b009c20f1e330f1f4c3 100644 --- a/backport-upstream-Refactor-creation-of-KEX-proposal.patch +++ b/backport-upstream-Refactor-creation-of-KEX-proposal.patch @@ -329,7 +329,7 @@ index dd7e1d4..aa3c3b7 100644 --- a/sshd.c +++ b/sshd.c @@ -1,4 +1,4 @@ --/* $OpenBSD: sshd.c,v 1.589 2022/07/01 03:39:44 dtucker Exp $ */ +-/* $OpenBSD: sshd.c,v 1.594 2022/12/16 06:56:47 djm Exp $ */ +/* $OpenBSD: sshd.c,v 1.599 2023/03/06 12:14:48 dtucker Exp $ */ /* * Author: Tatu Ylonen diff --git a/backport-upstream-Shell-syntax-fix.-From-ren-mingshuai-vi-git.patch b/backport-upstream-Shell-syntax-fix.-From-ren-mingshuai-vi-git.patch new file mode 100644 index 0000000000000000000000000000000000000000..9262ca53a4b7203a48f63cc9b59f28204124078b --- /dev/null +++ b/backport-upstream-Shell-syntax-fix.-From-ren-mingshuai-vi-git.patch @@ -0,0 +1,26 @@ +From 923c3f437f439cfca238fba37e97a7041782f615 Mon Sep 17 00:00:00 2001 +From: "dtucker@openbsd.org" +Date: Sat, 14 Jan 2023 10:05:54 +0000 +Subject: [PATCH] upstream: Shell syntax fix. From ren mingshuai vi github + PR#369. + +OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=923c3f437f439cfca238fba37e97a7041782f615 +--- +diff --git a/regress/yes-head.sh b/regress/yes-head.sh +index 2759eb8c..1bde504f 100644 +--- a/regress/yes-head.sh ++++ b/regress/yes-head.sh +@@ -6,7 +6,7 @@ tid="yes pipe head" + lines=`${SSH} -F $OBJ/ssh_proxy thishost 'sh -c "while true;do echo yes;done | _POSIX2_VERSION=199209 head -2000"' | (sleep 3 ; wc -l)` + if [ $? -ne 0 ]; then + fail "yes|head test failed" +- lines = 0; +++ lines=0 + fi + if [ $lines -ne 2000 ]; then + fail "yes|head returns $lines lines instead of 2000" +-- +2.27.0 + diff --git a/backport-upstream-The-idiomatic-way-of-coping-with-signed-cha.patch b/backport-upstream-The-idiomatic-way-of-coping-with-signed-cha.patch new file mode 100644 index 0000000000000000000000000000000000000000..e7a24fe51e2d6b48a5eb712c4d6359085d20bad2 --- /dev/null +++ b/backport-upstream-The-idiomatic-way-of-coping-with-signed-cha.patch @@ -0,0 +1,40 @@ +From 5a7a7acab2f466dc1d7467b5d05d35268c3137aa Mon Sep 17 00:00:00 2001 +From: "deraadt@openbsd.org" +Date: Thu, 15 Dec 2022 18:20:39 +0000 +Subject: [PATCH] upstream: The idiomatic way of coping with signed char vs + unsigned + +char (which did not come from stdio read functions) in the presence of +ctype macros, is to always cast to (unsigned char). casting to (int) +for a "macro" which is documented to take int, is weird. And sadly wrong, +because of the sing extension risk.. same diff from florian + +OpenBSD-Commit-ID: 65b9a49a68e22ff3a0ebd593f363e9f22dd73fea +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=5a7a7acab2f466dc1d7467b5d05d35268c3137aa +--- + misc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/misc.c b/misc.c +index 977c097e..41244da9 100644 +--- a/misc.c ++++ b/misc.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: misc.c,v 1.170 2021/09/26 14:01:03 djm Exp $ */ ++/* $OpenBSD: misc.c,v 1.179 2022/12/15 18:20:39 deraadt Exp $ */ + /* + * Copyright (c) 2000 Markus Friedl. All rights reserved. + * Copyright (c) 2005-2020 Damien Miller. All rights reserved. +@@ -95,7 +95,7 @@ rtrim(char *s) + if ((i = strlen(s)) == 0) + return; + for (i--; i > 0; i--) { +- if (isspace((int)s[i])) ++ if (isspace((unsigned char)s[i])) + s[i] = '\0'; + } + } +-- +2.27.0 + diff --git a/backport-upstream-When-OpenSSL-is-not-available-skip-parts-of.patch b/backport-upstream-When-OpenSSL-is-not-available-skip-parts-of.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d59c1df96b405654b50fd7ce3a6ac233664e519 --- /dev/null +++ b/backport-upstream-When-OpenSSL-is-not-available-skip-parts-of.patch @@ -0,0 +1,51 @@ +From d77fc611a62f2dfee0b654c31a50a814b13310dd Mon Sep 17 00:00:00 2001 +From: "dtucker@openbsd.org" +Date: Fri, 6 Jan 2023 12:33:33 +0000 +Subject: [PATCH] upstream: When OpenSSL is not available, skip parts of + percent test + +that require it. Based on github pr#368 from ren mingshuai. + +OpenBSD-Regress-ID: 49a375b2cf61ccb95b52e75e2e025cd10988ebb2 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=d77fc611a62f2dfee0b654c31a50a814b13310dd +--- + regress/percent.sh | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/regress/percent.sh b/regress/percent.sh +index bb81779a..ed5c604d 100644 +--- a/regress/percent.sh ++++ b/regress/percent.sh +@@ -79,10 +79,12 @@ for i in matchexec localcommand remotecommand controlpath identityagent \ + trial $i '%T' NONE + fi + # Matches implementation in readconf.c:ssh_connection_hash() +- HASH=`printf "${HOSTNAME}127.0.0.1${PORT}$REMUSER" | +- $OPENSSL_BIN sha1 | cut -f2 -d' '` ++ if [ ! -z "${OPENSSL_BIN}" ]; then ++ HASH=`printf "${HOSTNAME}127.0.0.1${PORT}$REMUSER" | ++ $OPENSSL_BIN sha1 | cut -f2 -d' '` ++ trial $i '%C' $HASH ++ fi + trial $i '%%' '%' +- trial $i '%C' $HASH + trial $i '%i' $USERID + trial $i '%h' 127.0.0.1 + trial $i '%L' $HOST +@@ -96,8 +98,10 @@ for i in matchexec localcommand remotecommand controlpath identityagent \ + # containing %d for UserKnownHostsFile + if [ "$i" != "userknownhostsfile" ]; then + trial $i '%d' $HOME +- trial $i '%%/%C/%i/%h/%d/%L/%l/%n/%p/%r/%u' \ +- "%/$HASH/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER" ++ if [ ! -z "${HASH}" ]; then ++ trial $i '%%/%C/%i/%h/%d/%L/%l/%n/%p/%r/%u' \ ++ "%/$HASH/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER" ++ fi + fi + done + +-- +2.27.0 + diff --git a/backport-upstream-avoid-printf-s-NULL-if-using-ssh.patch b/backport-upstream-avoid-printf-s-NULL-if-using-ssh.patch new file mode 100644 index 0000000000000000000000000000000000000000..d1c920cefaed27ccb04f9837ac39ba02475159eb --- /dev/null +++ b/backport-upstream-avoid-printf-s-NULL-if-using-ssh.patch @@ -0,0 +1,42 @@ +From f673b49f3be3eb51074fbb8a405beb6cd0f7d93e Mon Sep 17 00:00:00 2001 +From: "djm@openbsd.org" +Date: Fri, 13 Jan 2023 02:44:02 +0000 +Subject: [PATCH] upstream: avoid printf("%s", NULL) if using ssh + +-oUserKnownHostsFile=none and a hostkey in one of the system known hosts file +changes; ok dtucker@ + +OpenBSD-Commit-ID: 7ca87614bfc6da491315536a7f2301434a9fe614 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=f673b49f3be3eb51074fbb8a405beb6cd0f7d93e +--- + sshconnect.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/sshconnect.c b/sshconnect.c +index 0fca52b2..792bc34b 100644 +--- a/sshconnect.c ++++ b/sshconnect.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: sshconnect.c,v 1.355 2021/07/02 05:11:21 dtucker Exp $ */ ++/* $OpenBSD: sshconnect.c,v 1.361 2023/01/13 02:44:02 djm Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -1276,8 +1276,11 @@ check_host_key(char *hostname, const struct ssh_conn_info *cinfo, + } + /* The host key has changed. */ + warn_changed_key(host_key); +- error("Add correct host key in %.100s to get rid of this message.", +- user_hostfiles[0]); ++ if (num_user_hostfiles > 0 || num_system_hostfiles > 0) { ++ error("Add correct host key in %.100s to get rid " ++ "of this message.", num_user_hostfiles > 0 ? ++ user_hostfiles[0] : system_hostfiles[0]); ++ } + error("Offending %s key in %s:%lu", + sshkey_type(host_found->key), + host_found->file, host_found->line); +-- +2.27.0 + diff --git a/backport-upstream-fix-bug-in-PermitRemoteOpen-which-caused-it.patch b/backport-upstream-fix-bug-in-PermitRemoteOpen-which-caused-it.patch new file mode 100644 index 0000000000000000000000000000000000000000..d27f45ecdd5da4a7380ae6d9cbf8e7f33db9cef8 --- /dev/null +++ b/backport-upstream-fix-bug-in-PermitRemoteOpen-which-caused-it.patch @@ -0,0 +1,109 @@ +From b3daa8dc582348d6ab8150bc1e571b7aa08c5388 Mon Sep 17 00:00:00 2001 +From: "djm@openbsd.org" +Date: Mon, 2 Jan 2023 07:03:30 +0000 +Subject: [PATCH] upstream: fix bug in PermitRemoteOpen which caused it to + ignore its + +first argument unless it was one of the special keywords "any" or "none". + +Reported by Georges Chaudy in bz3515; ok dtucker@ + +OpenBSD-Commit-ID: c5678a39f1ff79993d5ae3cfac5746a4ae148ea5 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=b3daa8dc582348d6ab8150bc1e571b7aa08c5388 +--- + readconf.c | 62 +++++++++++++++++++++++++++++------------------------- + 1 file changed, 33 insertions(+), 29 deletions(-) + +diff --git a/readconf.c b/readconf.c +index 45c1c22..aa106eb 100644 +--- a/readconf.c ++++ b/readconf.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: readconf.c,v 1.363 2021/09/16 05:36:03 djm Exp $ */ ++/* $OpenBSD: readconf.c,v 1.371 2023/01/02 07:03:30 djm Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -1611,38 +1611,38 @@ parse_pubkey_algos: + case oPermitRemoteOpen: + uintptr = &options->num_permitted_remote_opens; + cppptr = &options->permitted_remote_opens; +- arg = argv_next(&ac, &av); +- if (!arg || *arg == '\0') +- fatal("%s line %d: missing %s specification", +- filename, linenum, lookup_opcode_name(opcode)); + uvalue = *uintptr; /* modified later */ +- if (strcmp(arg, "any") == 0 || strcmp(arg, "none") == 0) { +- if (*activep && uvalue == 0) { +- *uintptr = 1; +- *cppptr = xcalloc(1, sizeof(**cppptr)); +- (*cppptr)[0] = xstrdup(arg); +- } +- break; +- } ++ i = 0; + while ((arg = argv_next(&ac, &av)) != NULL) { + arg2 = xstrdup(arg); + ch = '\0'; +- p = hpdelim2(&arg, &ch); +- if (p == NULL || ch == '/') { +- fatal("%s line %d: missing host in %s", +- filename, linenum, +- lookup_opcode_name(opcode)); +- } +- p = cleanhostname(p); +- /* +- * don't want to use permitopen_port to avoid +- * dependency on channels.[ch] here. +- */ +- if (arg == NULL || +- (strcmp(arg, "*") != 0 && a2port(arg) <= 0)) { +- fatal("%s line %d: bad port number in %s", +- filename, linenum, +- lookup_opcode_name(opcode)); ++ /* Allow any/none only in first position */ ++ if (strcasecmp(arg, "none") == 0 || ++ strcasecmp(arg, "any") == 0) { ++ if (i > 0 || ac > 0) { ++ error("%s line %d: keyword %s \"%s\" " ++ "argument must appear alone.", ++ filename, linenum, keyword, arg); ++ goto out; ++ } ++ } else { ++ p = hpdelim(&arg); ++ if (p == NULL) { ++ fatal("%s line %d: missing host in %s", ++ filename, linenum, ++ lookup_opcode_name(opcode)); ++ } ++ p = cleanhostname(p); ++ /* ++ * don't want to use permitopen_port to avoid ++ * dependency on channels.[ch] here. ++ */ ++ if (arg == NULL || (strcmp(arg, "*") != 0 && ++ a2port(arg) <= 0)) { ++ fatal("%s line %d: bad port number " ++ "in %s", filename, linenum, ++ lookup_opcode_name(opcode)); ++ } + } + if (*activep && uvalue == 0) { + opt_array_append(filename, linenum, +@@ -1650,7 +1650,11 @@ parse_pubkey_algos: + cppptr, uintptr, arg2); + } + free(arg2); ++ i++; + } ++ if (i == 0) ++ fatal("%s line %d: missing %s specification", ++ filename, linenum, lookup_opcode_name(opcode)); + break; + + case oClearAllForwardings: +-- +2.27.0 + diff --git a/backport-upstream-honour-user-s-umask-if-it-is-more-restricti.patch b/backport-upstream-honour-user-s-umask-if-it-is-more-restricti.patch new file mode 100644 index 0000000000000000000000000000000000000000..d3ac67ecbe4533aa7abf147e14b3e4a26204173b --- /dev/null +++ b/backport-upstream-honour-user-s-umask-if-it-is-more-restricti.patch @@ -0,0 +1,37 @@ +From 5ee2b8ccfcf4b606f450eb0ff2305e311f68b0be Mon Sep 17 00:00:00 2001 +From: "djm@openbsd.org" +Date: Thu, 6 Oct 2022 22:42:37 +0000 +Subject: [PATCH] upstream: honour user's umask if it is more restrictive then + the ssh + +default (022); based on patch from Alex Henrie, ok dtucker@ deraadt@ + +OpenBSD-Commit-ID: fe1b9e15fc9a4f49fc338e848ce14d8727abe82d +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=5ee2b8ccfcf4b606f450eb0ff2305e311f68b0be +--- + ssh.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ssh.c b/ssh.c +index 25be53d5..e711dbd2 100644 +--- a/ssh.c ++++ b/ssh.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: ssh.c,v 1.575 2022/07/01 00:36:30 djm Exp $ */ ++/* $OpenBSD: ssh.c,v 1.577 2022/10/06 22:42:37 djm Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -679,7 +679,7 @@ main(int ac, char **av) + * writable only by the owner, which is ok for all files for which we + * don't set the modes explicitly. + */ +- umask(022); ++ umask(022 | umask(077)); + + msetlocale(); + +-- +2.27.0 + diff --git a/backport-upstream-regression-test-for-PermitRemoteOpen.patch b/backport-upstream-regression-test-for-PermitRemoteOpen.patch new file mode 100644 index 0000000000000000000000000000000000000000..cfe61055047ad285c56df7c8da1331f049fbe2f6 --- /dev/null +++ b/backport-upstream-regression-test-for-PermitRemoteOpen.patch @@ -0,0 +1,138 @@ +From 845ceecea2ac311b0c267f9ecbd34862e1876fc6 Mon Sep 17 00:00:00 2001 +From: "djm@openbsd.org" +Date: Mon, 2 Jan 2023 07:03:57 +0000 +Subject: [PATCH] upstream: regression test for PermitRemoteOpen + +OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=845ceecea2ac311b0c267f9ecbd34862e1876fc6 +--- + regress/dynamic-forward.sh | 84 ++++++++++++++++++++++++++++++-------- + 1 file changed, 66 insertions(+), 18 deletions(-) + +diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh +index 84f8ee19..f6c2393d 100644 +--- a/regress/dynamic-forward.sh ++++ b/regress/dynamic-forward.sh +@@ -1,10 +1,12 @@ +-# $OpenBSD: dynamic-forward.sh,v 1.13 2017/09/21 19:18:12 markus Exp $ ++# $OpenBSD: dynamic-forward.sh,v 1.14 2023/01/02 07:03:57 djm Exp $ + # Placed in the Public Domain. + + tid="dynamic forwarding" + + FWDPORT=`expr $PORT + 1` + ++cp $OBJ/ssh_config $OBJ/ssh_config.orig ++ + if have_prog nc && nc -h 2>&1 | grep "proxy address" >/dev/null; then + proxycmd="nc -x 127.0.0.1:$FWDPORT -X" + elif have_prog connect; then +@@ -15,16 +17,16 @@ else + fi + trace "will use ProxyCommand $proxycmd" + +-start_sshd +- +-for d in D R; do ++start_ssh() { ++ direction="$1" ++ arg="$2" + n=0 + error="1" +- trace "start dynamic forwarding, fork to background" +- ++ trace "start dynamic -$direction forwarding, fork to background" ++ (cat $OBJ/ssh_config.orig ; echo "$arg") > $OBJ/ssh_config + while [ "$error" -ne 0 -a "$n" -lt 3 ]; do + n=`expr $n + 1` +- ${SSH} -F $OBJ/ssh_config -f -$d $FWDPORT -q \ ++ ${SSH} -F $OBJ/ssh_config -f -$direction $FWDPORT -q \ + -oExitOnForwardFailure=yes somehost exec sh -c \ + \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\' + error=$? +@@ -36,18 +38,9 @@ for d in D R; do + if [ "$error" -ne 0 ]; then + fatal "failed to start dynamic forwarding" + fi ++} + +- for s in 4 5; do +- for h in 127.0.0.1 localhost; do +- trace "testing ssh socks version $s host $h (-$d)" +- ${SSH} -F $OBJ/ssh_config \ +- -o "ProxyCommand ${proxycmd}${s} $h $PORT" \ +- somehost cat ${DATA} > ${COPY} +- test -f ${COPY} || fail "failed copy ${DATA}" +- cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" +- done +- done +- ++stop_ssh() { + if [ -f $OBJ/remote_pid ]; then + remote=`cat $OBJ/remote_pid` + trace "terminate remote shell, pid $remote" +@@ -57,5 +50,60 @@ for d in D R; do + else + fail "no pid file: $OBJ/remote_pid" + fi ++} ++ ++check_socks() { ++ direction=$1 ++ expect_success=$2 ++ for s in 4 5; do ++ for h in 127.0.0.1 localhost; do ++ trace "testing ssh socks version $s host $h (-$direction)" ++ ${SSH} -F $OBJ/ssh_config \ ++ -o "ProxyCommand ${proxycmd}${s} $h $PORT 2>/dev/null" \ ++ somehost cat ${DATA} > ${COPY} ++ r=$? ++ if [ "x$expect_success" = "xY" ] ; then ++ if [ $r -ne 0 ] ; then ++ fail "ssh failed with exit status $r" ++ fi ++ test -f ${COPY} || fail "failed copy ${DATA}" ++ cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" ++ elif [ $r -eq 0 ] ; then ++ fail "ssh unexpectedly succeeded" ++ fi ++ done ++ done ++} ++ ++start_sshd ++ ++for d in D R; do ++ verbose "test -$d forwarding" ++ start_ssh $d ++ check_socks $d Y ++ stop_ssh ++ test "x$d" = "xR" || continue ++ ++ # Test PermitRemoteOpen ++ verbose "PermitRemoteOpen=any" ++ start_ssh $d PermitRemoteOpen=any ++ check_socks $d Y ++ stop_ssh ++ ++ verbose "PermitRemoteOpen=none" ++ start_ssh $d PermitRemoteOpen=none ++ check_socks $d N ++ stop_ssh ++ ++ verbose "PermitRemoteOpen=explicit" ++ start_ssh $d \ ++ PermitRemoteOpen="127.0.0.1:$PORT [::1]:$PORT localhost:$PORT" ++ check_socks $d Y ++ stop_ssh + ++ verbose "PermitRemoteOpen=disallowed" ++ start_ssh $d \ ++ PermitRemoteOpen="127.0.0.1:1 [::1]:1 localhost:1" ++ check_socks $d N ++ stop_ssh + done +-- +2.27.0 + diff --git a/backport-upstream-test-compat_kex_proposal-by-dtucker.patch b/backport-upstream-test-compat_kex_proposal-by-dtucker.patch new file mode 100644 index 0000000000000000000000000000000000000000..a20af602edeab247f6cb62699b1ad823b9b56c5a --- /dev/null +++ b/backport-upstream-test-compat_kex_proposal-by-dtucker.patch @@ -0,0 +1,125 @@ +From 903c556b938fff2d7bff8da2cc460254430963c5 Mon Sep 17 00:00:00 2001 +From: "djm@openbsd.org" +Date: Thu, 2 Feb 2023 12:12:52 +0000 +Subject: [PATCH] upstream: test compat_kex_proposal(); by dtucker@ + +OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 + +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=903c556b938fff2d7bff8da2cc460254430963c5 +--- + regress/unittests/kex/test_proposal.c | 79 +++++++++++++++++++++++++++ + regress/unittests/kex/tests.c | 4 +- + 2 files changed, 82 insertions(+), 1 deletion(-) + create mode 100644 regress/unittests/kex/test_proposal.c + +diff --git a/regress/unittests/kex/test_proposal.c b/regress/unittests/kex/test_proposal.c +new file mode 100644 +index 0000000..b89ff59 +--- /dev/null ++++ b/regress/unittests/kex/test_proposal.c +@@ -0,0 +1,79 @@ ++/* $OpenBSD: test_proposal.c,v 1.1 2023/02/02 12:12:52 djm Exp $ */ ++/* ++ * Regress test KEX ++ * ++ * Placed in the public domain ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "test_helper.h" ++ ++#include "compat.h" ++#include "ssherr.h" ++#include "sshbuf.h" ++#include "kex.h" ++#include "packet.h" ++#include "xmalloc.h" ++ ++void kex_proposal(void); ++ ++#define CURVE25519 "curve25519-sha256@libssh.org" ++#define DHGEX1 "diffie-hellman-group-exchange-sha1" ++#define DHGEX256 "diffie-hellman-group-exchange-sha256" ++#define KEXALGOS CURVE25519","DHGEX256","DHGEX1 ++void ++kex_proposal(void) ++{ ++ size_t i; ++ struct ssh ssh; ++ char *result, *out, *in; ++ struct { ++ char *in; /* TODO: make this const */ ++ char *out; ++ int compat; ++ } tests[] = { ++ { KEXALGOS, KEXALGOS, 0}, ++ { KEXALGOS, DHGEX256","DHGEX1, SSH_BUG_CURVE25519PAD }, ++ { KEXALGOS, CURVE25519, SSH_OLD_DHGEX }, ++ { "a,"KEXALGOS, "a", SSH_BUG_CURVE25519PAD|SSH_OLD_DHGEX }, ++ /* TODO: enable once compat_kex_proposal doesn't fatal() */ ++ /* { KEXALGOS, "", SSH_BUG_CURVE25519PAD|SSH_OLD_DHGEX }, */ ++ }; ++ ++ TEST_START("compat_kex_proposal"); ++ for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { ++ ssh.compat = tests[i].compat; ++ /* match entire string */ ++ result = compat_kex_proposal(&ssh, tests[i].in); ++ ASSERT_STRING_EQ(result, tests[i].out); ++ free(result); ++ /* match at end */ ++ in = kex_names_cat("a", tests[i].in); ++ out = kex_names_cat("a", tests[i].out); ++ result = compat_kex_proposal(&ssh, in); ++ ASSERT_STRING_EQ(result, out); ++ free(result); free(in); free(out); ++ /* match at start */ ++ in = kex_names_cat(tests[i].in, "a"); ++ out = kex_names_cat(tests[i].out, "a"); ++ result = compat_kex_proposal(&ssh, in); ++ ASSERT_STRING_EQ(result, out); ++ free(result); free(in); free(out); ++ /* match in middle */ ++ xasprintf(&in, "a,%s,b", tests[i].in); ++ if (*(tests[i].out) == '\0') ++ out = xstrdup("a,b"); ++ else ++ xasprintf(&out, "a,%s,b", tests[i].out); ++ result = compat_kex_proposal(&ssh, in); ++ ASSERT_STRING_EQ(result, out); ++ free(result); free(in); free(out); ++ } ++ TEST_DONE(); ++} +diff --git a/regress/unittests/kex/tests.c b/regress/unittests/kex/tests.c +index e7036ec..2a83daf 100644 +--- a/regress/unittests/kex/tests.c ++++ b/regress/unittests/kex/tests.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: tests.c,v 1.1 2015/01/15 23:41:29 markus Exp $ */ ++/* $OpenBSD: tests.c,v 1.2 2023/02/02 12:12:52 djm Exp $ */ + /* + * Placed in the public domain + */ +@@ -6,9 +6,11 @@ + #include "../test_helper/test_helper.h" + + void kex_tests(void); ++void kex_proposal(void); + + void + tests(void) + { + kex_tests(); ++ kex_proposal(); + } +-- +2.27.0 + diff --git a/backport-upstream-use-correct-type-with-sizeof-ok-djm.patch b/backport-upstream-use-correct-type-with-sizeof-ok-djm.patch new file mode 100644 index 0000000000000000000000000000000000000000..bdd6ac74c2b2e48b1fd3d162534cfc6440601aa8 --- /dev/null +++ b/backport-upstream-use-correct-type-with-sizeof-ok-djm.patch @@ -0,0 +1,34 @@ +From 18376847b8043ba967eabbe23692ef74c9a3fddc Mon Sep 17 00:00:00 2001 +From: "jsg@openbsd.org" +Date: Thu, 13 Oct 2022 09:09:28 +0000 +Subject: [PATCH] upstream: use correct type with sizeof ok djm@ + +OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 +Conflict:NA +Reference:https://anongit.mindrot.org/openssh.git/commit?id=18376847b8043ba967eabbe23692ef74c9a3fddc +--- + ssh.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ssh.c b/ssh.c +index e711dbd2..21cbd7c3 100644 +--- a/ssh.c ++++ b/ssh.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: ssh.c,v 1.577 2022/10/06 22:42:37 djm Exp $ */ ++/* $OpenBSD: ssh.c,v 1.578 2022/10/13 09:09:28 jsg Exp $ */ + /* + * Author: Tatu Ylonen + * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland +@@ -1579,7 +1579,7 @@ main(int ac, char **av) + if (options.hostbased_authentication) { + sensitive_data.nkeys = 10; + sensitive_data.keys = xcalloc(sensitive_data.nkeys, +- sizeof(struct sshkey)); ++ sizeof(*sensitive_data.keys)); + + /* XXX check errors? */ + #define L_PUBKEY(p,o) do { \ +-- +2.27.0 + diff --git a/openssh.spec b/openssh.spec index d62a473746b0bbc4a8e6a416e855ef4c27a4fff4..404007460915e3aa1540d125b6e834bb609e9606 100644 --- a/openssh.spec +++ b/openssh.spec @@ -6,7 +6,7 @@ %{?no_gtk2:%global gtk2 0} %global sshd_uid 74 -%global openssh_release 23 +%global openssh_release 25 Name: openssh Version: 8.8p1 @@ -81,41 +81,58 @@ Patch50: backport-openssh-8.2p1-x11-without-ipv6.patch Patch51: backport-openssh-8.0p1-keygen-strip-doseol.patch Patch52: backport-openssh-8.0p1-preserve-pam-errors.patch Patch53: backport-openssh-8.7p1-scp-kill-switch.patch - Patch54: bugfix-sftp-when-parse_user_host_path-empty-path-should-be-allowed.patch Patch55: bugfix-openssh-6.6p1-log-usepam-no.patch Patch56: bugfix-openssh-add-option-check-username-splash.patch Patch57: feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch Patch58: bugfix-openssh-fix-sftpserver.patch Patch59: set-sshd-config.patch -Patch6001: backport-fix-possible-NULL-deref-when-built-without-FIDO.patch -Patch60: feature-add-SMx-support.patch -Patch61: backport-upstream-a-little-extra-debugging.patch -Patch62: backport-upstream-better-debugging-for-connect_next.patch -Patch63: backport-upstream-ssh-keygen-Y-check-novalidate-requires-name.patch +Patch60: backport-fix-possible-NULL-deref-when-built-without-FIDO.patch +Patch61: feature-add-SMx-support.patch +Patch62: backport-upstream-a-little-extra-debugging.patch +Patch63: backport-upstream-better-debugging-for-connect_next.patch Patch64: openssh-Add-sw64-architecture.patch -Patch65: backport-upstream-if-sshpkt-functions-fail-then-password-is-n.patch -Patch66: backport-upstream-Make-sure-not-to-fclose-the-same-fd-twice-i.patch -Patch67: backport-upstream-Donot-attempt-to-fprintf-a-null-identity-co.patch -Patch68: backport-upstream-ignore-SIGPIPE-earlier-in-main-specifically.patch -Patch69: backport-upstream-Always-return-allocated-strings-from-the-ke.patch -Patch70: backport-Don-t-leak-the-strings-allocated-by-order_h.patch -Patch71: backport-Return-ERANGE-from-getcwd-if-buffer-size-is-1.patch -Patch72: backport-upstream-double-free-in-error-path-from-Eusgor-via-G.patch -Patch73: add-loongarch.patch +Patch65: add-loongarch.patch +Patch66: backport-upstream-if-sshpkt-functions-fail-then-password-is-n.patch +Patch67: backport-upstream-Make-sure-not-to-fclose-the-same-fd-twice-i.patch +Patch68: backport-upstream-Donot-attempt-to-fprintf-a-null-identity-co.patch +Patch69: backport-upstream-ignore-SIGPIPE-earlier-in-main-specifically.patch +Patch70: backport-upstream-Always-return-allocated-strings-from-the-ke.patch +Patch71: backport-Don-t-leak-the-strings-allocated-by-order_h.patch +Patch72: backport-Return-ERANGE-from-getcwd-if-buffer-size-is-1.patch +Patch73: backport-upstream-double-free-in-error-path-from-Eusgor-via-G.patch Patch74: add-strict-scp-check-for-CVE-2020-15778.patch -Patch75: backport-upstream-avoid-integer-overflow-of-auth-attempts-har.patch -Patch76: backport-Skip-scp3-test-if-there-s-no-scp-on-remote-path.patch -Patch77: skip-scp-test-if-there-is-no-scp-on-remote-path-as-s.patch -Patch78: skip-tests-for-C-if-there-is-no-openssl-on-local-pat.patch -Patch79: set-ssh-config.patch -Patch80: backport-upstream-CVE-2023-25136-fix-double-free-caused.patch -Patch81: backport-fix-CVE-2023-38408-upstream-terminate-process.patch -Patch82: backport-upstream-In-channel_request_remote_forwarding-the-pa.patch -Patch83: backport-upstream-Refactor-creation-of-KEX-proposal.patch -Patch84: backport-upstream-Limit-number-of-entries-in-SSH2_MSG_EXT_INF.patch -Patch85: backport-CVE-2023-48795-upstream-implement-strict-key-exchange-in-ssh-and-ss.patch -Patch86: backport-CVE-2023-51385-upstream-ban-user-hostnames-with-most-shell-metachar.patch +Patch75: backport-upstream-ssh-keygen-Y-check-novalidate-requires-name.patch +Patch76: backport-upstream-avoid-integer-overflow-of-auth-attempts-har.patch +Patch77: backport-Skip-scp3-test-if-there-s-no-scp-on-remote-path.patch +Patch78: skip-scp-test-if-there-is-no-scp-on-remote-path-as-s.patch +Patch79: backport-upstream-CVE-2023-25136-fix-double-free-caused.patch +Patch80: set-ssh-config.patch +Patch81: backport-upstream-honour-user-s-umask-if-it-is-more-restricti.patch +Patch82: backport-upstream-use-correct-type-with-sizeof-ok-djm.patch +Patch83: backport-Defer-seed_rng-until-after-closefrom-call.patch +Patch84: backport-upstream-Handle-dynamic-remote-port-forwarding-in-es.patch +Patch85: backport-upstream-The-idiomatic-way-of-coping-with-signed-cha.patch +Patch86: backport-upstream-Clear-signal-mask-early-in-main-sshd-may-ha.patch +Patch87: backport-upstream-fix-bug-in-PermitRemoteOpen-which-caused-it.patch +Patch88: backport-upstream-regression-test-for-PermitRemoteOpen.patch +Patch89: backport-upstream-Copy-bytes-from-the_banana-rather-than-bana.patch +Patch90: backport-upstream-When-OpenSSL-is-not-available-skip-parts-of.patch +Patch91: backport-don-t-test-IPv6-addresses-if-platform-lacks-support.patch +Patch92: backport-upstream-avoid-printf-s-NULL-if-using-ssh.patch +Patch93: backport-upstream-Add-scp-s-path-to-test-sshd-s-PATH.patch +Patch94: backport-upstream-Instead-of-skipping-the-all-tokens-test-if-.patch +Patch95: backport-upstream-Shell-syntax-fix.-From-ren-mingshuai-vi-git.patch +Patch96: backport-Allow-writev-is-seccomp-sandbox.patch +Patch97: backport-upstream-Ensure-that-there-is-a-terminating-newline-.patch +Patch98: backport-upstream-test-compat_kex_proposal-by-dtucker.patch +Patch99: backport-adapt-compat_kex_proposal-test-to-portable.patch +Patch100: backport-fix-CVE-2023-38408-upstream-terminate-process.patch +Patch101: backport-upstream-In-channel_request_remote_forwarding-the-pa.patch +Patch102: backport-upstream-Refactor-creation-of-KEX-proposal.patch +Patch103: backport-upstream-Limit-number-of-entries-in-SSH2_MSG_EXT_INF.patch +Patch104: backport-CVE-2023-48795-upstream-implement-strict-key-exchange-in-ssh-and-ss.patch +Patch105: backport-CVE-2023-51385-upstream-ban-user-hostnames-with-most-shell-metachar.patch Requires: /sbin/nologin Requires: libselinux >= 2.3-5 audit-libs >= 1.0.8 @@ -253,7 +270,6 @@ popd %patch57 -p1 %patch58 -p1 %patch59 -p1 -%patch6001 -p1 %patch60 -p1 %patch61 -p1 %patch62 -p1 @@ -281,6 +297,25 @@ popd %patch84 -p1 %patch85 -p1 %patch86 -p1 +%patch87 -p1 +%patch88 -p1 +%patch89 -p1 +%patch90 -p1 +%patch91 -p1 +%patch92 -p1 +%patch93 -p1 +%patch94 -p1 +%patch95 -p1 +%patch96 -p1 +%patch97 -p1 +%patch98 -p1 +%patch99 -p1 +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 autoreconf pushd pam_ssh_agent_auth-pam_ssh_agent_auth-0.10.4 @@ -477,89 +512,101 @@ getent passwd sshd >/dev/null || \ %attr(0644,root,root) %{_mandir}/man8/sftp-server.8* %changelog -* Sat Dec 23 2023 renmingshuai - 8.8p1-23 +* Sat Dec 23 2023 renmingshuai - 8.8p1-25 - Type:CVE - CVE:CVE-2023-48795,CVE-2023-51385 - SUG:NA - DESC:fix CVE-2023-48795 and CVE-2023-51385 -* Tue Aug 15 2023 renmingshuai - 8.8p1-22 +* Tue Aug 15 2023 renmingshuai - 8.8p1-24 - Type:bugfix - CVE:NA - SUG:NA - DESC:In channel_request_remote_forwarding the parameters -* Thu Jul 27 2023 renmingshuai - 8.8p1-21 +* Thu Jul 27 2023 renmingshuai - 8.8p1-23 - Type:CVE - CVE:CVE-2023-38408 - SUG:NA - DESC:fix CVE-2023-38408 -* Tue Jun 13 2023 renmingshuai - 8.8p1-20 +* Wed Jun 7 2023 renmingshuai - 8.8p1-22 - Type:bugfix - CVE:NA - SUG:NA -- DESC:fix misspeling and enable dt tests +- DESC:fix misspelling -* Sat May 27 2023 renmingshuai - 8.8p1-19 +* Sat May 27 2023 renmingshuai - 8.8p1-21 - Type:bugfix - CVE:NA - SUG:NA - DESC:fix environment variable -* Wed Mar 8 2023 renmingshuai - 8.8p1-18 +* Thu Mar 23 2023 renmingshuai - 8.8p1-20 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:backport some upstream patches and modify some patches numbers + +* Thu Mar 09 2023 renmingshuai - 8.8p1-19 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:set default ssh config + +* Mon Feb 06 2023 renmingshuai - 8.8p1-18 - Type:CVE - CVE:CVE-2023-25136 - SUG:NA - DESC:fix CVE-2023-25136 -* Tue Feb 28 2023 renmingshuai - 8.8p1-17 +* Fri Jan 06 2023 renmingshuai - 8.8p1-17 - Type:bugfix - CVE:NA - SUG:NA -- DESC:set default ssh_config +- DESC:fix test failure and enable make tests -* Fri Jan 06 2023 renmingshuai - 8.8p1-16 +* Tue Jan 03 2023 renmingshuai - 8.8p1-16 - Type:bugfix - CVE:NA - SUG:NA -- DESC:fix tests failure and enable make tests +- DESC:always make tests -* Tue Jan 03 2023 renmingshuai - 8.8p1-15 +* Thu Dec 29 2022 renmingshuai - 8.8p1-15 - Type:bugfix - CVE:NA - SUG:NA -- DESC:avoid integer overflow of auth attempts +- DESC:avoid integer overflow of auth attempts har -* Thu Dec 29 2022 renmingshuai - 8.8p1-14 +* Fri Dec 16 2022 renmingshuai - 8.8p1-14 - Type:bugfix - CVE:NA - SUG:NA -- DESC:add strict scp check for CVE-2020-15778 +- DESC:Fix ssh-keygen -Y check novalidate requires name -* Thu Dec 29 2022 renmingshuai - 8.8p1-13 -- Type:requirement +* Tue Dec 13 2022 renmingshuai - 8.8p1-13 +- Type:bugfix - CVE:NA - SUG:NA -- DESC:add loongarch +- DESC:add strict scp check for CVE-2020-15778 -* Thu Dec 29 2022 renmingshuai - 8.8p1-12 +* Tue Dec 13 2022 renmingshuai - 8.8p1-12 - Type:bugfix - CVE:NA - SUG:NA - DESC:backport some upstream patches -* Thu Dec 29 2022 renmingshuai - 8.8p1-11 -- Type:requirement +* Tue Dec 13 2022 renmingshuai - 8.8p1-11 +- Type:feature - CVE:NA - SUG:NA -- DESC:Add sw64 architecture +- DESC:Add loongarch64 architecture -* Thu Dec 29 2022 renmingshuai - 8.8p1-10 -- Type:bugfix +* Tue Dec 13 2022 renmingshuai - 8.8p1-10 +- Type:feature - CVE:NA - SUG:NA -- DESC:fix ssh-keygen -Y check novalidate requires name +- DESC:Add sw64 architecture * Wed Dec 7 2022 duyiwei - 8.8P1-9 - Type:bugfix