openssh-portable/sshkey.c

3772 lines
93 KiB
C
Raw Permalink Normal View History

/* $OpenBSD: sshkey.c,v 1.142 2024/01/11 01:45:36 djm Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
* Copyright (c) 2010,2011 Damien Miller. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
#include <sys/types.h>
#include <netinet/in.h>
#ifdef WITH_OPENSSL
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#endif
#include "crypto_api.h"
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2014-12-22 00:18:09 +01:00
#include <resolv.h>
2019-09-08 06:48:11 +02:00
#include <time.h>
#ifdef HAVE_UTIL_H
#include <util.h>
#endif /* HAVE_UTIL_H */
#include "ssh2.h"
#include "ssherr.h"
#include "misc.h"
#include "sshbuf.h"
#include "cipher.h"
#include "digest.h"
#define SSHKEY_INTERNAL
#include "sshkey.h"
#include "match.h"
#include "ssh-sk.h"
#ifdef WITH_XMSS
#include "sshkey-xmss.h"
#include "xmss_fast.h"
2019-11-01 20:20:04 +01:00
#endif
#ifdef WINDOWS
#include <lmcons.h>
#endif
#include "openbsd-compat/openssl-compat.h"
/* openssh private key file format */
#define MARK_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----\n"
#define MARK_END "-----END OPENSSH PRIVATE KEY-----\n"
#define MARK_BEGIN_LEN (sizeof(MARK_BEGIN) - 1)
#define MARK_END_LEN (sizeof(MARK_END) - 1)
#ifdef SUPPORT_CRLF
#define MARK_BEGIN_CRLF "-----BEGIN OPENSSH PRIVATE KEY-----\r\n"
#define MARK_END_CRLF "-----END OPENSSH PRIVATE KEY-----\r\n"
#define MARK_BEGIN_LEN_CRLF (sizeof(MARK_BEGIN_CRLF) - 1)
#define MARK_END_LEN_CRLF (sizeof(MARK_END_CRLF) - 1)
#endif // SUPPORT_CRLF
#define KDFNAME "bcrypt"
#define AUTH_MAGIC "openssh-key-v1"
#define SALT_LEN 16
#define DEFAULT_CIPHERNAME "aes256-ctr"
#define DEFAULT_ROUNDS 24
/* Version identification string for SSH v1 identity files. */
#define LEGACY_BEGIN "SSH PRIVATE KEY FILE FORMAT 1.1\n"
/*
* Constants relating to "shielding" support; protection of keys expected
* to remain in memory for long durations
*/
#define SSHKEY_SHIELD_PREKEY_LEN (16 * 1024)
#define SSHKEY_SHIELD_CIPHER "aes256-ctr" /* XXX want AES-EME* */
#define SSHKEY_SHIELD_PREKEY_HASH SSH_DIGEST_SHA512
int sshkey_private_serialize_opt(struct sshkey *key,
struct sshbuf *buf, enum sshkey_serialize_rep);
static int sshkey_from_blob_internal(struct sshbuf *buf,
struct sshkey **keyp, int allow_cert);
/* Supported key types */
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
extern const struct sshkey_impl sshkey_ed25519_impl;
extern const struct sshkey_impl sshkey_ed25519_cert_impl;
extern const struct sshkey_impl sshkey_ed25519_sk_impl;
extern const struct sshkey_impl sshkey_ed25519_sk_cert_impl;
#ifdef WITH_OPENSSL
# ifdef OPENSSL_HAS_ECC
# ifdef ENABLE_SK
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
extern const struct sshkey_impl sshkey_ecdsa_sk_impl;
extern const struct sshkey_impl sshkey_ecdsa_sk_cert_impl;
extern const struct sshkey_impl sshkey_ecdsa_sk_webauthn_impl;
# endif /* ENABLE_SK */
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
extern const struct sshkey_impl sshkey_ecdsa_nistp256_impl;
extern const struct sshkey_impl sshkey_ecdsa_nistp256_cert_impl;
extern const struct sshkey_impl sshkey_ecdsa_nistp384_impl;
extern const struct sshkey_impl sshkey_ecdsa_nistp384_cert_impl;
# ifdef OPENSSL_HAS_NISTP521
extern const struct sshkey_impl sshkey_ecdsa_nistp521_impl;
extern const struct sshkey_impl sshkey_ecdsa_nistp521_cert_impl;
# endif /* OPENSSL_HAS_NISTP521 */
# endif /* OPENSSL_HAS_ECC */
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
extern const struct sshkey_impl sshkey_rsa_impl;
extern const struct sshkey_impl sshkey_rsa_cert_impl;
extern const struct sshkey_impl sshkey_rsa_sha256_impl;
extern const struct sshkey_impl sshkey_rsa_sha256_cert_impl;
extern const struct sshkey_impl sshkey_rsa_sha512_impl;
extern const struct sshkey_impl sshkey_rsa_sha512_cert_impl;
# ifdef WITH_DSA
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
extern const struct sshkey_impl sshkey_dss_impl;
extern const struct sshkey_impl sshkey_dsa_cert_impl;
# endif
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
#endif /* WITH_OPENSSL */
#ifdef WITH_XMSS
extern const struct sshkey_impl sshkey_xmss_impl;
extern const struct sshkey_impl sshkey_xmss_cert_impl;
#endif
const struct sshkey_impl * const keyimpls[] = {
&sshkey_ed25519_impl,
&sshkey_ed25519_cert_impl,
#ifdef ENABLE_SK
&sshkey_ed25519_sk_impl,
&sshkey_ed25519_sk_cert_impl,
#endif
#ifdef WITH_OPENSSL
# ifdef OPENSSL_HAS_ECC
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
&sshkey_ecdsa_nistp256_impl,
&sshkey_ecdsa_nistp256_cert_impl,
&sshkey_ecdsa_nistp384_impl,
&sshkey_ecdsa_nistp384_cert_impl,
# ifdef OPENSSL_HAS_NISTP521
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
&sshkey_ecdsa_nistp521_impl,
&sshkey_ecdsa_nistp521_cert_impl,
# endif /* OPENSSL_HAS_NISTP521 */
# ifdef ENABLE_SK
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
&sshkey_ecdsa_sk_impl,
&sshkey_ecdsa_sk_cert_impl,
&sshkey_ecdsa_sk_webauthn_impl,
# endif /* ENABLE_SK */
# endif /* OPENSSL_HAS_ECC */
# ifdef WITH_DSA
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
&sshkey_dss_impl,
&sshkey_dsa_cert_impl,
# endif
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
&sshkey_rsa_impl,
&sshkey_rsa_cert_impl,
&sshkey_rsa_sha256_impl,
&sshkey_rsa_sha256_cert_impl,
&sshkey_rsa_sha512_impl,
&sshkey_rsa_sha512_cert_impl,
#endif /* WITH_OPENSSL */
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
#ifdef WITH_XMSS
&sshkey_xmss_impl,
&sshkey_xmss_cert_impl,
#endif
NULL
};
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
static const struct sshkey_impl *
sshkey_impl_from_type(int type)
{
int i;
for (i = 0; keyimpls[i] != NULL; i++) {
if (keyimpls[i]->type == type)
return keyimpls[i];
}
return NULL;
}
static const struct sshkey_impl *
sshkey_impl_from_type_nid(int type, int nid)
{
int i;
for (i = 0; keyimpls[i] != NULL; i++) {
if (keyimpls[i]->type == type &&
(keyimpls[i]->nid == 0 || keyimpls[i]->nid == nid))
return keyimpls[i];
}
return NULL;
}
static const struct sshkey_impl *
sshkey_impl_from_key(const struct sshkey *k)
{
if (k == NULL)
return NULL;
return sshkey_impl_from_type_nid(k->type, k->ecdsa_nid);
}
const char *
sshkey_type(const struct sshkey *k)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(k)) == NULL)
return "unknown";
return impl->shortname;
}
static const char *
sshkey_ssh_name_from_type_nid(int type, int nid)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type_nid(type, nid)) == NULL)
return "ssh-unknown";
return impl->name;
}
int
sshkey_type_is_cert(int type)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(type)) == NULL)
return 0;
return impl->cert;
}
const char *
sshkey_ssh_name(const struct sshkey *k)
{
return sshkey_ssh_name_from_type_nid(k->type, k->ecdsa_nid);
}
const char *
sshkey_ssh_name_plain(const struct sshkey *k)
{
return sshkey_ssh_name_from_type_nid(sshkey_type_plain(k->type),
k->ecdsa_nid);
}
int
sshkey_type_from_name(const char *name)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
int i;
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
for (i = 0; keyimpls[i] != NULL; i++) {
impl = keyimpls[i];
/* Only allow shortname matches for plain key types */
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl->name != NULL && strcmp(name, impl->name) == 0) ||
(!impl->cert && strcasecmp(impl->shortname, name) == 0))
return impl->type;
}
return KEY_UNSPEC;
}
static int
key_type_is_ecdsa_variant(int type)
{
switch (type) {
case KEY_ECDSA:
case KEY_ECDSA_CERT:
case KEY_ECDSA_SK:
case KEY_ECDSA_SK_CERT:
return 1;
}
return 0;
}
int
sshkey_ecdsa_nid_from_name(const char *name)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
int i;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
for (i = 0; keyimpls[i] != NULL; i++) {
if (!key_type_is_ecdsa_variant(keyimpls[i]->type))
continue;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (keyimpls[i]->name != NULL &&
strcmp(name, keyimpls[i]->name) == 0)
return keyimpls[i]->nid;
}
return -1;
}
int
sshkey_match_keyname_to_sigalgs(const char *keyname, const char *sigalgs)
{
int ktype;
if (sigalgs == NULL || *sigalgs == '\0' ||
(ktype = sshkey_type_from_name(keyname)) == KEY_UNSPEC)
return 0;
else if (ktype == KEY_RSA) {
return match_pattern_list("ssh-rsa", sigalgs, 0) == 1 ||
match_pattern_list("rsa-sha2-256", sigalgs, 0) == 1 ||
match_pattern_list("rsa-sha2-512", sigalgs, 0) == 1;
} else if (ktype == KEY_RSA_CERT) {
return match_pattern_list("ssh-rsa-cert-v01@openssh.com",
sigalgs, 0) == 1 ||
match_pattern_list("rsa-sha2-256-cert-v01@openssh.com",
sigalgs, 0) == 1 ||
match_pattern_list("rsa-sha2-512-cert-v01@openssh.com",
sigalgs, 0) == 1;
} else
return match_pattern_list(keyname, sigalgs, 0) == 1;
}
char *
sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep)
{
char *tmp, *ret = NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
size_t i, nlen, rlen = 0;
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
for (i = 0; keyimpls[i] != NULL; i++) {
impl = keyimpls[i];
if (impl->name == NULL)
continue;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (!include_sigonly && impl->sigonly)
continue;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((certs_only && !impl->cert) || (plain_only && impl->cert))
continue;
if (ret != NULL)
ret[rlen++] = sep;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
nlen = strlen(impl->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
memcpy(ret + rlen, impl->name, nlen + 1);
rlen += nlen;
}
return ret;
}
int
sshkey_names_valid2(const char *names, int allow_wildcard, int plain_only)
{
char *s, *cp, *p;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
int i, type;
if (names == NULL || strcmp(names, "") == 0)
return 0;
if ((s = cp = strdup(names)) == NULL)
return 0;
for ((p = strsep(&cp, ",")); p && *p != '\0';
(p = strsep(&cp, ","))) {
type = sshkey_type_from_name(p);
if (type == KEY_UNSPEC) {
if (allow_wildcard) {
/*
* Try matching key types against the string.
* If any has a positive or negative match then
* the component is accepted.
*/
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
impl = NULL;
for (i = 0; keyimpls[i] != NULL; i++) {
if (match_pattern_list(
keyimpls[i]->name, p, 0) != 0) {
impl = keyimpls[i];
break;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
}
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (impl != NULL)
continue;
}
free(s);
return 0;
} else if (plain_only && sshkey_type_is_cert(type)) {
free(s);
return 0;
}
}
free(s);
return 1;
}
u_int
sshkey_size(const struct sshkey *k)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(k)) == NULL)
return 0;
if (impl->funcs->size != NULL)
return impl->funcs->size(k);
return impl->keybits;
}
static int
sshkey_type_is_valid_ca(int type)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
if ((impl = sshkey_impl_from_type(type)) == NULL)
return 0;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* All non-certificate types may act as CAs */
return !impl->cert;
}
int
sshkey_is_cert(const struct sshkey *k)
{
if (k == NULL)
return 0;
return sshkey_type_is_cert(k->type);
}
int
sshkey_is_sk(const struct sshkey *k)
{
if (k == NULL)
return 0;
switch (sshkey_type_plain(k->type)) {
case KEY_ECDSA_SK:
case KEY_ED25519_SK:
return 1;
default:
return 0;
}
}
/* Return the cert-less equivalent to a certified key type */
int
sshkey_type_plain(int type)
{
switch (type) {
case KEY_RSA_CERT:
return KEY_RSA;
case KEY_DSA_CERT:
return KEY_DSA;
case KEY_ECDSA_CERT:
return KEY_ECDSA;
case KEY_ECDSA_SK_CERT:
return KEY_ECDSA_SK;
case KEY_ED25519_CERT:
return KEY_ED25519;
case KEY_ED25519_SK_CERT:
return KEY_ED25519_SK;
case KEY_XMSS_CERT:
return KEY_XMSS;
default:
return type;
}
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Return the cert equivalent to a plain key type */
static int
sshkey_type_certified(int type)
{
switch (type) {
case KEY_RSA:
return KEY_RSA_CERT;
case KEY_DSA:
return KEY_DSA_CERT;
case KEY_ECDSA:
return KEY_ECDSA_CERT;
case KEY_ECDSA_SK:
return KEY_ECDSA_SK_CERT;
case KEY_ED25519:
return KEY_ED25519_CERT;
case KEY_ED25519_SK:
return KEY_ED25519_SK_CERT;
case KEY_XMSS:
return KEY_XMSS_CERT;
default:
return -1;
}
}
#ifdef WITH_OPENSSL
/* XXX: these are really begging for a table-driven approach */
int
sshkey_curve_name_to_nid(const char *name)
{
if (strcmp(name, "nistp256") == 0)
return NID_X9_62_prime256v1;
else if (strcmp(name, "nistp384") == 0)
return NID_secp384r1;
# ifdef OPENSSL_HAS_NISTP521
else if (strcmp(name, "nistp521") == 0)
return NID_secp521r1;
# endif /* OPENSSL_HAS_NISTP521 */
else
return -1;
}
u_int
sshkey_curve_nid_to_bits(int nid)
{
switch (nid) {
case NID_X9_62_prime256v1:
return 256;
case NID_secp384r1:
return 384;
# ifdef OPENSSL_HAS_NISTP521
case NID_secp521r1:
return 521;
# endif /* OPENSSL_HAS_NISTP521 */
default:
return 0;
}
}
int
sshkey_ecdsa_bits_to_nid(int bits)
{
switch (bits) {
case 256:
return NID_X9_62_prime256v1;
case 384:
return NID_secp384r1;
# ifdef OPENSSL_HAS_NISTP521
case 521:
return NID_secp521r1;
# endif /* OPENSSL_HAS_NISTP521 */
default:
return -1;
}
}
const char *
sshkey_curve_nid_to_name(int nid)
{
switch (nid) {
case NID_X9_62_prime256v1:
return "nistp256";
case NID_secp384r1:
return "nistp384";
# ifdef OPENSSL_HAS_NISTP521
case NID_secp521r1:
return "nistp521";
# endif /* OPENSSL_HAS_NISTP521 */
default:
return NULL;
}
}
int
sshkey_ec_nid_to_hash_alg(int nid)
{
int kbits = sshkey_curve_nid_to_bits(nid);
if (kbits <= 0)
return -1;
/* RFC5656 section 6.2.1 */
if (kbits <= 256)
return SSH_DIGEST_SHA256;
else if (kbits <= 384)
return SSH_DIGEST_SHA384;
else
return SSH_DIGEST_SHA512;
}
#endif /* WITH_OPENSSL */
static void
cert_free(struct sshkey_cert *cert)
{
u_int i;
if (cert == NULL)
return;
sshbuf_free(cert->certblob);
sshbuf_free(cert->critical);
sshbuf_free(cert->extensions);
free(cert->key_id);
for (i = 0; i < cert->nprincipals; i++)
free(cert->principals[i]);
free(cert->principals);
sshkey_free(cert->signature_key);
free(cert->signature_type);
freezero(cert, sizeof(*cert));
}
static struct sshkey_cert *
cert_new(void)
{
struct sshkey_cert *cert;
if ((cert = calloc(1, sizeof(*cert))) == NULL)
return NULL;
if ((cert->certblob = sshbuf_new()) == NULL ||
(cert->critical = sshbuf_new()) == NULL ||
(cert->extensions = sshbuf_new()) == NULL) {
cert_free(cert);
return NULL;
}
cert->key_id = NULL;
cert->principals = NULL;
cert->signature_key = NULL;
cert->signature_type = NULL;
return cert;
}
struct sshkey *
sshkey_new(int type)
{
struct sshkey *k;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl = NULL;
if (type != KEY_UNSPEC &&
(impl = sshkey_impl_from_type(type)) == NULL)
return NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* All non-certificate types may act as CAs */
if ((k = calloc(1, sizeof(*k))) == NULL)
return NULL;
k->type = type;
k->ecdsa_nid = -1;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (impl != NULL && impl->funcs->alloc != NULL) {
if (impl->funcs->alloc(k) != 0) {
free(k);
return NULL;
}
}
if (sshkey_is_cert(k)) {
if ((k->cert = cert_new()) == NULL) {
sshkey_free(k);
return NULL;
}
}
return k;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Frees common FIDO fields */
void
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
sshkey_sk_cleanup(struct sshkey *k)
{
free(k->sk_application);
sshbuf_free(k->sk_key_handle);
sshbuf_free(k->sk_reserved);
k->sk_application = NULL;
k->sk_key_handle = k->sk_reserved = NULL;
}
static void
sshkey_free_contents(struct sshkey *k)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
if (k == NULL)
return;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(k->type)) != NULL &&
impl->funcs->cleanup != NULL)
impl->funcs->cleanup(k);
if (sshkey_is_cert(k))
cert_free(k->cert);
freezero(k->shielded_private, k->shielded_len);
freezero(k->shield_prekey, k->shield_prekey_len);
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
}
void
sshkey_free(struct sshkey *k)
{
sshkey_free_contents(k);
freezero(k, sizeof(*k));
}
static int
cert_compare(struct sshkey_cert *a, struct sshkey_cert *b)
{
if (a == NULL && b == NULL)
return 1;
if (a == NULL || b == NULL)
return 0;
if (sshbuf_len(a->certblob) != sshbuf_len(b->certblob))
return 0;
if (timingsafe_bcmp(sshbuf_ptr(a->certblob), sshbuf_ptr(b->certblob),
sshbuf_len(a->certblob)) != 0)
return 0;
return 1;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Compares FIDO-specific pubkey fields only */
int
sshkey_sk_fields_equal(const struct sshkey *a, const struct sshkey *b)
{
if (a->sk_application == NULL || b->sk_application == NULL)
return 0;
if (strcmp(a->sk_application, b->sk_application) != 0)
return 0;
return 1;
}
/*
* Compare public portions of key only, allowing comparisons between
* certificates and plain keys too.
*/
int
sshkey_equal_public(const struct sshkey *a, const struct sshkey *b)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
if (a == NULL || b == NULL ||
sshkey_type_plain(a->type) != sshkey_type_plain(b->type))
return 0;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(a->type)) == NULL)
return 0;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
return impl->funcs->equal(a, b);
}
int
sshkey_equal(const struct sshkey *a, const struct sshkey *b)
{
if (a == NULL || b == NULL || a->type != b->type)
return 0;
if (sshkey_is_cert(a)) {
if (!cert_compare(a->cert, b->cert))
return 0;
}
return sshkey_equal_public(a, b);
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Serialise common FIDO key parts */
int
sshkey_serialize_sk(const struct sshkey *key, struct sshbuf *b)
{
int r;
if ((r = sshbuf_put_cstring(b, key->sk_application)) != 0)
return r;
return 0;
}
static int
to_blob_buf(const struct sshkey *key, struct sshbuf *b, int force_plain,
enum sshkey_serialize_rep opts)
{
int type, ret = SSH_ERR_INTERNAL_ERROR;
const char *typename;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
if (key == NULL)
return SSH_ERR_INVALID_ARGUMENT;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
type = force_plain ? sshkey_type_plain(key->type) : key->type;
if (sshkey_type_is_cert(type)) {
if (key->cert == NULL)
return SSH_ERR_EXPECTED_CERT;
if (sshbuf_len(key->cert->certblob) == 0)
return SSH_ERR_KEY_LACKS_CERTBLOB;
/* Use the existing blob */
if ((ret = sshbuf_putb(b, key->cert->certblob)) != 0)
return ret;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
return 0;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(type)) == NULL)
return SSH_ERR_KEY_TYPE_UNKNOWN;
typename = sshkey_ssh_name_from_type_nid(type, key->ecdsa_nid);
if ((ret = sshbuf_put_cstring(b, typename)) != 0)
return ret;
return impl->funcs->serialize_public(key, b, opts);
}
int
sshkey_putb(const struct sshkey *key, struct sshbuf *b)
{
return to_blob_buf(key, b, 0, SSHKEY_SERIALIZE_DEFAULT);
}
int
sshkey_puts_opts(const struct sshkey *key, struct sshbuf *b,
enum sshkey_serialize_rep opts)
{
struct sshbuf *tmp;
int r;
if ((tmp = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
r = to_blob_buf(key, tmp, 0, opts);
if (r == 0)
r = sshbuf_put_stringb(b, tmp);
sshbuf_free(tmp);
return r;
}
int
sshkey_puts(const struct sshkey *key, struct sshbuf *b)
{
return sshkey_puts_opts(key, b, SSHKEY_SERIALIZE_DEFAULT);
}
int
sshkey_putb_plain(const struct sshkey *key, struct sshbuf *b)
{
return to_blob_buf(key, b, 1, SSHKEY_SERIALIZE_DEFAULT);
}
static int
to_blob(const struct sshkey *key, u_char **blobp, size_t *lenp, int force_plain,
enum sshkey_serialize_rep opts)
{
int ret = SSH_ERR_INTERNAL_ERROR;
size_t len;
struct sshbuf *b = NULL;
if (lenp != NULL)
*lenp = 0;
if (blobp != NULL)
*blobp = NULL;
if ((b = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((ret = to_blob_buf(key, b, force_plain, opts)) != 0)
goto out;
len = sshbuf_len(b);
if (lenp != NULL)
*lenp = len;
if (blobp != NULL) {
if ((*blobp = malloc(len)) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
memcpy(*blobp, sshbuf_ptr(b), len);
}
ret = 0;
out:
sshbuf_free(b);
return ret;
}
int
sshkey_to_blob(const struct sshkey *key, u_char **blobp, size_t *lenp)
{
return to_blob(key, blobp, lenp, 0, SSHKEY_SERIALIZE_DEFAULT);
}
int
sshkey_plain_to_blob(const struct sshkey *key, u_char **blobp, size_t *lenp)
{
return to_blob(key, blobp, lenp, 1, SSHKEY_SERIALIZE_DEFAULT);
}
int
sshkey_fingerprint_raw(const struct sshkey *k, int dgst_alg,
u_char **retp, size_t *lenp)
{
u_char *blob = NULL, *ret = NULL;
size_t blob_len = 0;
int r = SSH_ERR_INTERNAL_ERROR;
if (retp != NULL)
*retp = NULL;
if (lenp != NULL)
*lenp = 0;
if (ssh_digest_bytes(dgst_alg) == 0) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
if ((r = to_blob(k, &blob, &blob_len, 1, SSHKEY_SERIALIZE_DEFAULT))
!= 0)
goto out;
if ((ret = calloc(1, SSH_DIGEST_MAX_LENGTH)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if ((r = ssh_digest_memory(dgst_alg, blob, blob_len,
ret, SSH_DIGEST_MAX_LENGTH)) != 0)
goto out;
/* success */
if (retp != NULL) {
*retp = ret;
ret = NULL;
}
if (lenp != NULL)
*lenp = ssh_digest_bytes(dgst_alg);
r = 0;
out:
free(ret);
if (blob != NULL)
freezero(blob, blob_len);
return r;
}
static char *
fingerprint_b64(const char *alg, u_char *dgst_raw, size_t dgst_raw_len)
{
char *ret;
size_t plen = strlen(alg) + 1;
size_t rlen = ((dgst_raw_len + 2) / 3) * 4 + plen + 1;
if (dgst_raw_len > 65536 || (ret = calloc(1, rlen)) == NULL)
return NULL;
strlcpy(ret, alg, rlen);
strlcat(ret, ":", rlen);
if (dgst_raw_len == 0)
return ret;
if (b64_ntop(dgst_raw, dgst_raw_len, ret + plen, rlen - plen) == -1) {
freezero(ret, rlen);
return NULL;
}
/* Trim padding characters from end */
ret[strcspn(ret, "=")] = '\0';
return ret;
}
static char *
fingerprint_hex(const char *alg, u_char *dgst_raw, size_t dgst_raw_len)
{
char *retval, hex[5];
size_t i, rlen = dgst_raw_len * 3 + strlen(alg) + 2;
if (dgst_raw_len > 65536 || (retval = calloc(1, rlen)) == NULL)
return NULL;
strlcpy(retval, alg, rlen);
strlcat(retval, ":", rlen);
for (i = 0; i < dgst_raw_len; i++) {
snprintf(hex, sizeof(hex), "%s%02x",
i > 0 ? ":" : "", dgst_raw[i]);
strlcat(retval, hex, rlen);
}
return retval;
}
static char *
fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
{
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
'n', 'p', 'r', 's', 't', 'v', 'z', 'x' };
u_int i, j = 0, rounds, seed = 1;
char *retval;
rounds = (dgst_raw_len / 2) + 1;
if ((retval = calloc(rounds, 6)) == NULL)
return NULL;
retval[j++] = 'x';
for (i = 0; i < rounds; i++) {
u_int idx0, idx1, idx2, idx3, idx4;
if ((i + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) +
seed) % 6;
idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15;
idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) +
(seed / 6)) % 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
if ((i + 1) < rounds) {
idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15;
idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15;
retval[j++] = consonants[idx3];
retval[j++] = '-';
retval[j++] = consonants[idx4];
seed = ((seed * 5) +
((((u_int)(dgst_raw[2 * i])) * 7) +
((u_int)(dgst_raw[(2 * i) + 1])))) % 36;
}
} else {
idx0 = seed % 6;
idx1 = 16;
idx2 = seed / 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
}
}
retval[j++] = 'x';
retval[j++] = '\0';
return retval;
}
/*
* Draw an ASCII-Art representing the fingerprint so human brain can
* profit from its built-in pattern recognition ability.
* This technique is called "random art" and can be found in some
* scientific publications like this original paper:
*
* "Hash Visualization: a New Technique to improve Real-World Security",
* Perrig A. and Song D., 1999, International Workshop on Cryptographic
* Techniques and E-Commerce (CrypTEC '99)
* sparrow.ece.cmu.edu/~adrian/projects/validation/validation.pdf
*
* The subject came up in a talk by Dan Kaminsky, too.
*
* If you see the picture is different, the key is different.
* If the picture looks the same, you still know nothing.
*
* The algorithm used here is a worm crawling over a discrete plane,
* leaving a trace (augmenting the field) everywhere it goes.
* Movement is taken from dgst_raw 2bit-wise. Bumping into walls
* makes the respective movement vector be ignored for this turn.
* Graphs are not unambiguous, because circles in graphs can be
* walked in either direction.
*/
/*
* Field sizes for the random art. Have to be odd, so the starting point
* can be in the exact middle of the picture, and FLDBASE should be >=8 .
* Else pictures would be too dense, and drawing the frame would
* fail, too, because the key type would not fit in anymore.
*/
#define FLDBASE 8
#define FLDSIZE_Y (FLDBASE + 1)
#define FLDSIZE_X (FLDBASE * 2 + 1)
static char *
fingerprint_randomart(const char *alg, u_char *dgst_raw, size_t dgst_raw_len,
const struct sshkey *k)
{
/*
* Chars to be used after each other every time the worm
* intersects with itself. Matter of taste.
*/
char *augmentation_string = " .o+=*BOX@%&#/^SE";
char *retval, *p, title[FLDSIZE_X], hash[FLDSIZE_X];
u_char field[FLDSIZE_X][FLDSIZE_Y];
size_t i, tlen, hlen;
u_int b;
int x, y, r;
size_t len = strlen(augmentation_string) - 1;
if ((retval = calloc((FLDSIZE_X + 3), (FLDSIZE_Y + 2))) == NULL)
return NULL;
/* initialize field */
memset(field, 0, FLDSIZE_X * FLDSIZE_Y * sizeof(char));
x = FLDSIZE_X / 2;
y = FLDSIZE_Y / 2;
/* process raw key */
for (i = 0; i < dgst_raw_len; i++) {
int input;
/* each byte conveys four 2-bit move commands */
input = dgst_raw[i];
for (b = 0; b < 4; b++) {
/* evaluate 2 bit, rest is shifted later */
x += (input & 0x1) ? 1 : -1;
y += (input & 0x2) ? 1 : -1;
/* assure we are still in bounds */
x = MAXIMUM(x, 0);
y = MAXIMUM(y, 0);
x = MINIMUM(x, FLDSIZE_X - 1);
y = MINIMUM(y, FLDSIZE_Y - 1);
/* augment the field */
if (field[x][y] < len - 2)
field[x][y]++;
input = input >> 2;
}
}
/* mark starting point and end point*/
field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1;
field[x][y] = len;
/* assemble title */
r = snprintf(title, sizeof(title), "[%s %u]",
sshkey_type(k), sshkey_size(k));
/* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */
if (r < 0 || r > (int)sizeof(title))
r = snprintf(title, sizeof(title), "[%s]", sshkey_type(k));
tlen = (r <= 0) ? 0 : strlen(title);
/* assemble hash ID. */
r = snprintf(hash, sizeof(hash), "[%s]", alg);
hlen = (r <= 0) ? 0 : strlen(hash);
/* output upper border */
p = retval;
*p++ = '+';
for (i = 0; i < (FLDSIZE_X - tlen) / 2; i++)
*p++ = '-';
memcpy(p, title, tlen);
p += tlen;
for (i += tlen; i < FLDSIZE_X; i++)
*p++ = '-';
*p++ = '+';
*p++ = '\n';
/* output content */
for (y = 0; y < FLDSIZE_Y; y++) {
*p++ = '|';
for (x = 0; x < FLDSIZE_X; x++)
*p++ = augmentation_string[MINIMUM(field[x][y], len)];
*p++ = '|';
*p++ = '\n';
}
/* output lower border */
*p++ = '+';
for (i = 0; i < (FLDSIZE_X - hlen) / 2; i++)
*p++ = '-';
memcpy(p, hash, hlen);
p += hlen;
for (i += hlen; i < FLDSIZE_X; i++)
*p++ = '-';
*p++ = '+';
return retval;
}
char *
sshkey_fingerprint(const struct sshkey *k, int dgst_alg,
enum sshkey_fp_rep dgst_rep)
{
char *retval = NULL;
u_char *dgst_raw;
size_t dgst_raw_len;
if (sshkey_fingerprint_raw(k, dgst_alg, &dgst_raw, &dgst_raw_len) != 0)
return NULL;
switch (dgst_rep) {
case SSH_FP_DEFAULT:
if (dgst_alg == SSH_DIGEST_MD5) {
retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg),
dgst_raw, dgst_raw_len);
} else {
retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg),
dgst_raw, dgst_raw_len);
}
break;
case SSH_FP_HEX:
retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg),
dgst_raw, dgst_raw_len);
break;
case SSH_FP_BASE64:
retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg),
dgst_raw, dgst_raw_len);
break;
case SSH_FP_BUBBLEBABBLE:
retval = fingerprint_bubblebabble(dgst_raw, dgst_raw_len);
break;
case SSH_FP_RANDOMART:
retval = fingerprint_randomart(ssh_digest_alg_name(dgst_alg),
dgst_raw, dgst_raw_len, k);
break;
default:
freezero(dgst_raw, dgst_raw_len);
return NULL;
}
freezero(dgst_raw, dgst_raw_len);
return retval;
}
static int
peek_type_nid(const char *s, size_t l, int *nid)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
int i;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
for (i = 0; keyimpls[i] != NULL; i++) {
impl = keyimpls[i];
if (impl->name == NULL || strlen(impl->name) != l)
continue;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (memcmp(s, impl->name, l) == 0) {
*nid = -1;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (key_type_is_ecdsa_variant(impl->type))
*nid = impl->nid;
return impl->type;
}
}
return KEY_UNSPEC;
}
/* XXX this can now be made const char * */
int
sshkey_read(struct sshkey *ret, char **cpp)
{
struct sshkey *k;
char *cp, *blobcopy;
size_t space;
int r, type, curve_nid = -1;
struct sshbuf *blob;
if (ret == NULL)
return SSH_ERR_INVALID_ARGUMENT;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (ret->type != KEY_UNSPEC && sshkey_impl_from_type(ret->type) == NULL)
return SSH_ERR_INVALID_ARGUMENT;
/* Decode type */
cp = *cpp;
space = strcspn(cp, " \t");
if (space == strlen(cp))
return SSH_ERR_INVALID_FORMAT;
if ((type = peek_type_nid(cp, space, &curve_nid)) == KEY_UNSPEC)
return SSH_ERR_INVALID_FORMAT;
/* skip whitespace */
for (cp += space; *cp == ' ' || *cp == '\t'; cp++)
;
if (*cp == '\0')
return SSH_ERR_INVALID_FORMAT;
if (ret->type != KEY_UNSPEC && ret->type != type)
return SSH_ERR_KEY_TYPE_MISMATCH;
if ((blob = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
/* find end of keyblob and decode */
space = strcspn(cp, " \t");
if ((blobcopy = strndup(cp, space)) == NULL) {
sshbuf_free(blob);
return SSH_ERR_ALLOC_FAIL;
}
if ((r = sshbuf_b64tod(blob, blobcopy)) != 0) {
free(blobcopy);
sshbuf_free(blob);
return r;
}
free(blobcopy);
if ((r = sshkey_fromb(blob, &k)) != 0) {
sshbuf_free(blob);
return r;
}
sshbuf_free(blob);
/* skip whitespace and leave cp at start of comment */
for (cp += space; *cp == ' ' || *cp == '\t'; cp++)
;
/* ensure type of blob matches type at start of line */
if (k->type != type) {
sshkey_free(k);
return SSH_ERR_KEY_TYPE_MISMATCH;
}
if (key_type_is_ecdsa_variant(type) && curve_nid != k->ecdsa_nid) {
sshkey_free(k);
return SSH_ERR_EC_CURVE_MISMATCH;
}
/* Fill in ret from parsed key */
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
sshkey_free_contents(ret);
*ret = *k;
freezero(k, sizeof(*k));
/* success */
*cpp = cp;
return 0;
}
int
sshkey_to_base64(const struct sshkey *key, char **b64p)
{
int r = SSH_ERR_INTERNAL_ERROR;
struct sshbuf *b = NULL;
char *uu = NULL;
if (b64p != NULL)
*b64p = NULL;
if ((b = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshkey_putb(key, b)) != 0)
goto out;
if ((uu = sshbuf_dtob64_string(b, 0)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
/* Success */
if (b64p != NULL) {
*b64p = uu;
uu = NULL;
}
r = 0;
out:
sshbuf_free(b);
free(uu);
return r;
}
int
sshkey_format_text(const struct sshkey *key, struct sshbuf *b)
{
int r = SSH_ERR_INTERNAL_ERROR;
char *uu = NULL;
if ((r = sshkey_to_base64(key, &uu)) != 0)
goto out;
if ((r = sshbuf_putf(b, "%s %s",
sshkey_ssh_name(key), uu)) != 0)
goto out;
r = 0;
out:
free(uu);
return r;
}
int
sshkey_write(const struct sshkey *key, FILE *f)
{
struct sshbuf *b = NULL;
int r = SSH_ERR_INTERNAL_ERROR;
if ((b = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshkey_format_text(key, b)) != 0)
goto out;
if (fwrite(sshbuf_ptr(b), sshbuf_len(b), 1, f) != 1) {
if (feof(f))
errno = EPIPE;
r = SSH_ERR_SYSTEM_ERROR;
goto out;
}
/* Success */
r = 0;
out:
sshbuf_free(b);
return r;
}
const char *
sshkey_cert_type(const struct sshkey *k)
{
switch (k->cert->type) {
case SSH2_CERT_TYPE_USER:
return "user";
case SSH2_CERT_TYPE_HOST:
return "host";
default:
return "unknown";
}
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
int
sshkey_check_rsa_length(const struct sshkey *k, int min_size)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
#ifdef WITH_OPENSSL
const BIGNUM *rsa_n;
int nbits;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (k == NULL || k->rsa == NULL ||
(k->type != KEY_RSA && k->type != KEY_RSA_CERT))
return 0;
RSA_get0_key(k->rsa, &rsa_n, NULL, NULL);
nbits = BN_num_bits(rsa_n);
if (nbits < SSH_RSA_MINIMUM_MODULUS_SIZE ||
(min_size > 0 && nbits < min_size))
return SSH_ERR_KEY_LENGTH;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
#endif /* WITH_OPENSSL */
return 0;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
#ifdef WITH_OPENSSL
# ifdef OPENSSL_HAS_ECC
int
sshkey_ecdsa_key_to_nid(EC_KEY *k)
{
EC_GROUP *eg = NULL;
int nids[] = {
NID_X9_62_prime256v1,
NID_secp384r1,
# ifdef OPENSSL_HAS_NISTP521
NID_secp521r1,
# endif /* OPENSSL_HAS_NISTP521 */
-1
};
int nid;
u_int i;
const EC_GROUP *g = EC_KEY_get0_group(k);
/*
* The group may be stored in a ASN.1 encoded private key in one of two
* ways: as a "named group", which is reconstituted by ASN.1 object ID
* or explicit group parameters encoded into the key blob. Only the
* "named group" case sets the group NID for us, but we can figure
* it out for the other case by comparing against all the groups that
* are supported.
*/
if ((nid = EC_GROUP_get_curve_name(g)) > 0)
return nid;
for (i = 0; nids[i] != -1; i++) {
if ((eg = EC_GROUP_new_by_curve_name(nids[i])) == NULL)
return -1;
if (EC_GROUP_cmp(g, eg, NULL) == 0)
break;
EC_GROUP_free(eg);
}
if (nids[i] != -1) {
/* Use the group with the NID attached */
EC_GROUP_set_asn1_flag(eg, OPENSSL_EC_NAMED_CURVE);
if (EC_KEY_set_group(k, eg) != 1) {
EC_GROUP_free(eg);
return -1;
}
}
return nids[i];
}
# endif /* OPENSSL_HAS_ECC */
#endif /* WITH_OPENSSL */
int
sshkey_generate(int type, u_int bits, struct sshkey **keyp)
{
struct sshkey *k;
int ret = SSH_ERR_INTERNAL_ERROR;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (keyp == NULL || sshkey_type_is_cert(type))
return SSH_ERR_INVALID_ARGUMENT;
*keyp = NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(type)) == NULL)
return SSH_ERR_KEY_TYPE_UNKNOWN;
if (impl->funcs->generate == NULL)
return SSH_ERR_FEATURE_UNSUPPORTED;
if ((k = sshkey_new(KEY_UNSPEC)) == NULL)
return SSH_ERR_ALLOC_FAIL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
k->type = type;
if ((ret = impl->funcs->generate(k, bits)) != 0) {
sshkey_free(k);
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
return ret;
}
/* success */
*keyp = k;
return 0;
}
int
sshkey_cert_copy(const struct sshkey *from_key, struct sshkey *to_key)
{
u_int i;
const struct sshkey_cert *from;
struct sshkey_cert *to;
int r = SSH_ERR_INTERNAL_ERROR;
if (to_key == NULL || (from = from_key->cert) == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if ((to = cert_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshbuf_putb(to->certblob, from->certblob)) != 0 ||
(r = sshbuf_putb(to->critical, from->critical)) != 0 ||
(r = sshbuf_putb(to->extensions, from->extensions)) != 0)
goto out;
to->serial = from->serial;
to->type = from->type;
if (from->key_id == NULL)
to->key_id = NULL;
else if ((to->key_id = strdup(from->key_id)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
to->valid_after = from->valid_after;
to->valid_before = from->valid_before;
if (from->signature_key == NULL)
to->signature_key = NULL;
else if ((r = sshkey_from_private(from->signature_key,
&to->signature_key)) != 0)
goto out;
if (from->signature_type != NULL &&
(to->signature_type = strdup(from->signature_type)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (from->nprincipals > SSHKEY_CERT_MAX_PRINCIPALS) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
if (from->nprincipals > 0) {
if ((to->principals = calloc(from->nprincipals,
sizeof(*to->principals))) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
for (i = 0; i < from->nprincipals; i++) {
to->principals[i] = strdup(from->principals[i]);
if (to->principals[i] == NULL) {
to->nprincipals = i;
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
}
}
to->nprincipals = from->nprincipals;
/* success */
cert_free(to_key->cert);
to_key->cert = to;
to = NULL;
r = 0;
out:
cert_free(to);
return r;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
int
sshkey_copy_public_sk(const struct sshkey *from, struct sshkey *to)
{
/* Append security-key application string */
if ((to->sk_application = strdup(from->sk_application)) == NULL)
return SSH_ERR_ALLOC_FAIL;
return 0;
}
int
sshkey_from_private(const struct sshkey *k, struct sshkey **pkp)
{
struct sshkey *n = NULL;
int r = SSH_ERR_INTERNAL_ERROR;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
*pkp = NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(k)) == NULL)
return SSH_ERR_KEY_TYPE_UNKNOWN;
if ((n = sshkey_new(k->type)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((r = impl->funcs->copy_public(k, n)) != 0)
goto out;
if (sshkey_is_cert(k) && (r = sshkey_cert_copy(k, n)) != 0)
goto out;
/* success */
*pkp = n;
n = NULL;
r = 0;
out:
sshkey_free(n);
return r;
}
int
sshkey_is_shielded(struct sshkey *k)
{
return k != NULL && k->shielded_private != NULL;
}
int
sshkey_shield_private(struct sshkey *k)
{
struct sshbuf *prvbuf = NULL;
u_char *prekey = NULL, *enc = NULL, keyiv[SSH_DIGEST_MAX_LENGTH];
struct sshcipher_ctx *cctx = NULL;
const struct sshcipher *cipher;
size_t i, enclen = 0;
struct sshkey *kswap = NULL, tmp;
int r = SSH_ERR_INTERNAL_ERROR;
#ifdef DEBUG_PK
fprintf(stderr, "%s: entering for %s\n", __func__, sshkey_ssh_name(k));
#endif
if ((cipher = cipher_by_name(SSHKEY_SHIELD_CIPHER)) == NULL) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
if (cipher_keylen(cipher) + cipher_ivlen(cipher) >
ssh_digest_bytes(SSHKEY_SHIELD_PREKEY_HASH)) {
r = SSH_ERR_INTERNAL_ERROR;
goto out;
}
/* Prepare a random pre-key, and from it an ephemeral key */
if ((prekey = malloc(SSHKEY_SHIELD_PREKEY_LEN)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
arc4random_buf(prekey, SSHKEY_SHIELD_PREKEY_LEN);
if ((r = ssh_digest_memory(SSHKEY_SHIELD_PREKEY_HASH,
prekey, SSHKEY_SHIELD_PREKEY_LEN,
keyiv, SSH_DIGEST_MAX_LENGTH)) != 0)
goto out;
#ifdef DEBUG_PK
fprintf(stderr, "%s: key+iv\n", __func__);
sshbuf_dump_data(keyiv, ssh_digest_bytes(SSHKEY_SHIELD_PREKEY_HASH),
stderr);
#endif
if ((r = cipher_init(&cctx, cipher, keyiv, cipher_keylen(cipher),
keyiv + cipher_keylen(cipher), cipher_ivlen(cipher), 1)) != 0)
goto out;
/* Serialise and encrypt the private key using the ephemeral key */
if ((prvbuf = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (sshkey_is_shielded(k) && (r = sshkey_unshield_private(k)) != 0)
goto out;
if ((r = sshkey_private_serialize_opt(k, prvbuf,
SSHKEY_SERIALIZE_SHIELD)) != 0)
goto out;
/* pad to cipher blocksize */
i = 0;
while (sshbuf_len(prvbuf) % cipher_blocksize(cipher)) {
if ((r = sshbuf_put_u8(prvbuf, ++i & 0xff)) != 0)
goto out;
}
#ifdef DEBUG_PK
fprintf(stderr, "%s: serialised\n", __func__);
sshbuf_dump(prvbuf, stderr);
#endif
/* encrypt */
enclen = sshbuf_len(prvbuf);
if ((enc = malloc(enclen)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if ((r = cipher_crypt(cctx, 0, enc,
sshbuf_ptr(prvbuf), sshbuf_len(prvbuf), 0, 0)) != 0)
goto out;
#ifdef DEBUG_PK
fprintf(stderr, "%s: encrypted\n", __func__);
sshbuf_dump_data(enc, enclen, stderr);
#endif
/* Make a scrubbed, public-only copy of our private key argument */
if ((r = sshkey_from_private(k, &kswap)) != 0)
goto out;
/* Swap the private key out (it will be destroyed below) */
tmp = *kswap;
*kswap = *k;
*k = tmp;
/* Insert the shielded key into our argument */
k->shielded_private = enc;
k->shielded_len = enclen;
k->shield_prekey = prekey;
k->shield_prekey_len = SSHKEY_SHIELD_PREKEY_LEN;
enc = prekey = NULL; /* transferred */
enclen = 0;
/* preserve key fields that are required for correct operation */
k->sk_flags = kswap->sk_flags;
/* success */
r = 0;
out:
/* XXX behaviour on error - invalidate original private key? */
cipher_free(cctx);
explicit_bzero(keyiv, sizeof(keyiv));
explicit_bzero(&tmp, sizeof(tmp));
freezero(enc, enclen);
freezero(prekey, SSHKEY_SHIELD_PREKEY_LEN);
sshkey_free(kswap);
sshbuf_free(prvbuf);
return r;
}
Merge 9.1 (#626) * upstream: fix poll() spin when a channel's output fd closes without data in the channel buffer. Introduce more exact packing of channel fds into the pollfd array. fixes bz3405 and bz3411; ok deraadt@ markus@ OpenBSD-Commit-ID: 06740737849c9047785622ad5d472cb6a3907d10 * upstream: select post-quantum KEX sntrup761x25519-sha512@openssh.com as the default; ok markus@ OpenBSD-Commit-ID: f02d99cbfce22dffec2e2ab1b60905fbddf48fb9 * upstream: add support for the "corp-data" protocol extension to allow server-side copies to be performed without having to go via the client. Patch by Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: 00aa510940fedd66dab1843b58682de4eb7156d5 * upstream: add a sftp client "cp" command that supports server-side copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444 * depend * Skip slow tests on (very) slow test targets. * Set Makefile SHELL as determined by configure. This should improve compatibility for users with non-POSIX shells. If using Makefile.in directly (eg make -f Makefile.in distprep) then SHELL will need to be specified on the command line (along with MANFMT in that particular case). ok djm@ * Use bash or ksh if available for SH in Makefile. * Increase test timeout to allow slow VMs to finish * Only run regression tests on slow VMs. * Only return events from ppoll that were requested. If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@ * Specify TEST_SHELL=bash on AIX. The system shells cause the agent-restrict test to fail due to some quoting so explicitly specify bash until we can get configure to autmatically work around that. * Disable security key on fbsd6 test host. * upstream: man pages: add missing commas between subordinate and main clauses jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@ OpenBSD-Commit-ID: 9520801729bebcb3c9fe43ad7f9776ab4dd05ea3 * upstream: ssh: document sntrup761x25519-sha512@openssh.com as default KEX OpenBSD-Commit-ID: 12545bfa10bcbf552d04d9d9520d0f4e98b0e171 * upstream: openssh-9.0 OpenBSD-Commit-ID: 0dfb461188f4513ec024c1534da8c1ce14c20b64 * update version numbers for release * update build-aux files to match autoconf-2.71 i.e. config.guess, config.sub and install-sh * Revert "update build-aux files to match autoconf-2.71" This reverts commit 0a8ca39fac6ad19096b6c263436f8b2dd51606f2. It turns out that the checked-in copies of these files are actually newer than autoconf-2.71's copies, so this was effectively a downgrade. Spotted by Bo Anderson via github * upstream: two defensive changes from Tobias Stoeckmann via GHPR287 enforce stricter invarient for sshbuf_set_parent() - never allow a buffer to have a previously-set parent changed. In sshbuf_reset(), if the reallocation fails, then zero the entire buffer and not the (potentially smaller) default initial alloc size. OpenBSD-Commit-ID: 14583203aa5d50ad38d2e209ae10abaf8955e6a9 * upstream: Note that curve25519-sha256 was later published in RFC8731. ok djm@ OpenBSD-Commit-ID: 2ac2b5d642d4cf5918eaec8653cad9a4460b2743 * upstream: clear io_want/io_ready flags at start of poll() cycle; avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@ OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967 * Retire fbsd6 test VM. It's long since out of support, relatively slow (it's i686) and the compiler has trouble with PIE. * Resync moduli.5 with upstream. 1.18: remove duplicate publication year; carsten dot kunze at arcor dot de 1.19: ssh-keygen's -G/-T have been replaced with -M generate/screen. * upstream: Correct path for system known hosts file in description of IgnoreUserKnownHosts. Patch from Martin Vahlensieck via tech@ OpenBSD-Commit-ID: 9b7784f054fa5aa4d63cb36bd563889477127215 * upstream: list the correct version number for when usage of the sftp protocol became default and fix a typo from ed maste OpenBSD-Commit-ID: 24e1795ed2283fdeacf16413c2f07503bcdebb31 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: Try to continue running local I/O for channels in state OPEN during SSH transport rekeying. The most visible benefit is that it should make ~-escapes work in the client (e.g. to exit) if the connection happened to have stalled during a rekey event. Based work by and ok dtucker@ OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: regression test for sftp cp command OpenBSD-Regress-ID: c96bea9edde3a384b254785e7f9b2b24a81cdf82 * upstream: Simplify forward-control test. Since we no longer need to support SSH1 we don't need to run shell commands on the other end of the connection and can use ssh -N instead. This also makes the test less racy. OpenBSD-Regress-ID: 32e94ce272820cc398f30b848b2b0f080d10302c * upstream: Use ssh -f and ControlPersist .. to start up test forwards and ssh -O stop to shut them down intead of sleep loops. This speeds up the test by an order of magnitude. OpenBSD-Regress-ID: eb3db5f805100919b092a3b2579c611fba3e83e7 * upstream: It looks like we can't completely avoid waiting for processes to exit so retrieve the pid via controlmaster and use that. OpenBSD-Regress-ID: 8246f00f22b14e49d2ff1744c94897ead33d457b * Cache timezone data in capsicum sandbox. From emaste at freebsd.org, originally part of FreeBSD commit r339216 / fc3c19a9 with autoconf bits added by me. * Include stdlib.h for free() prototype. ... which is used inside the CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG block. * Update OpenSSL and LibreSSL versions in tests. * Add debian-riscv64 test target. * upstream: Avoid an unnecessary xstrdup in rm_env() when matching patterns. Since match_pattern() doesn't modify its arguments (they are const), there is no need to make an extra copy of the strings in options->send_env. From Martin Vahlensieck OpenBSD-Commit-ID: 2c9db31e3f4d3403b49642c64ee048b2a0a39351 * upstream: Add missing includes of stdlib.h and stdint.h. We need stdlib.h for malloc(3) and stdint.h for SIZE_MAX. Unlike the other xmss files, ssh-xmss.c does not include xmss_commons.h so ssh-xmss.c must include those headers itself. From Martin Vahlensieck OpenBSD-Commit-ID: 70e28a9818cee3da1be2ef6503d4b396dd421e6b * upstream: Remove unnecessary includes: openssl/hmac.h and openssl/evp.h. From Martin Vahlensieck. OpenBSD-Commit-ID: a6debb5fb0c8a44e43e8d5ca7cc70ad2f3ea31c3 * upstream: Check sshauthopt_new() for NULL. bz#3425, from tessgauthier at microsoft.com. ok djm@ OpenBSD-Commit-ID: af0315bc3e44aa406daa7e0ae7c2d719a974483f * upstream: Add authfd path to debug output. ok markus@ OpenBSD-Commit-ID: f735a17d1a6f2bee63bfc609d76ef8db8c090890 * upstream: avoid printing hash algorithm twice; from lucas AT sexy.is OpenBSD-Commit-ID: 9d24671e10a84141b7c504396cabad600e47a941 * upstream: fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@ OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e * upstream: Don't leak SK device. Patch from Pedro Martelletto via github PR#316. ok djm@ OpenBSD-Commit-ID: 17d11327545022e727d95fd08b213171c5a4585d * upstream: mention that the helpers are used by ssh(1), ssh-agent(1) and ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto OpenBSD-Commit-ID: 30f880f989d4b329589c1c404315685960a5f153 * Remove now-empty int32_minmax.inc. * Only run tests when source files change. Also run tests on changes to V_9_0 branch. * Add Mac OS X 12 test target. * upstream: be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ OpenBSD-Commit-ID: e267746c047ea86665cdeccef795a8a56082eeb2 * upstream: fix some integer overflows in sieve_large() that show up when trying to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@ OpenBSD-Commit-ID: 81cbc6dd3a21c57bd6fadea10e44afe37bca558e * upstream: remove an obsolete rsa1 format example from an example; from megan batty ok djm OpenBSD-Commit-ID: db2c89879c29bf083df996bd830abfb1e70d62bf * upstream: Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. The wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy OpenBSD-Commit-ID: dd98748d7644df048f78dcf793b3b63db9ab1d25 * upstream: make sure stdout is non-blocking; ok djm@ OpenBSD-Commit-ID: 64940fffbd1b882eda2d7c8c7a43c79368309c0d * upstream: mux.c: mark argument as const; from Martin Vahlensieck OpenBSD-Commit-ID: 69a1a93a55986c7c2ad9f733c093b46a47184341 * upstream: channel_new no longer frees remote_name. So update the comment accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck OpenBSD-Commit-ID: e4e10dc8dc9f40c166ea5a8e991942bedc75a76a * upstream: sshkey_unshield_private() contains a exact duplicate of the code in private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@ OpenBSD-Commit-ID: 876884c3f0e62e8fd8d1594bab06900f971c9c85 * Add ubsan minimal testcase on OpenBSD. As suggested by djm@. * Note that, for now, we need variadic macros. * Also retest OpenBSD upstream on .yml changes. * upstream: When performing operations that glob(3) a remote path, ensure that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef * Remove duplicate bcrypt_pbkdf.o from Makefile bcrypt_pbkdf.o is duplicated in the openbsd-compat Makefile's object file list. * upstream: improve error message when 'ssh-keygen -Y sign' is unable to load a private key; bz3429, reported by Adam Szkoda ok dtucker@ OpenBSD-Commit-ID: bb57b285e67bea536ef81b1055467be2fc380e74 * upstream: Allow existing -U (use agent) flag to work with "-Y sign" operations, where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@ OpenBSD-Commit-ID: a7bc69873b99c32c42c7628ed9ea91565ba08c2f * upstream: Remove errant apostrophe. From haruyama at queen-ml org. OpenBSD-Commit-ID: dc6b294567cb84b384ad6ced9ca469f2bbf0bd10 * upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 * upstream: fix in-place copies; r1.163 incorrectly skipped truncation in all cases, not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@ OpenBSD-Commit-ID: b189f19cd68119548c8e24e39c79f61e115bf92c * upstream: Only run agent-ptrace.sh if gdb is available as all architectures do not ship with gdb. OpenBSD-Regress-ID: ec53e928803e6b87f9ac142d38888ca79a45348d * upstream: regress test for in-place transfers and clobbering larger files with smaller ones; would have caught last regression in scp(1) OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2 * configure.ac: Add missing AC_DEFINE for caph_cache_tzdata test causing HAVE_CAPH_CACHE_TZDATA to be missing from config.h.in. Spotted by Bryan Drewery * upstream: make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via #define) dump to stderr rather than stdout OpenBSD-Commit-ID: 10298513ee32db8390aecb0397d782d68cb14318 * upstream: revert previous; it was broken (spotted by Theo) OpenBSD-Commit-ID: 457c79afaca2f89ec2606405c1059b98b30d8b0d * upstream: Note that ProxyJump also accepts the same tokens as ProxyCommand. From pallxk via github PR#305. OpenBSD-Commit-ID: 7115ac351b129205f1f1ffa6bbfd62abd76be7c5 * upstream: Avoid kill with -1 argument. The out_ctx label can be reached before fork has been called. If this happens, then kill -1 would be called, sending SIGTERM to all processes reachable by the current process. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8 * upstream: f sshpkt functions fail, then password is not cleared with freezero. Unconditionally call freezero to guarantee that password is removed from RAM. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6b093619c9515328e25b0f8093779c52402c89cd * upstream: refactor authorized_keys/principals handling remove "struct ssh *" from arguments - this was only used to pass the remote host/address. These can be passed in instead and the resulting code is less tightly coupled to ssh_api.[ch] ok dtucker@ OpenBSD-Commit-ID: 9d4373d013edc4cc4b5c21a599e1837ac31dda0d * upstream: split the low-level file handling functions out from auth2-pubkey.c Put them in a new auth2-pubkeyfile.c to make it easier to refer to them (e.g. in unit/fuzz tests) without having to refer to everything else pubkey auth brings in. ok dtucker@ OpenBSD-Commit-ID: 3fdca2c61ad97dc1b8d4a7346816f83dc4ce2217 * fuzzer for authorized_keys parsing mostly redundant to authopt_fuzz, but it's sensitive code so IMO it makes sense to test this layer too * Test against LibreSSL 3.5.3. * Test against OpenSSL 1.1.1o and 3.0.3. * fix some bugs in the fuzzer * upstream: keywords ref ssh_config.5; from caspar schutijser OpenBSD-Commit-ID: f146a19d7d5c9374c3b9c520da43b2732d7d1a4e * upstream: ssh-keygen: implement "verify-required" certificate option. This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@ OpenBSD-Commit-ID: f660f973391b593fea4b7b25913c9a15c3eb8a06 * upstream: ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303 from jsegitz with man page text from jmc@, ok markus@ djm@ OpenBSD-Commit-ID: 5c4c57bdd7063ff03381cfb6696659dd3f9f5b9f * upstream: Add period at end of "not known by any other names" message. github PR#320 from jschauma, ok djm@ OpenBSD-Commit-ID: bd60809803c4bfd3ebb7c5c4d918b10e275266f2 * upstream: Add missing *-sk types to ssh-keyscan manpage. From skazi0 via github PR#294. OpenBSD-Commit-ID: fda2c869cdb871f3c90a89fb3f985370bb5d25c0 * upstream: Make SetEnv directives first-match-wins in both sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b * upstream: test setenv in both client and server, test first-match-wins too OpenBSD-Regress-ID: 4c8804f9db38a02db480b9923317457b377fe34b * upstream: move auth_openprincipals() and auth_openkeyfile() over to auth2-pubkeyfile.c too; they make more sense there. OpenBSD-Commit-ID: 9970d99f900e1117fdaab13e9e910a621b7c60ee * upstream: make sure that UseDNS hostname lookup happens in the monitor and not in the pledge(2)'d unprivileged process; fixes regression caused by recent refactoring spotted by henning@ OpenBSD-Commit-ID: a089870b95101cd8881a2dff65b2f1627d13e88d * fix possible NULL deref when built without FIDO Analysis/fix from kircher in bz3443; ok dtucker@ * automatically enable built-in FIDO support If libfido2 is found and usable, then enable the built-in security key support unless --without-security-key-builtin was requested. ok dtucker@ * upstream: Log an error if pipe() fails while accepting a connection. bz#3447, from vincent-openssh at vinc17 net, ok djm@ OpenBSD-Commit-ID: 9d59f19872b94900a5c79da2d57850241ac5df94 * upstream: Don't attempt to fprintf a null identity comment. From Martin Vahlensieck via tech@. OpenBSD-Commit-ID: 4c54d20a8e8e4e9912c38a7b4ef5bfc5ca2e05c2 * upstream: Make sure not to fclose() the same fd twice in case of an error. ok dtucker@ OpenBSD-Commit-ID: e384c4e05d5521e7866b3d53ca59acd2a86eef99 * upstream: make it clear that RekeyLimit applies to both transmitted and received data. GHPR#328 from Jan Pazdziora OpenBSD-Commit-ID: d180a905fec9ff418a75c07bb96ea41c9308c3f9 * request 1.1x API compatibility for OpenSSL >=3.x idea/patch from Pedro Martelletto via GHPR#322; ok dtucker@ * fix broken case statement in previous * Disable SK support if FIDO libs not found. * Zero out LIBFIDO2 when SK support not usable. Prevents us from trying to link them into ssh-sk-helper and failing to build. * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ OpenBSD-Commit-ID: b2f6e5f60f2bba293b831654328a8a0035ef4a1b * upstream: Roll back previous KEX changes as they aren't safe until compat_pkalg_proposal and friends always allocate their returned strings. Reported by Qualys. OpenBSD-Commit-ID: 1c7a88a0d5033f42f88ab9bec58ef1cf72c81ad0 * upstream: allow arguments to sftp -D option, e.g. sftp -D "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce * Update OpenSSL tests to the most recent releases. * upstream: reflect the update to -D arg name in usage(); OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c * upstream: ignore SIGPIPE earlier in main(), specifically before muxclient() which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@ OpenBSD-Commit-ID: 63d8e13276869eebac6d7a05d5a96307f9026e47 * upstream: Always return allocated strings from the kex filtering so that we can free them later. Fix one leak in compat_kex_proposal. Based on github PR#324 from ZoltanFridrich with some simplications by me. ok djm@ OpenBSD-Commit-ID: 9171616da3307612d0ede086fd511142f91246e4 * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ This is a roll-forward of the previous rollback now that the required changes in compat.c have been done. OpenBSD-Commit-ID: c7cd93730b3b9f53cdad3ae32462922834ef73eb * upstream: bump up loglevel from debug to info when unable to open authorized keys/principals file for errno != ENOENT; bz2042 ok dtucker OpenBSD-Commit-ID: e79aa550d91ade6a80f081bda689da24c086d66b * Skip select+rlimit check if sandboxing is disabled It's not needed in that case, and the test can fail when being built with some compiler memory sanitizer flags. bz#3441 * upstream: use consistent field names (s/char/byte) in format description OpenBSD-Commit-ID: 3de33572733ee7fcfd7db33d37db23d2280254f0 * upstream: Remove leftover line. Remove extra line leftover from merge conflict. ok djm@ OpenBSD-Commit-ID: 460e2290875d7ae64971a7e669c244b1d1c0ae2e * Move checks for pollfd.fd and nfds_t. Move the checks for struct pollfd.fd and nfds_t to before the sandboxing checks. This groups all the sandbox checks together so we can skip them all when sandboxing is disabled. * Skip all rlimit tests when sandboxing disabled. The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no. * Add clang sanitizer tests. * upstream: Add TEST_REGRESS_CACHE_DIR. If set, it is used to cache regress test names that have succeeded and skip those on a re-run. OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247 * Move sanitizer logs into regress for collection. * Add GCC address sanitizer build/test. * Update sanitizer test targets: - remove clang-sanitize-memory for now. It takes so long that the test times out. - add gcc sanitize-address and sanitize-undefined test targets. * Test against openssl-3.0.5. * Move unset to before we set anything. * Refuse to use OpenSSL 3.0.4 due to potential RCE. OpenSSL has a potential RCE in its RSA implementation (CVE-2022-2274) so refuse to use that specific version. * Capture stderr output from configure. * Only refuse to use OpenSSL 3.0.4 on x86_64. The potential RCE only impacts x86_64, so only refuse to use it if we're targetting a potentially impacted architecture. ok djm@ * Remove special casing of crypt(). Configure goes to some lengths to pick crypt() from either libcrypt or OpenSSL's libcrypto because they can more or less featureful (eg supporting md5-style passwords). OpenSSL removed its crypt() interface in 2002: https://github.com/openssl/openssl/commit/69deec58 so these hijinks should no longer be necessary. This also only links sshd with libcrypt which is the only thing that needs it. ok djm@ * Clarify README.md text. Clarify the text about the implications of building without OpenSSL, and prefix the "configure --help" example command with a "./" so it's likely to work as-is in more shells. From bz#3461. * Split README.platform into its own line. README.platform has general platform-specific information, having it following text about FIDO2 on the same line could imply that it only has information about FIDO2. * Return ERANGE from getcwd() if buffer size is 1. If getcwd() is supplied a buffer size of exactly 1 and a path of "/", it could result in a nul byte being written out of array bounds. POSIX says it should return ERANGE if the path will not fit in the available buffer (with terminating nul). 1 byte cannot fit any possible path with its nul, so immediately return ERANGE in that case. OpenSSH never uses getcwd() with this buffer size, and all current (and even quite old) platforms that we are currently known to work on have a native getcwd() so this code is not used on those anyway. Reported by Qualys, ok djm@ * Remove unintended changes. I inadvertently included a couple of local changes with the OpenSSL 3.0.4 change. Revert, anything that should be there will be committed separately. * Add AUDIT_ARCH_PPC to supported seccomp arches. Patch from dries.deschout at dodeco.eu. * Rename bbone test target to ARM. * Move vmshutdown to first step. If a previous run on a physical runner has failed to clean up, the next run will fail because it'll try to check out the code to a broken directory mount. Make cleanup the first step. * upstream: pull passphrase reading and confirmation into a separate function so it can be used for FIDO2 PINs; no functional change OpenBSD-Commit-ID: bf34f76b8283cc1d3f54633e0d4f13613d87bb2f * upstream: when enrolling a resident key on a security token, check if a credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust OpenBSD-Commit-ID: e45e9f1bf2b2f32d9850669e7a8dbd64acc5fca4 * upstream: sk-usbhid: preserve error code returned by key_lookup() it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b * upstream: ssh-keygen: fix touch prompt, pin retries; part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: 75d1005bd2ef8f29fa834c90d2684e73556fffe8 * crank SSH_SK_VERSION_MAJOR in sk-dummy.so * Skip scp3 test if there's no scp on remote path. scp -3 ends up using the scp that's in the remote path and will fail if one is not available. Based on a patch from rapier at psc.edu. * Convert "have_prog" function into "which". "which" and its behaviour is not standardized, so convert the existing have_prog function into "which" so we can rely on it being available and what its semantics are. Add a have_prog wrapper that maintains the existing behaviour. * upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not executable. No-op on most platforms but should prevent warnings in -portable on systems that don't have 'date %s'. OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4 * upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test. OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0 * Remove workarounds for OpenSSL missing AES-GCM. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES GCM mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have GCM, so this is no longer needed. ok djm@ * Remove workarounds for OpenSSL missing AES-CTR. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES CTR mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have CTR, so this is no longer needed. ok djm@ * Do not link scp, sftp and sftp-server w/ zlib. Some of our binaries (eg sftp, sftp-server, scp) do not interact with the channels code and thus do use libraries such as zlib and libcrypto although they are linked with them. This adds a CHANNELLIBS and starts by moving zlib into it, which means the aformentioned binaries are no longer linked against zlib. ok djm@ * Group libcrypto and PRNGD checks together. They're related more than the libcrypt or libiaf checks which are currently between them. ok djm@ * Remove seed_rng calls from scp, sftp, sftp-server. These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@ * Move libcrypto into CHANNELLIBS. This will result in sftp, sftp-server and scp no longer being linked against libcrypto. ok djm@ * Move stale-configure check as early as possible. We added a check in Makefile to catch the case where configure needs to be rebuilt, however this did not happen until a build was attempted in which case all of the work done by configure was wasted. Move this check to the start of configure to catch it as early as possible. ok djm@ * Remove deprecated MacOS 10.15 runners. * upstream: avoid double-free in error path introduced in r1.70; report and fix based on GHPR#332 by v-rzh ok dtucker@ OpenBSD-Commit-ID: 3d21aa127b1f37cfc5bdc21461db369a663a951f * Include CHANNEL and FIDO2 libs in configure output * Factor out getrnd() and rename to getentropy(). Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@. * compat code for fido_dev_is_winhello() Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * check_sk_options: add temporary WinHello workaround Up to libfido 1.10.0, WinHello advertises "clientPin" rather than "uv" capability. This is fixed in 1.11.0. For the time being, workaround it here. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * sk_sign: set FIDO2 uv attribute explicitely for WinHello WinHello via libfido2 performs user verification by default. However, if we stick to that, there's no way to differentiate between keys created with or without "-O verify-required". Set FIDO2 uv attribute explicitely to FIDO_OPT_FALSE, then check if user verification has been requested. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: don't prompt for FIDO passphrase before attempting to enroll the credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@ OpenBSD-Commit-ID: bd5342ffc353ee37d39617906867c305564d1ce2 * Give unused param a name. Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello. * Actually put HAVE_STDINT_H around the stdint.h. * Rename our getentropy to prevent possible loops. Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@ * Test hostbased auth on github runners. * fix SANDBOX_SECCOMP_FILTER_DEBUG * Fix conditional for running hostbased tests. * upstream: allow certificate validity intervals, sshsig verification times and authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13 * upstream: add some tests for parse_absolute_time(), including cases where it is forced to the UTC timezone. bz3468 ok dtucker OpenBSD-Regress-ID: ea07ca31c2f3847a38df028ca632763ae44e8759 * Skip hostbased during Valgrind tests. Valgrind doesn't let ssh exec ssh-keysign (because it's setuid) so skip it during the Valgrind based tests. See https://bugs.kde.org/show_bug.cgi?id=119404 for a discussion of this (ironically there the problematic binary was ssh(1) back when it could still be setuid). * Rerun tests if any .github config file changes. * Add a timegm implementation from Heimdal via Samba. Fixes build on (at least Solaris 10). * Replace deprecated ubuntu-18.04 runners with 22.04 * upstream: sftp-server: support home-directory request Add support to the sftp-server for the home-directory extension defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the existing expand-path@openssh.com, but uses a more official protocol name, and so is a bit more likely to be implemented by non-OpenSSH clients. From Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: bfc580d05cc0c817831ae7ecbac4a481c23566ab * fido_dev_is_winhello: return 0, not "false" "false" is not used anywhere in OpenSSH, so return 0 like everywhere else. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * Revert "check_sk_options: add temporary WinHello workaround" Cygwin now comes with libfido2 1.11.0, so this workaround isn't required anymore. This reverts commit 242c044ab111a37aad3b0775727c36a4c5f0102c. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: use .Cm for "sign"; from josiah frentsos OpenBSD-Commit-ID: 7f80a53d54857ac6ae49ea6ad93c5bd12231d1e4 * upstream: add an extra flag to sk_probe() to indicate whether we're probing for a FIDO resident key or not. Unused here, but will make like easier for portable OpenBSD-Commit-ID: 432c8ff70e270378df9dbceb9bdeaa5b43b5a832 * on Cygwin, prefer WinHello FIDO device If no FIDO device was explictly specified, then prefer the windows://hello FIDO device. An exception to this is when probing resident FIDO keys, in which case hardware FIDO devices are preferred. * Check for perms to run agent-getpeereid test. Ubuntu 22.04 defaults to private home dirs which prevents "nobody" running ssh-add during the agent-getpeereid test. Check for this and add the necessary permissions. * upstream: double free() in error path; from Eusgor via GHPR333 OpenBSD-Commit-ID: 39f35e16ba878c8d02b4d01d8826d9b321be26d4 * Add Cygwin (on windows-2019) test target. In addition to installing the requisite Cygwin packages, we also need to explicitly invoke "sh" for steps that run other scripts since the runner environment doesn't understand #! paths. * Add a bit more debug output. * Fix cygwin conditional steps. * upstream: Strictly enforce the maximum allowed SSH2 banner size in ssh-keyscan and prevent a one-byte buffer overflow. Patch from Qualys, ok djm@ OpenBSD-Commit-ID: 6ae664f9f4db6e8a0589425f74cd0bbf3aeef4e4 * upstream: remove incorrect check that can break enrolling a resident key (introduced in r1.40) OpenBSD-Commit-ID: 4cab364d518470e29e624af3d3f9ffa9c92b6f01 * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * fix pester test failures * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * define HAVE_KILLPG * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * add debug on appveyor * add sleep to pester test * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * fix 9.1 compilation errors * disable -p pester tests due to unreliability on older Windows versions * remove extra sleep time from debugging scp pester tests * modify -p tests to only run for Windows OS version 10 and above * add windows specific code back into method moved from auth.c to auth2-pubkeyfile.c * add preprocessor for WinHello * revert preprocessor definition for winhello * add windows preprocessor definition in key_lookup * remove rdp block from appveyor since we are no longer debugging * add ifdef to sftp-server.c * make key_lookup compatible with winhello * appveyor.yml * increase debug of failing pester test * add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed * modify new scp.sh tests for windows * remove in place tests from scp.sh * remove rdp debug from appveyor * retrigger appveyor * change check of OS version in scp test Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: naddy@openbsd.org <naddy@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: tj@openbsd.org <tj@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: florian@openbsd.org <florian@openbsd.org> Co-authored-by: markus@openbsd.org <markus@openbsd.org> Co-authored-by: Tobias Heider <me@tobhe.de> Co-authored-by: anton@openbsd.org <anton@openbsd.org> Co-authored-by: Tim Rice <tim@multitalents.net> Co-authored-by: tobhe@openbsd.org <tobhe@openbsd.org> Co-authored-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org>
2022-11-02 17:06:45 +01:00
/* Check deterministic padding after private key */
static int
private2_check_padding(struct sshbuf *decrypted)
{
u_char pad;
size_t i;
int r;
i = 0;
while (sshbuf_len(decrypted)) {
if ((r = sshbuf_get_u8(decrypted, &pad)) != 0)
goto out;
if (pad != (++i & 0xff)) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
}
/* success */
r = 0;
out:
explicit_bzero(&pad, sizeof(pad));
explicit_bzero(&i, sizeof(i));
return r;
}
int
sshkey_unshield_private(struct sshkey *k)
{
struct sshbuf *prvbuf = NULL;
Merge 9.1 (#626) * upstream: fix poll() spin when a channel's output fd closes without data in the channel buffer. Introduce more exact packing of channel fds into the pollfd array. fixes bz3405 and bz3411; ok deraadt@ markus@ OpenBSD-Commit-ID: 06740737849c9047785622ad5d472cb6a3907d10 * upstream: select post-quantum KEX sntrup761x25519-sha512@openssh.com as the default; ok markus@ OpenBSD-Commit-ID: f02d99cbfce22dffec2e2ab1b60905fbddf48fb9 * upstream: add support for the "corp-data" protocol extension to allow server-side copies to be performed without having to go via the client. Patch by Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: 00aa510940fedd66dab1843b58682de4eb7156d5 * upstream: add a sftp client "cp" command that supports server-side copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444 * depend * Skip slow tests on (very) slow test targets. * Set Makefile SHELL as determined by configure. This should improve compatibility for users with non-POSIX shells. If using Makefile.in directly (eg make -f Makefile.in distprep) then SHELL will need to be specified on the command line (along with MANFMT in that particular case). ok djm@ * Use bash or ksh if available for SH in Makefile. * Increase test timeout to allow slow VMs to finish * Only run regression tests on slow VMs. * Only return events from ppoll that were requested. If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@ * Specify TEST_SHELL=bash on AIX. The system shells cause the agent-restrict test to fail due to some quoting so explicitly specify bash until we can get configure to autmatically work around that. * Disable security key on fbsd6 test host. * upstream: man pages: add missing commas between subordinate and main clauses jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@ OpenBSD-Commit-ID: 9520801729bebcb3c9fe43ad7f9776ab4dd05ea3 * upstream: ssh: document sntrup761x25519-sha512@openssh.com as default KEX OpenBSD-Commit-ID: 12545bfa10bcbf552d04d9d9520d0f4e98b0e171 * upstream: openssh-9.0 OpenBSD-Commit-ID: 0dfb461188f4513ec024c1534da8c1ce14c20b64 * update version numbers for release * update build-aux files to match autoconf-2.71 i.e. config.guess, config.sub and install-sh * Revert "update build-aux files to match autoconf-2.71" This reverts commit 0a8ca39fac6ad19096b6c263436f8b2dd51606f2. It turns out that the checked-in copies of these files are actually newer than autoconf-2.71's copies, so this was effectively a downgrade. Spotted by Bo Anderson via github * upstream: two defensive changes from Tobias Stoeckmann via GHPR287 enforce stricter invarient for sshbuf_set_parent() - never allow a buffer to have a previously-set parent changed. In sshbuf_reset(), if the reallocation fails, then zero the entire buffer and not the (potentially smaller) default initial alloc size. OpenBSD-Commit-ID: 14583203aa5d50ad38d2e209ae10abaf8955e6a9 * upstream: Note that curve25519-sha256 was later published in RFC8731. ok djm@ OpenBSD-Commit-ID: 2ac2b5d642d4cf5918eaec8653cad9a4460b2743 * upstream: clear io_want/io_ready flags at start of poll() cycle; avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@ OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967 * Retire fbsd6 test VM. It's long since out of support, relatively slow (it's i686) and the compiler has trouble with PIE. * Resync moduli.5 with upstream. 1.18: remove duplicate publication year; carsten dot kunze at arcor dot de 1.19: ssh-keygen's -G/-T have been replaced with -M generate/screen. * upstream: Correct path for system known hosts file in description of IgnoreUserKnownHosts. Patch from Martin Vahlensieck via tech@ OpenBSD-Commit-ID: 9b7784f054fa5aa4d63cb36bd563889477127215 * upstream: list the correct version number for when usage of the sftp protocol became default and fix a typo from ed maste OpenBSD-Commit-ID: 24e1795ed2283fdeacf16413c2f07503bcdebb31 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: Try to continue running local I/O for channels in state OPEN during SSH transport rekeying. The most visible benefit is that it should make ~-escapes work in the client (e.g. to exit) if the connection happened to have stalled during a rekey event. Based work by and ok dtucker@ OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: regression test for sftp cp command OpenBSD-Regress-ID: c96bea9edde3a384b254785e7f9b2b24a81cdf82 * upstream: Simplify forward-control test. Since we no longer need to support SSH1 we don't need to run shell commands on the other end of the connection and can use ssh -N instead. This also makes the test less racy. OpenBSD-Regress-ID: 32e94ce272820cc398f30b848b2b0f080d10302c * upstream: Use ssh -f and ControlPersist .. to start up test forwards and ssh -O stop to shut them down intead of sleep loops. This speeds up the test by an order of magnitude. OpenBSD-Regress-ID: eb3db5f805100919b092a3b2579c611fba3e83e7 * upstream: It looks like we can't completely avoid waiting for processes to exit so retrieve the pid via controlmaster and use that. OpenBSD-Regress-ID: 8246f00f22b14e49d2ff1744c94897ead33d457b * Cache timezone data in capsicum sandbox. From emaste at freebsd.org, originally part of FreeBSD commit r339216 / fc3c19a9 with autoconf bits added by me. * Include stdlib.h for free() prototype. ... which is used inside the CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG block. * Update OpenSSL and LibreSSL versions in tests. * Add debian-riscv64 test target. * upstream: Avoid an unnecessary xstrdup in rm_env() when matching patterns. Since match_pattern() doesn't modify its arguments (they are const), there is no need to make an extra copy of the strings in options->send_env. From Martin Vahlensieck OpenBSD-Commit-ID: 2c9db31e3f4d3403b49642c64ee048b2a0a39351 * upstream: Add missing includes of stdlib.h and stdint.h. We need stdlib.h for malloc(3) and stdint.h for SIZE_MAX. Unlike the other xmss files, ssh-xmss.c does not include xmss_commons.h so ssh-xmss.c must include those headers itself. From Martin Vahlensieck OpenBSD-Commit-ID: 70e28a9818cee3da1be2ef6503d4b396dd421e6b * upstream: Remove unnecessary includes: openssl/hmac.h and openssl/evp.h. From Martin Vahlensieck. OpenBSD-Commit-ID: a6debb5fb0c8a44e43e8d5ca7cc70ad2f3ea31c3 * upstream: Check sshauthopt_new() for NULL. bz#3425, from tessgauthier at microsoft.com. ok djm@ OpenBSD-Commit-ID: af0315bc3e44aa406daa7e0ae7c2d719a974483f * upstream: Add authfd path to debug output. ok markus@ OpenBSD-Commit-ID: f735a17d1a6f2bee63bfc609d76ef8db8c090890 * upstream: avoid printing hash algorithm twice; from lucas AT sexy.is OpenBSD-Commit-ID: 9d24671e10a84141b7c504396cabad600e47a941 * upstream: fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@ OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e * upstream: Don't leak SK device. Patch from Pedro Martelletto via github PR#316. ok djm@ OpenBSD-Commit-ID: 17d11327545022e727d95fd08b213171c5a4585d * upstream: mention that the helpers are used by ssh(1), ssh-agent(1) and ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto OpenBSD-Commit-ID: 30f880f989d4b329589c1c404315685960a5f153 * Remove now-empty int32_minmax.inc. * Only run tests when source files change. Also run tests on changes to V_9_0 branch. * Add Mac OS X 12 test target. * upstream: be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ OpenBSD-Commit-ID: e267746c047ea86665cdeccef795a8a56082eeb2 * upstream: fix some integer overflows in sieve_large() that show up when trying to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@ OpenBSD-Commit-ID: 81cbc6dd3a21c57bd6fadea10e44afe37bca558e * upstream: remove an obsolete rsa1 format example from an example; from megan batty ok djm OpenBSD-Commit-ID: db2c89879c29bf083df996bd830abfb1e70d62bf * upstream: Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. The wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy OpenBSD-Commit-ID: dd98748d7644df048f78dcf793b3b63db9ab1d25 * upstream: make sure stdout is non-blocking; ok djm@ OpenBSD-Commit-ID: 64940fffbd1b882eda2d7c8c7a43c79368309c0d * upstream: mux.c: mark argument as const; from Martin Vahlensieck OpenBSD-Commit-ID: 69a1a93a55986c7c2ad9f733c093b46a47184341 * upstream: channel_new no longer frees remote_name. So update the comment accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck OpenBSD-Commit-ID: e4e10dc8dc9f40c166ea5a8e991942bedc75a76a * upstream: sshkey_unshield_private() contains a exact duplicate of the code in private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@ OpenBSD-Commit-ID: 876884c3f0e62e8fd8d1594bab06900f971c9c85 * Add ubsan minimal testcase on OpenBSD. As suggested by djm@. * Note that, for now, we need variadic macros. * Also retest OpenBSD upstream on .yml changes. * upstream: When performing operations that glob(3) a remote path, ensure that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef * Remove duplicate bcrypt_pbkdf.o from Makefile bcrypt_pbkdf.o is duplicated in the openbsd-compat Makefile's object file list. * upstream: improve error message when 'ssh-keygen -Y sign' is unable to load a private key; bz3429, reported by Adam Szkoda ok dtucker@ OpenBSD-Commit-ID: bb57b285e67bea536ef81b1055467be2fc380e74 * upstream: Allow existing -U (use agent) flag to work with "-Y sign" operations, where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@ OpenBSD-Commit-ID: a7bc69873b99c32c42c7628ed9ea91565ba08c2f * upstream: Remove errant apostrophe. From haruyama at queen-ml org. OpenBSD-Commit-ID: dc6b294567cb84b384ad6ced9ca469f2bbf0bd10 * upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 * upstream: fix in-place copies; r1.163 incorrectly skipped truncation in all cases, not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@ OpenBSD-Commit-ID: b189f19cd68119548c8e24e39c79f61e115bf92c * upstream: Only run agent-ptrace.sh if gdb is available as all architectures do not ship with gdb. OpenBSD-Regress-ID: ec53e928803e6b87f9ac142d38888ca79a45348d * upstream: regress test for in-place transfers and clobbering larger files with smaller ones; would have caught last regression in scp(1) OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2 * configure.ac: Add missing AC_DEFINE for caph_cache_tzdata test causing HAVE_CAPH_CACHE_TZDATA to be missing from config.h.in. Spotted by Bryan Drewery * upstream: make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via #define) dump to stderr rather than stdout OpenBSD-Commit-ID: 10298513ee32db8390aecb0397d782d68cb14318 * upstream: revert previous; it was broken (spotted by Theo) OpenBSD-Commit-ID: 457c79afaca2f89ec2606405c1059b98b30d8b0d * upstream: Note that ProxyJump also accepts the same tokens as ProxyCommand. From pallxk via github PR#305. OpenBSD-Commit-ID: 7115ac351b129205f1f1ffa6bbfd62abd76be7c5 * upstream: Avoid kill with -1 argument. The out_ctx label can be reached before fork has been called. If this happens, then kill -1 would be called, sending SIGTERM to all processes reachable by the current process. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8 * upstream: f sshpkt functions fail, then password is not cleared with freezero. Unconditionally call freezero to guarantee that password is removed from RAM. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6b093619c9515328e25b0f8093779c52402c89cd * upstream: refactor authorized_keys/principals handling remove "struct ssh *" from arguments - this was only used to pass the remote host/address. These can be passed in instead and the resulting code is less tightly coupled to ssh_api.[ch] ok dtucker@ OpenBSD-Commit-ID: 9d4373d013edc4cc4b5c21a599e1837ac31dda0d * upstream: split the low-level file handling functions out from auth2-pubkey.c Put them in a new auth2-pubkeyfile.c to make it easier to refer to them (e.g. in unit/fuzz tests) without having to refer to everything else pubkey auth brings in. ok dtucker@ OpenBSD-Commit-ID: 3fdca2c61ad97dc1b8d4a7346816f83dc4ce2217 * fuzzer for authorized_keys parsing mostly redundant to authopt_fuzz, but it's sensitive code so IMO it makes sense to test this layer too * Test against LibreSSL 3.5.3. * Test against OpenSSL 1.1.1o and 3.0.3. * fix some bugs in the fuzzer * upstream: keywords ref ssh_config.5; from caspar schutijser OpenBSD-Commit-ID: f146a19d7d5c9374c3b9c520da43b2732d7d1a4e * upstream: ssh-keygen: implement "verify-required" certificate option. This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@ OpenBSD-Commit-ID: f660f973391b593fea4b7b25913c9a15c3eb8a06 * upstream: ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303 from jsegitz with man page text from jmc@, ok markus@ djm@ OpenBSD-Commit-ID: 5c4c57bdd7063ff03381cfb6696659dd3f9f5b9f * upstream: Add period at end of "not known by any other names" message. github PR#320 from jschauma, ok djm@ OpenBSD-Commit-ID: bd60809803c4bfd3ebb7c5c4d918b10e275266f2 * upstream: Add missing *-sk types to ssh-keyscan manpage. From skazi0 via github PR#294. OpenBSD-Commit-ID: fda2c869cdb871f3c90a89fb3f985370bb5d25c0 * upstream: Make SetEnv directives first-match-wins in both sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b * upstream: test setenv in both client and server, test first-match-wins too OpenBSD-Regress-ID: 4c8804f9db38a02db480b9923317457b377fe34b * upstream: move auth_openprincipals() and auth_openkeyfile() over to auth2-pubkeyfile.c too; they make more sense there. OpenBSD-Commit-ID: 9970d99f900e1117fdaab13e9e910a621b7c60ee * upstream: make sure that UseDNS hostname lookup happens in the monitor and not in the pledge(2)'d unprivileged process; fixes regression caused by recent refactoring spotted by henning@ OpenBSD-Commit-ID: a089870b95101cd8881a2dff65b2f1627d13e88d * fix possible NULL deref when built without FIDO Analysis/fix from kircher in bz3443; ok dtucker@ * automatically enable built-in FIDO support If libfido2 is found and usable, then enable the built-in security key support unless --without-security-key-builtin was requested. ok dtucker@ * upstream: Log an error if pipe() fails while accepting a connection. bz#3447, from vincent-openssh at vinc17 net, ok djm@ OpenBSD-Commit-ID: 9d59f19872b94900a5c79da2d57850241ac5df94 * upstream: Don't attempt to fprintf a null identity comment. From Martin Vahlensieck via tech@. OpenBSD-Commit-ID: 4c54d20a8e8e4e9912c38a7b4ef5bfc5ca2e05c2 * upstream: Make sure not to fclose() the same fd twice in case of an error. ok dtucker@ OpenBSD-Commit-ID: e384c4e05d5521e7866b3d53ca59acd2a86eef99 * upstream: make it clear that RekeyLimit applies to both transmitted and received data. GHPR#328 from Jan Pazdziora OpenBSD-Commit-ID: d180a905fec9ff418a75c07bb96ea41c9308c3f9 * request 1.1x API compatibility for OpenSSL >=3.x idea/patch from Pedro Martelletto via GHPR#322; ok dtucker@ * fix broken case statement in previous * Disable SK support if FIDO libs not found. * Zero out LIBFIDO2 when SK support not usable. Prevents us from trying to link them into ssh-sk-helper and failing to build. * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ OpenBSD-Commit-ID: b2f6e5f60f2bba293b831654328a8a0035ef4a1b * upstream: Roll back previous KEX changes as they aren't safe until compat_pkalg_proposal and friends always allocate their returned strings. Reported by Qualys. OpenBSD-Commit-ID: 1c7a88a0d5033f42f88ab9bec58ef1cf72c81ad0 * upstream: allow arguments to sftp -D option, e.g. sftp -D "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce * Update OpenSSL tests to the most recent releases. * upstream: reflect the update to -D arg name in usage(); OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c * upstream: ignore SIGPIPE earlier in main(), specifically before muxclient() which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@ OpenBSD-Commit-ID: 63d8e13276869eebac6d7a05d5a96307f9026e47 * upstream: Always return allocated strings from the kex filtering so that we can free them later. Fix one leak in compat_kex_proposal. Based on github PR#324 from ZoltanFridrich with some simplications by me. ok djm@ OpenBSD-Commit-ID: 9171616da3307612d0ede086fd511142f91246e4 * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ This is a roll-forward of the previous rollback now that the required changes in compat.c have been done. OpenBSD-Commit-ID: c7cd93730b3b9f53cdad3ae32462922834ef73eb * upstream: bump up loglevel from debug to info when unable to open authorized keys/principals file for errno != ENOENT; bz2042 ok dtucker OpenBSD-Commit-ID: e79aa550d91ade6a80f081bda689da24c086d66b * Skip select+rlimit check if sandboxing is disabled It's not needed in that case, and the test can fail when being built with some compiler memory sanitizer flags. bz#3441 * upstream: use consistent field names (s/char/byte) in format description OpenBSD-Commit-ID: 3de33572733ee7fcfd7db33d37db23d2280254f0 * upstream: Remove leftover line. Remove extra line leftover from merge conflict. ok djm@ OpenBSD-Commit-ID: 460e2290875d7ae64971a7e669c244b1d1c0ae2e * Move checks for pollfd.fd and nfds_t. Move the checks for struct pollfd.fd and nfds_t to before the sandboxing checks. This groups all the sandbox checks together so we can skip them all when sandboxing is disabled. * Skip all rlimit tests when sandboxing disabled. The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no. * Add clang sanitizer tests. * upstream: Add TEST_REGRESS_CACHE_DIR. If set, it is used to cache regress test names that have succeeded and skip those on a re-run. OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247 * Move sanitizer logs into regress for collection. * Add GCC address sanitizer build/test. * Update sanitizer test targets: - remove clang-sanitize-memory for now. It takes so long that the test times out. - add gcc sanitize-address and sanitize-undefined test targets. * Test against openssl-3.0.5. * Move unset to before we set anything. * Refuse to use OpenSSL 3.0.4 due to potential RCE. OpenSSL has a potential RCE in its RSA implementation (CVE-2022-2274) so refuse to use that specific version. * Capture stderr output from configure. * Only refuse to use OpenSSL 3.0.4 on x86_64. The potential RCE only impacts x86_64, so only refuse to use it if we're targetting a potentially impacted architecture. ok djm@ * Remove special casing of crypt(). Configure goes to some lengths to pick crypt() from either libcrypt or OpenSSL's libcrypto because they can more or less featureful (eg supporting md5-style passwords). OpenSSL removed its crypt() interface in 2002: https://github.com/openssl/openssl/commit/69deec58 so these hijinks should no longer be necessary. This also only links sshd with libcrypt which is the only thing that needs it. ok djm@ * Clarify README.md text. Clarify the text about the implications of building without OpenSSL, and prefix the "configure --help" example command with a "./" so it's likely to work as-is in more shells. From bz#3461. * Split README.platform into its own line. README.platform has general platform-specific information, having it following text about FIDO2 on the same line could imply that it only has information about FIDO2. * Return ERANGE from getcwd() if buffer size is 1. If getcwd() is supplied a buffer size of exactly 1 and a path of "/", it could result in a nul byte being written out of array bounds. POSIX says it should return ERANGE if the path will not fit in the available buffer (with terminating nul). 1 byte cannot fit any possible path with its nul, so immediately return ERANGE in that case. OpenSSH never uses getcwd() with this buffer size, and all current (and even quite old) platforms that we are currently known to work on have a native getcwd() so this code is not used on those anyway. Reported by Qualys, ok djm@ * Remove unintended changes. I inadvertently included a couple of local changes with the OpenSSL 3.0.4 change. Revert, anything that should be there will be committed separately. * Add AUDIT_ARCH_PPC to supported seccomp arches. Patch from dries.deschout at dodeco.eu. * Rename bbone test target to ARM. * Move vmshutdown to first step. If a previous run on a physical runner has failed to clean up, the next run will fail because it'll try to check out the code to a broken directory mount. Make cleanup the first step. * upstream: pull passphrase reading and confirmation into a separate function so it can be used for FIDO2 PINs; no functional change OpenBSD-Commit-ID: bf34f76b8283cc1d3f54633e0d4f13613d87bb2f * upstream: when enrolling a resident key on a security token, check if a credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust OpenBSD-Commit-ID: e45e9f1bf2b2f32d9850669e7a8dbd64acc5fca4 * upstream: sk-usbhid: preserve error code returned by key_lookup() it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b * upstream: ssh-keygen: fix touch prompt, pin retries; part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: 75d1005bd2ef8f29fa834c90d2684e73556fffe8 * crank SSH_SK_VERSION_MAJOR in sk-dummy.so * Skip scp3 test if there's no scp on remote path. scp -3 ends up using the scp that's in the remote path and will fail if one is not available. Based on a patch from rapier at psc.edu. * Convert "have_prog" function into "which". "which" and its behaviour is not standardized, so convert the existing have_prog function into "which" so we can rely on it being available and what its semantics are. Add a have_prog wrapper that maintains the existing behaviour. * upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not executable. No-op on most platforms but should prevent warnings in -portable on systems that don't have 'date %s'. OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4 * upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test. OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0 * Remove workarounds for OpenSSL missing AES-GCM. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES GCM mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have GCM, so this is no longer needed. ok djm@ * Remove workarounds for OpenSSL missing AES-CTR. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES CTR mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have CTR, so this is no longer needed. ok djm@ * Do not link scp, sftp and sftp-server w/ zlib. Some of our binaries (eg sftp, sftp-server, scp) do not interact with the channels code and thus do use libraries such as zlib and libcrypto although they are linked with them. This adds a CHANNELLIBS and starts by moving zlib into it, which means the aformentioned binaries are no longer linked against zlib. ok djm@ * Group libcrypto and PRNGD checks together. They're related more than the libcrypt or libiaf checks which are currently between them. ok djm@ * Remove seed_rng calls from scp, sftp, sftp-server. These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@ * Move libcrypto into CHANNELLIBS. This will result in sftp, sftp-server and scp no longer being linked against libcrypto. ok djm@ * Move stale-configure check as early as possible. We added a check in Makefile to catch the case where configure needs to be rebuilt, however this did not happen until a build was attempted in which case all of the work done by configure was wasted. Move this check to the start of configure to catch it as early as possible. ok djm@ * Remove deprecated MacOS 10.15 runners. * upstream: avoid double-free in error path introduced in r1.70; report and fix based on GHPR#332 by v-rzh ok dtucker@ OpenBSD-Commit-ID: 3d21aa127b1f37cfc5bdc21461db369a663a951f * Include CHANNEL and FIDO2 libs in configure output * Factor out getrnd() and rename to getentropy(). Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@. * compat code for fido_dev_is_winhello() Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * check_sk_options: add temporary WinHello workaround Up to libfido 1.10.0, WinHello advertises "clientPin" rather than "uv" capability. This is fixed in 1.11.0. For the time being, workaround it here. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * sk_sign: set FIDO2 uv attribute explicitely for WinHello WinHello via libfido2 performs user verification by default. However, if we stick to that, there's no way to differentiate between keys created with or without "-O verify-required". Set FIDO2 uv attribute explicitely to FIDO_OPT_FALSE, then check if user verification has been requested. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: don't prompt for FIDO passphrase before attempting to enroll the credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@ OpenBSD-Commit-ID: bd5342ffc353ee37d39617906867c305564d1ce2 * Give unused param a name. Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello. * Actually put HAVE_STDINT_H around the stdint.h. * Rename our getentropy to prevent possible loops. Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@ * Test hostbased auth on github runners. * fix SANDBOX_SECCOMP_FILTER_DEBUG * Fix conditional for running hostbased tests. * upstream: allow certificate validity intervals, sshsig verification times and authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13 * upstream: add some tests for parse_absolute_time(), including cases where it is forced to the UTC timezone. bz3468 ok dtucker OpenBSD-Regress-ID: ea07ca31c2f3847a38df028ca632763ae44e8759 * Skip hostbased during Valgrind tests. Valgrind doesn't let ssh exec ssh-keysign (because it's setuid) so skip it during the Valgrind based tests. See https://bugs.kde.org/show_bug.cgi?id=119404 for a discussion of this (ironically there the problematic binary was ssh(1) back when it could still be setuid). * Rerun tests if any .github config file changes. * Add a timegm implementation from Heimdal via Samba. Fixes build on (at least Solaris 10). * Replace deprecated ubuntu-18.04 runners with 22.04 * upstream: sftp-server: support home-directory request Add support to the sftp-server for the home-directory extension defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the existing expand-path@openssh.com, but uses a more official protocol name, and so is a bit more likely to be implemented by non-OpenSSH clients. From Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: bfc580d05cc0c817831ae7ecbac4a481c23566ab * fido_dev_is_winhello: return 0, not "false" "false" is not used anywhere in OpenSSH, so return 0 like everywhere else. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * Revert "check_sk_options: add temporary WinHello workaround" Cygwin now comes with libfido2 1.11.0, so this workaround isn't required anymore. This reverts commit 242c044ab111a37aad3b0775727c36a4c5f0102c. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: use .Cm for "sign"; from josiah frentsos OpenBSD-Commit-ID: 7f80a53d54857ac6ae49ea6ad93c5bd12231d1e4 * upstream: add an extra flag to sk_probe() to indicate whether we're probing for a FIDO resident key or not. Unused here, but will make like easier for portable OpenBSD-Commit-ID: 432c8ff70e270378df9dbceb9bdeaa5b43b5a832 * on Cygwin, prefer WinHello FIDO device If no FIDO device was explictly specified, then prefer the windows://hello FIDO device. An exception to this is when probing resident FIDO keys, in which case hardware FIDO devices are preferred. * Check for perms to run agent-getpeereid test. Ubuntu 22.04 defaults to private home dirs which prevents "nobody" running ssh-add during the agent-getpeereid test. Check for this and add the necessary permissions. * upstream: double free() in error path; from Eusgor via GHPR333 OpenBSD-Commit-ID: 39f35e16ba878c8d02b4d01d8826d9b321be26d4 * Add Cygwin (on windows-2019) test target. In addition to installing the requisite Cygwin packages, we also need to explicitly invoke "sh" for steps that run other scripts since the runner environment doesn't understand #! paths. * Add a bit more debug output. * Fix cygwin conditional steps. * upstream: Strictly enforce the maximum allowed SSH2 banner size in ssh-keyscan and prevent a one-byte buffer overflow. Patch from Qualys, ok djm@ OpenBSD-Commit-ID: 6ae664f9f4db6e8a0589425f74cd0bbf3aeef4e4 * upstream: remove incorrect check that can break enrolling a resident key (introduced in r1.40) OpenBSD-Commit-ID: 4cab364d518470e29e624af3d3f9ffa9c92b6f01 * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * fix pester test failures * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * define HAVE_KILLPG * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * add debug on appveyor * add sleep to pester test * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * fix 9.1 compilation errors * disable -p pester tests due to unreliability on older Windows versions * remove extra sleep time from debugging scp pester tests * modify -p tests to only run for Windows OS version 10 and above * add windows specific code back into method moved from auth.c to auth2-pubkeyfile.c * add preprocessor for WinHello * revert preprocessor definition for winhello * add windows preprocessor definition in key_lookup * remove rdp block from appveyor since we are no longer debugging * add ifdef to sftp-server.c * make key_lookup compatible with winhello * appveyor.yml * increase debug of failing pester test * add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed * modify new scp.sh tests for windows * remove in place tests from scp.sh * remove rdp debug from appveyor * retrigger appveyor * change check of OS version in scp test Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: naddy@openbsd.org <naddy@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: tj@openbsd.org <tj@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: florian@openbsd.org <florian@openbsd.org> Co-authored-by: markus@openbsd.org <markus@openbsd.org> Co-authored-by: Tobias Heider <me@tobhe.de> Co-authored-by: anton@openbsd.org <anton@openbsd.org> Co-authored-by: Tim Rice <tim@multitalents.net> Co-authored-by: tobhe@openbsd.org <tobhe@openbsd.org> Co-authored-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org>
2022-11-02 17:06:45 +01:00
u_char *cp, keyiv[SSH_DIGEST_MAX_LENGTH];
struct sshcipher_ctx *cctx = NULL;
const struct sshcipher *cipher;
struct sshkey *kswap = NULL, tmp;
int r = SSH_ERR_INTERNAL_ERROR;
#ifdef DEBUG_PK
fprintf(stderr, "%s: entering for %s\n", __func__, sshkey_ssh_name(k));
#endif
if (!sshkey_is_shielded(k))
return 0; /* nothing to do */
if ((cipher = cipher_by_name(SSHKEY_SHIELD_CIPHER)) == NULL) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
if (cipher_keylen(cipher) + cipher_ivlen(cipher) >
ssh_digest_bytes(SSHKEY_SHIELD_PREKEY_HASH)) {
r = SSH_ERR_INTERNAL_ERROR;
goto out;
}
/* check size of shielded key blob */
if (k->shielded_len < cipher_blocksize(cipher) ||
(k->shielded_len % cipher_blocksize(cipher)) != 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* Calculate the ephemeral key from the prekey */
if ((r = ssh_digest_memory(SSHKEY_SHIELD_PREKEY_HASH,
k->shield_prekey, k->shield_prekey_len,
keyiv, SSH_DIGEST_MAX_LENGTH)) != 0)
goto out;
if ((r = cipher_init(&cctx, cipher, keyiv, cipher_keylen(cipher),
keyiv + cipher_keylen(cipher), cipher_ivlen(cipher), 0)) != 0)
goto out;
#ifdef DEBUG_PK
fprintf(stderr, "%s: key+iv\n", __func__);
sshbuf_dump_data(keyiv, ssh_digest_bytes(SSHKEY_SHIELD_PREKEY_HASH),
stderr);
#endif
/* Decrypt and parse the shielded private key using the ephemeral key */
if ((prvbuf = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if ((r = sshbuf_reserve(prvbuf, k->shielded_len, &cp)) != 0)
goto out;
/* decrypt */
#ifdef DEBUG_PK
fprintf(stderr, "%s: encrypted\n", __func__);
sshbuf_dump_data(k->shielded_private, k->shielded_len, stderr);
#endif
if ((r = cipher_crypt(cctx, 0, cp,
k->shielded_private, k->shielded_len, 0, 0)) != 0)
goto out;
#ifdef DEBUG_PK
fprintf(stderr, "%s: serialised\n", __func__);
sshbuf_dump(prvbuf, stderr);
#endif
/* Parse private key */
if ((r = sshkey_private_deserialize(prvbuf, &kswap)) != 0)
goto out;
Merge 9.1 (#626) * upstream: fix poll() spin when a channel's output fd closes without data in the channel buffer. Introduce more exact packing of channel fds into the pollfd array. fixes bz3405 and bz3411; ok deraadt@ markus@ OpenBSD-Commit-ID: 06740737849c9047785622ad5d472cb6a3907d10 * upstream: select post-quantum KEX sntrup761x25519-sha512@openssh.com as the default; ok markus@ OpenBSD-Commit-ID: f02d99cbfce22dffec2e2ab1b60905fbddf48fb9 * upstream: add support for the "corp-data" protocol extension to allow server-side copies to be performed without having to go via the client. Patch by Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: 00aa510940fedd66dab1843b58682de4eb7156d5 * upstream: add a sftp client "cp" command that supports server-side copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444 * depend * Skip slow tests on (very) slow test targets. * Set Makefile SHELL as determined by configure. This should improve compatibility for users with non-POSIX shells. If using Makefile.in directly (eg make -f Makefile.in distprep) then SHELL will need to be specified on the command line (along with MANFMT in that particular case). ok djm@ * Use bash or ksh if available for SH in Makefile. * Increase test timeout to allow slow VMs to finish * Only run regression tests on slow VMs. * Only return events from ppoll that were requested. If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@ * Specify TEST_SHELL=bash on AIX. The system shells cause the agent-restrict test to fail due to some quoting so explicitly specify bash until we can get configure to autmatically work around that. * Disable security key on fbsd6 test host. * upstream: man pages: add missing commas between subordinate and main clauses jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@ OpenBSD-Commit-ID: 9520801729bebcb3c9fe43ad7f9776ab4dd05ea3 * upstream: ssh: document sntrup761x25519-sha512@openssh.com as default KEX OpenBSD-Commit-ID: 12545bfa10bcbf552d04d9d9520d0f4e98b0e171 * upstream: openssh-9.0 OpenBSD-Commit-ID: 0dfb461188f4513ec024c1534da8c1ce14c20b64 * update version numbers for release * update build-aux files to match autoconf-2.71 i.e. config.guess, config.sub and install-sh * Revert "update build-aux files to match autoconf-2.71" This reverts commit 0a8ca39fac6ad19096b6c263436f8b2dd51606f2. It turns out that the checked-in copies of these files are actually newer than autoconf-2.71's copies, so this was effectively a downgrade. Spotted by Bo Anderson via github * upstream: two defensive changes from Tobias Stoeckmann via GHPR287 enforce stricter invarient for sshbuf_set_parent() - never allow a buffer to have a previously-set parent changed. In sshbuf_reset(), if the reallocation fails, then zero the entire buffer and not the (potentially smaller) default initial alloc size. OpenBSD-Commit-ID: 14583203aa5d50ad38d2e209ae10abaf8955e6a9 * upstream: Note that curve25519-sha256 was later published in RFC8731. ok djm@ OpenBSD-Commit-ID: 2ac2b5d642d4cf5918eaec8653cad9a4460b2743 * upstream: clear io_want/io_ready flags at start of poll() cycle; avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@ OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967 * Retire fbsd6 test VM. It's long since out of support, relatively slow (it's i686) and the compiler has trouble with PIE. * Resync moduli.5 with upstream. 1.18: remove duplicate publication year; carsten dot kunze at arcor dot de 1.19: ssh-keygen's -G/-T have been replaced with -M generate/screen. * upstream: Correct path for system known hosts file in description of IgnoreUserKnownHosts. Patch from Martin Vahlensieck via tech@ OpenBSD-Commit-ID: 9b7784f054fa5aa4d63cb36bd563889477127215 * upstream: list the correct version number for when usage of the sftp protocol became default and fix a typo from ed maste OpenBSD-Commit-ID: 24e1795ed2283fdeacf16413c2f07503bcdebb31 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: Try to continue running local I/O for channels in state OPEN during SSH transport rekeying. The most visible benefit is that it should make ~-escapes work in the client (e.g. to exit) if the connection happened to have stalled during a rekey event. Based work by and ok dtucker@ OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: regression test for sftp cp command OpenBSD-Regress-ID: c96bea9edde3a384b254785e7f9b2b24a81cdf82 * upstream: Simplify forward-control test. Since we no longer need to support SSH1 we don't need to run shell commands on the other end of the connection and can use ssh -N instead. This also makes the test less racy. OpenBSD-Regress-ID: 32e94ce272820cc398f30b848b2b0f080d10302c * upstream: Use ssh -f and ControlPersist .. to start up test forwards and ssh -O stop to shut them down intead of sleep loops. This speeds up the test by an order of magnitude. OpenBSD-Regress-ID: eb3db5f805100919b092a3b2579c611fba3e83e7 * upstream: It looks like we can't completely avoid waiting for processes to exit so retrieve the pid via controlmaster and use that. OpenBSD-Regress-ID: 8246f00f22b14e49d2ff1744c94897ead33d457b * Cache timezone data in capsicum sandbox. From emaste at freebsd.org, originally part of FreeBSD commit r339216 / fc3c19a9 with autoconf bits added by me. * Include stdlib.h for free() prototype. ... which is used inside the CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG block. * Update OpenSSL and LibreSSL versions in tests. * Add debian-riscv64 test target. * upstream: Avoid an unnecessary xstrdup in rm_env() when matching patterns. Since match_pattern() doesn't modify its arguments (they are const), there is no need to make an extra copy of the strings in options->send_env. From Martin Vahlensieck OpenBSD-Commit-ID: 2c9db31e3f4d3403b49642c64ee048b2a0a39351 * upstream: Add missing includes of stdlib.h and stdint.h. We need stdlib.h for malloc(3) and stdint.h for SIZE_MAX. Unlike the other xmss files, ssh-xmss.c does not include xmss_commons.h so ssh-xmss.c must include those headers itself. From Martin Vahlensieck OpenBSD-Commit-ID: 70e28a9818cee3da1be2ef6503d4b396dd421e6b * upstream: Remove unnecessary includes: openssl/hmac.h and openssl/evp.h. From Martin Vahlensieck. OpenBSD-Commit-ID: a6debb5fb0c8a44e43e8d5ca7cc70ad2f3ea31c3 * upstream: Check sshauthopt_new() for NULL. bz#3425, from tessgauthier at microsoft.com. ok djm@ OpenBSD-Commit-ID: af0315bc3e44aa406daa7e0ae7c2d719a974483f * upstream: Add authfd path to debug output. ok markus@ OpenBSD-Commit-ID: f735a17d1a6f2bee63bfc609d76ef8db8c090890 * upstream: avoid printing hash algorithm twice; from lucas AT sexy.is OpenBSD-Commit-ID: 9d24671e10a84141b7c504396cabad600e47a941 * upstream: fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@ OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e * upstream: Don't leak SK device. Patch from Pedro Martelletto via github PR#316. ok djm@ OpenBSD-Commit-ID: 17d11327545022e727d95fd08b213171c5a4585d * upstream: mention that the helpers are used by ssh(1), ssh-agent(1) and ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto OpenBSD-Commit-ID: 30f880f989d4b329589c1c404315685960a5f153 * Remove now-empty int32_minmax.inc. * Only run tests when source files change. Also run tests on changes to V_9_0 branch. * Add Mac OS X 12 test target. * upstream: be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ OpenBSD-Commit-ID: e267746c047ea86665cdeccef795a8a56082eeb2 * upstream: fix some integer overflows in sieve_large() that show up when trying to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@ OpenBSD-Commit-ID: 81cbc6dd3a21c57bd6fadea10e44afe37bca558e * upstream: remove an obsolete rsa1 format example from an example; from megan batty ok djm OpenBSD-Commit-ID: db2c89879c29bf083df996bd830abfb1e70d62bf * upstream: Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. The wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy OpenBSD-Commit-ID: dd98748d7644df048f78dcf793b3b63db9ab1d25 * upstream: make sure stdout is non-blocking; ok djm@ OpenBSD-Commit-ID: 64940fffbd1b882eda2d7c8c7a43c79368309c0d * upstream: mux.c: mark argument as const; from Martin Vahlensieck OpenBSD-Commit-ID: 69a1a93a55986c7c2ad9f733c093b46a47184341 * upstream: channel_new no longer frees remote_name. So update the comment accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck OpenBSD-Commit-ID: e4e10dc8dc9f40c166ea5a8e991942bedc75a76a * upstream: sshkey_unshield_private() contains a exact duplicate of the code in private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@ OpenBSD-Commit-ID: 876884c3f0e62e8fd8d1594bab06900f971c9c85 * Add ubsan minimal testcase on OpenBSD. As suggested by djm@. * Note that, for now, we need variadic macros. * Also retest OpenBSD upstream on .yml changes. * upstream: When performing operations that glob(3) a remote path, ensure that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef * Remove duplicate bcrypt_pbkdf.o from Makefile bcrypt_pbkdf.o is duplicated in the openbsd-compat Makefile's object file list. * upstream: improve error message when 'ssh-keygen -Y sign' is unable to load a private key; bz3429, reported by Adam Szkoda ok dtucker@ OpenBSD-Commit-ID: bb57b285e67bea536ef81b1055467be2fc380e74 * upstream: Allow existing -U (use agent) flag to work with "-Y sign" operations, where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@ OpenBSD-Commit-ID: a7bc69873b99c32c42c7628ed9ea91565ba08c2f * upstream: Remove errant apostrophe. From haruyama at queen-ml org. OpenBSD-Commit-ID: dc6b294567cb84b384ad6ced9ca469f2bbf0bd10 * upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 * upstream: fix in-place copies; r1.163 incorrectly skipped truncation in all cases, not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@ OpenBSD-Commit-ID: b189f19cd68119548c8e24e39c79f61e115bf92c * upstream: Only run agent-ptrace.sh if gdb is available as all architectures do not ship with gdb. OpenBSD-Regress-ID: ec53e928803e6b87f9ac142d38888ca79a45348d * upstream: regress test for in-place transfers and clobbering larger files with smaller ones; would have caught last regression in scp(1) OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2 * configure.ac: Add missing AC_DEFINE for caph_cache_tzdata test causing HAVE_CAPH_CACHE_TZDATA to be missing from config.h.in. Spotted by Bryan Drewery * upstream: make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via #define) dump to stderr rather than stdout OpenBSD-Commit-ID: 10298513ee32db8390aecb0397d782d68cb14318 * upstream: revert previous; it was broken (spotted by Theo) OpenBSD-Commit-ID: 457c79afaca2f89ec2606405c1059b98b30d8b0d * upstream: Note that ProxyJump also accepts the same tokens as ProxyCommand. From pallxk via github PR#305. OpenBSD-Commit-ID: 7115ac351b129205f1f1ffa6bbfd62abd76be7c5 * upstream: Avoid kill with -1 argument. The out_ctx label can be reached before fork has been called. If this happens, then kill -1 would be called, sending SIGTERM to all processes reachable by the current process. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8 * upstream: f sshpkt functions fail, then password is not cleared with freezero. Unconditionally call freezero to guarantee that password is removed from RAM. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6b093619c9515328e25b0f8093779c52402c89cd * upstream: refactor authorized_keys/principals handling remove "struct ssh *" from arguments - this was only used to pass the remote host/address. These can be passed in instead and the resulting code is less tightly coupled to ssh_api.[ch] ok dtucker@ OpenBSD-Commit-ID: 9d4373d013edc4cc4b5c21a599e1837ac31dda0d * upstream: split the low-level file handling functions out from auth2-pubkey.c Put them in a new auth2-pubkeyfile.c to make it easier to refer to them (e.g. in unit/fuzz tests) without having to refer to everything else pubkey auth brings in. ok dtucker@ OpenBSD-Commit-ID: 3fdca2c61ad97dc1b8d4a7346816f83dc4ce2217 * fuzzer for authorized_keys parsing mostly redundant to authopt_fuzz, but it's sensitive code so IMO it makes sense to test this layer too * Test against LibreSSL 3.5.3. * Test against OpenSSL 1.1.1o and 3.0.3. * fix some bugs in the fuzzer * upstream: keywords ref ssh_config.5; from caspar schutijser OpenBSD-Commit-ID: f146a19d7d5c9374c3b9c520da43b2732d7d1a4e * upstream: ssh-keygen: implement "verify-required" certificate option. This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@ OpenBSD-Commit-ID: f660f973391b593fea4b7b25913c9a15c3eb8a06 * upstream: ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303 from jsegitz with man page text from jmc@, ok markus@ djm@ OpenBSD-Commit-ID: 5c4c57bdd7063ff03381cfb6696659dd3f9f5b9f * upstream: Add period at end of "not known by any other names" message. github PR#320 from jschauma, ok djm@ OpenBSD-Commit-ID: bd60809803c4bfd3ebb7c5c4d918b10e275266f2 * upstream: Add missing *-sk types to ssh-keyscan manpage. From skazi0 via github PR#294. OpenBSD-Commit-ID: fda2c869cdb871f3c90a89fb3f985370bb5d25c0 * upstream: Make SetEnv directives first-match-wins in both sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b * upstream: test setenv in both client and server, test first-match-wins too OpenBSD-Regress-ID: 4c8804f9db38a02db480b9923317457b377fe34b * upstream: move auth_openprincipals() and auth_openkeyfile() over to auth2-pubkeyfile.c too; they make more sense there. OpenBSD-Commit-ID: 9970d99f900e1117fdaab13e9e910a621b7c60ee * upstream: make sure that UseDNS hostname lookup happens in the monitor and not in the pledge(2)'d unprivileged process; fixes regression caused by recent refactoring spotted by henning@ OpenBSD-Commit-ID: a089870b95101cd8881a2dff65b2f1627d13e88d * fix possible NULL deref when built without FIDO Analysis/fix from kircher in bz3443; ok dtucker@ * automatically enable built-in FIDO support If libfido2 is found and usable, then enable the built-in security key support unless --without-security-key-builtin was requested. ok dtucker@ * upstream: Log an error if pipe() fails while accepting a connection. bz#3447, from vincent-openssh at vinc17 net, ok djm@ OpenBSD-Commit-ID: 9d59f19872b94900a5c79da2d57850241ac5df94 * upstream: Don't attempt to fprintf a null identity comment. From Martin Vahlensieck via tech@. OpenBSD-Commit-ID: 4c54d20a8e8e4e9912c38a7b4ef5bfc5ca2e05c2 * upstream: Make sure not to fclose() the same fd twice in case of an error. ok dtucker@ OpenBSD-Commit-ID: e384c4e05d5521e7866b3d53ca59acd2a86eef99 * upstream: make it clear that RekeyLimit applies to both transmitted and received data. GHPR#328 from Jan Pazdziora OpenBSD-Commit-ID: d180a905fec9ff418a75c07bb96ea41c9308c3f9 * request 1.1x API compatibility for OpenSSL >=3.x idea/patch from Pedro Martelletto via GHPR#322; ok dtucker@ * fix broken case statement in previous * Disable SK support if FIDO libs not found. * Zero out LIBFIDO2 when SK support not usable. Prevents us from trying to link them into ssh-sk-helper and failing to build. * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ OpenBSD-Commit-ID: b2f6e5f60f2bba293b831654328a8a0035ef4a1b * upstream: Roll back previous KEX changes as they aren't safe until compat_pkalg_proposal and friends always allocate their returned strings. Reported by Qualys. OpenBSD-Commit-ID: 1c7a88a0d5033f42f88ab9bec58ef1cf72c81ad0 * upstream: allow arguments to sftp -D option, e.g. sftp -D "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce * Update OpenSSL tests to the most recent releases. * upstream: reflect the update to -D arg name in usage(); OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c * upstream: ignore SIGPIPE earlier in main(), specifically before muxclient() which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@ OpenBSD-Commit-ID: 63d8e13276869eebac6d7a05d5a96307f9026e47 * upstream: Always return allocated strings from the kex filtering so that we can free them later. Fix one leak in compat_kex_proposal. Based on github PR#324 from ZoltanFridrich with some simplications by me. ok djm@ OpenBSD-Commit-ID: 9171616da3307612d0ede086fd511142f91246e4 * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ This is a roll-forward of the previous rollback now that the required changes in compat.c have been done. OpenBSD-Commit-ID: c7cd93730b3b9f53cdad3ae32462922834ef73eb * upstream: bump up loglevel from debug to info when unable to open authorized keys/principals file for errno != ENOENT; bz2042 ok dtucker OpenBSD-Commit-ID: e79aa550d91ade6a80f081bda689da24c086d66b * Skip select+rlimit check if sandboxing is disabled It's not needed in that case, and the test can fail when being built with some compiler memory sanitizer flags. bz#3441 * upstream: use consistent field names (s/char/byte) in format description OpenBSD-Commit-ID: 3de33572733ee7fcfd7db33d37db23d2280254f0 * upstream: Remove leftover line. Remove extra line leftover from merge conflict. ok djm@ OpenBSD-Commit-ID: 460e2290875d7ae64971a7e669c244b1d1c0ae2e * Move checks for pollfd.fd and nfds_t. Move the checks for struct pollfd.fd and nfds_t to before the sandboxing checks. This groups all the sandbox checks together so we can skip them all when sandboxing is disabled. * Skip all rlimit tests when sandboxing disabled. The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no. * Add clang sanitizer tests. * upstream: Add TEST_REGRESS_CACHE_DIR. If set, it is used to cache regress test names that have succeeded and skip those on a re-run. OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247 * Move sanitizer logs into regress for collection. * Add GCC address sanitizer build/test. * Update sanitizer test targets: - remove clang-sanitize-memory for now. It takes so long that the test times out. - add gcc sanitize-address and sanitize-undefined test targets. * Test against openssl-3.0.5. * Move unset to before we set anything. * Refuse to use OpenSSL 3.0.4 due to potential RCE. OpenSSL has a potential RCE in its RSA implementation (CVE-2022-2274) so refuse to use that specific version. * Capture stderr output from configure. * Only refuse to use OpenSSL 3.0.4 on x86_64. The potential RCE only impacts x86_64, so only refuse to use it if we're targetting a potentially impacted architecture. ok djm@ * Remove special casing of crypt(). Configure goes to some lengths to pick crypt() from either libcrypt or OpenSSL's libcrypto because they can more or less featureful (eg supporting md5-style passwords). OpenSSL removed its crypt() interface in 2002: https://github.com/openssl/openssl/commit/69deec58 so these hijinks should no longer be necessary. This also only links sshd with libcrypt which is the only thing that needs it. ok djm@ * Clarify README.md text. Clarify the text about the implications of building without OpenSSL, and prefix the "configure --help" example command with a "./" so it's likely to work as-is in more shells. From bz#3461. * Split README.platform into its own line. README.platform has general platform-specific information, having it following text about FIDO2 on the same line could imply that it only has information about FIDO2. * Return ERANGE from getcwd() if buffer size is 1. If getcwd() is supplied a buffer size of exactly 1 and a path of "/", it could result in a nul byte being written out of array bounds. POSIX says it should return ERANGE if the path will not fit in the available buffer (with terminating nul). 1 byte cannot fit any possible path with its nul, so immediately return ERANGE in that case. OpenSSH never uses getcwd() with this buffer size, and all current (and even quite old) platforms that we are currently known to work on have a native getcwd() so this code is not used on those anyway. Reported by Qualys, ok djm@ * Remove unintended changes. I inadvertently included a couple of local changes with the OpenSSL 3.0.4 change. Revert, anything that should be there will be committed separately. * Add AUDIT_ARCH_PPC to supported seccomp arches. Patch from dries.deschout at dodeco.eu. * Rename bbone test target to ARM. * Move vmshutdown to first step. If a previous run on a physical runner has failed to clean up, the next run will fail because it'll try to check out the code to a broken directory mount. Make cleanup the first step. * upstream: pull passphrase reading and confirmation into a separate function so it can be used for FIDO2 PINs; no functional change OpenBSD-Commit-ID: bf34f76b8283cc1d3f54633e0d4f13613d87bb2f * upstream: when enrolling a resident key on a security token, check if a credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust OpenBSD-Commit-ID: e45e9f1bf2b2f32d9850669e7a8dbd64acc5fca4 * upstream: sk-usbhid: preserve error code returned by key_lookup() it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b * upstream: ssh-keygen: fix touch prompt, pin retries; part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: 75d1005bd2ef8f29fa834c90d2684e73556fffe8 * crank SSH_SK_VERSION_MAJOR in sk-dummy.so * Skip scp3 test if there's no scp on remote path. scp -3 ends up using the scp that's in the remote path and will fail if one is not available. Based on a patch from rapier at psc.edu. * Convert "have_prog" function into "which". "which" and its behaviour is not standardized, so convert the existing have_prog function into "which" so we can rely on it being available and what its semantics are. Add a have_prog wrapper that maintains the existing behaviour. * upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not executable. No-op on most platforms but should prevent warnings in -portable on systems that don't have 'date %s'. OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4 * upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test. OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0 * Remove workarounds for OpenSSL missing AES-GCM. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES GCM mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have GCM, so this is no longer needed. ok djm@ * Remove workarounds for OpenSSL missing AES-CTR. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES CTR mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have CTR, so this is no longer needed. ok djm@ * Do not link scp, sftp and sftp-server w/ zlib. Some of our binaries (eg sftp, sftp-server, scp) do not interact with the channels code and thus do use libraries such as zlib and libcrypto although they are linked with them. This adds a CHANNELLIBS and starts by moving zlib into it, which means the aformentioned binaries are no longer linked against zlib. ok djm@ * Group libcrypto and PRNGD checks together. They're related more than the libcrypt or libiaf checks which are currently between them. ok djm@ * Remove seed_rng calls from scp, sftp, sftp-server. These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@ * Move libcrypto into CHANNELLIBS. This will result in sftp, sftp-server and scp no longer being linked against libcrypto. ok djm@ * Move stale-configure check as early as possible. We added a check in Makefile to catch the case where configure needs to be rebuilt, however this did not happen until a build was attempted in which case all of the work done by configure was wasted. Move this check to the start of configure to catch it as early as possible. ok djm@ * Remove deprecated MacOS 10.15 runners. * upstream: avoid double-free in error path introduced in r1.70; report and fix based on GHPR#332 by v-rzh ok dtucker@ OpenBSD-Commit-ID: 3d21aa127b1f37cfc5bdc21461db369a663a951f * Include CHANNEL and FIDO2 libs in configure output * Factor out getrnd() and rename to getentropy(). Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@. * compat code for fido_dev_is_winhello() Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * check_sk_options: add temporary WinHello workaround Up to libfido 1.10.0, WinHello advertises "clientPin" rather than "uv" capability. This is fixed in 1.11.0. For the time being, workaround it here. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * sk_sign: set FIDO2 uv attribute explicitely for WinHello WinHello via libfido2 performs user verification by default. However, if we stick to that, there's no way to differentiate between keys created with or without "-O verify-required". Set FIDO2 uv attribute explicitely to FIDO_OPT_FALSE, then check if user verification has been requested. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: don't prompt for FIDO passphrase before attempting to enroll the credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@ OpenBSD-Commit-ID: bd5342ffc353ee37d39617906867c305564d1ce2 * Give unused param a name. Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello. * Actually put HAVE_STDINT_H around the stdint.h. * Rename our getentropy to prevent possible loops. Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@ * Test hostbased auth on github runners. * fix SANDBOX_SECCOMP_FILTER_DEBUG * Fix conditional for running hostbased tests. * upstream: allow certificate validity intervals, sshsig verification times and authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13 * upstream: add some tests for parse_absolute_time(), including cases where it is forced to the UTC timezone. bz3468 ok dtucker OpenBSD-Regress-ID: ea07ca31c2f3847a38df028ca632763ae44e8759 * Skip hostbased during Valgrind tests. Valgrind doesn't let ssh exec ssh-keysign (because it's setuid) so skip it during the Valgrind based tests. See https://bugs.kde.org/show_bug.cgi?id=119404 for a discussion of this (ironically there the problematic binary was ssh(1) back when it could still be setuid). * Rerun tests if any .github config file changes. * Add a timegm implementation from Heimdal via Samba. Fixes build on (at least Solaris 10). * Replace deprecated ubuntu-18.04 runners with 22.04 * upstream: sftp-server: support home-directory request Add support to the sftp-server for the home-directory extension defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the existing expand-path@openssh.com, but uses a more official protocol name, and so is a bit more likely to be implemented by non-OpenSSH clients. From Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: bfc580d05cc0c817831ae7ecbac4a481c23566ab * fido_dev_is_winhello: return 0, not "false" "false" is not used anywhere in OpenSSH, so return 0 like everywhere else. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * Revert "check_sk_options: add temporary WinHello workaround" Cygwin now comes with libfido2 1.11.0, so this workaround isn't required anymore. This reverts commit 242c044ab111a37aad3b0775727c36a4c5f0102c. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: use .Cm for "sign"; from josiah frentsos OpenBSD-Commit-ID: 7f80a53d54857ac6ae49ea6ad93c5bd12231d1e4 * upstream: add an extra flag to sk_probe() to indicate whether we're probing for a FIDO resident key or not. Unused here, but will make like easier for portable OpenBSD-Commit-ID: 432c8ff70e270378df9dbceb9bdeaa5b43b5a832 * on Cygwin, prefer WinHello FIDO device If no FIDO device was explictly specified, then prefer the windows://hello FIDO device. An exception to this is when probing resident FIDO keys, in which case hardware FIDO devices are preferred. * Check for perms to run agent-getpeereid test. Ubuntu 22.04 defaults to private home dirs which prevents "nobody" running ssh-add during the agent-getpeereid test. Check for this and add the necessary permissions. * upstream: double free() in error path; from Eusgor via GHPR333 OpenBSD-Commit-ID: 39f35e16ba878c8d02b4d01d8826d9b321be26d4 * Add Cygwin (on windows-2019) test target. In addition to installing the requisite Cygwin packages, we also need to explicitly invoke "sh" for steps that run other scripts since the runner environment doesn't understand #! paths. * Add a bit more debug output. * Fix cygwin conditional steps. * upstream: Strictly enforce the maximum allowed SSH2 banner size in ssh-keyscan and prevent a one-byte buffer overflow. Patch from Qualys, ok djm@ OpenBSD-Commit-ID: 6ae664f9f4db6e8a0589425f74cd0bbf3aeef4e4 * upstream: remove incorrect check that can break enrolling a resident key (introduced in r1.40) OpenBSD-Commit-ID: 4cab364d518470e29e624af3d3f9ffa9c92b6f01 * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * fix pester test failures * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * define HAVE_KILLPG * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * add debug on appveyor * add sleep to pester test * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * fix 9.1 compilation errors * disable -p pester tests due to unreliability on older Windows versions * remove extra sleep time from debugging scp pester tests * modify -p tests to only run for Windows OS version 10 and above * add windows specific code back into method moved from auth.c to auth2-pubkeyfile.c * add preprocessor for WinHello * revert preprocessor definition for winhello * add windows preprocessor definition in key_lookup * remove rdp block from appveyor since we are no longer debugging * add ifdef to sftp-server.c * make key_lookup compatible with winhello * appveyor.yml * increase debug of failing pester test * add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed * modify new scp.sh tests for windows * remove in place tests from scp.sh * remove rdp debug from appveyor * retrigger appveyor * change check of OS version in scp test Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: naddy@openbsd.org <naddy@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: tj@openbsd.org <tj@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: florian@openbsd.org <florian@openbsd.org> Co-authored-by: markus@openbsd.org <markus@openbsd.org> Co-authored-by: Tobias Heider <me@tobhe.de> Co-authored-by: anton@openbsd.org <anton@openbsd.org> Co-authored-by: Tim Rice <tim@multitalents.net> Co-authored-by: tobhe@openbsd.org <tobhe@openbsd.org> Co-authored-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org>
2022-11-02 17:06:45 +01:00
if ((r = private2_check_padding(prvbuf)) != 0)
goto out;
/* Swap the parsed key back into place */
tmp = *kswap;
*kswap = *k;
*k = tmp;
/* success */
r = 0;
out:
cipher_free(cctx);
explicit_bzero(keyiv, sizeof(keyiv));
explicit_bzero(&tmp, sizeof(tmp));
sshkey_free(kswap);
sshbuf_free(prvbuf);
return r;
}
static int
cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf)
{
struct sshbuf *principals = NULL, *crit = NULL;
struct sshbuf *exts = NULL, *ca = NULL;
u_char *sig = NULL;
size_t signed_len = 0, slen = 0, kidlen = 0;
int ret = SSH_ERR_INTERNAL_ERROR;
/* Copy the entire key blob for verification and later serialisation */
if ((ret = sshbuf_putb(key->cert->certblob, certbuf)) != 0)
return ret;
/* Parse body of certificate up to signature */
if ((ret = sshbuf_get_u64(b, &key->cert->serial)) != 0 ||
(ret = sshbuf_get_u32(b, &key->cert->type)) != 0 ||
(ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 ||
(ret = sshbuf_froms(b, &principals)) != 0 ||
(ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 ||
(ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 ||
(ret = sshbuf_froms(b, &crit)) != 0 ||
(ret = sshbuf_froms(b, &exts)) != 0 ||
(ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0 ||
(ret = sshbuf_froms(b, &ca)) != 0) {
/* XXX debug print error for ret */
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* Signature is left in the buffer so we can calculate this length */
signed_len = sshbuf_len(key->cert->certblob) - sshbuf_len(b);
if ((ret = sshbuf_get_string(b, &sig, &slen)) != 0) {
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
if (key->cert->type != SSH2_CERT_TYPE_USER &&
key->cert->type != SSH2_CERT_TYPE_HOST) {
ret = SSH_ERR_KEY_CERT_UNKNOWN_TYPE;
goto out;
}
/* Parse principals section */
while (sshbuf_len(principals) > 0) {
char *principal = NULL;
char **oprincipals = NULL;
if (key->cert->nprincipals >= SSHKEY_CERT_MAX_PRINCIPALS) {
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
if ((ret = sshbuf_get_cstring(principals, &principal,
NULL)) != 0) {
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
oprincipals = key->cert->principals;
key->cert->principals = recallocarray(key->cert->principals,
key->cert->nprincipals, key->cert->nprincipals + 1,
sizeof(*key->cert->principals));
if (key->cert->principals == NULL) {
free(principal);
key->cert->principals = oprincipals;
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
key->cert->principals[key->cert->nprincipals++] = principal;
}
/*
* Stash a copies of the critical options and extensions sections
* for later use.
*/
if ((ret = sshbuf_putb(key->cert->critical, crit)) != 0 ||
(exts != NULL &&
(ret = sshbuf_putb(key->cert->extensions, exts)) != 0))
goto out;
/*
* Validate critical options and extensions sections format.
*/
while (sshbuf_len(crit) != 0) {
if ((ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0 ||
(ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0) {
sshbuf_reset(key->cert->critical);
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
}
while (exts != NULL && sshbuf_len(exts) != 0) {
if ((ret = sshbuf_get_string_direct(exts, NULL, NULL)) != 0 ||
(ret = sshbuf_get_string_direct(exts, NULL, NULL)) != 0) {
sshbuf_reset(key->cert->extensions);
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
}
/* Parse CA key and check signature */
if (sshkey_from_blob_internal(ca, &key->cert->signature_key, 0) != 0) {
ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
goto out;
}
if (!sshkey_type_is_valid_ca(key->cert->signature_key->type)) {
ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
goto out;
}
if ((ret = sshkey_verify(key->cert->signature_key, sig, slen,
sshbuf_ptr(key->cert->certblob), signed_len, NULL, 0, NULL)) != 0)
goto out;
if ((ret = sshkey_get_sigtype(sig, slen,
&key->cert->signature_type)) != 0)
goto out;
/* Success */
ret = 0;
out:
sshbuf_free(ca);
sshbuf_free(crit);
sshbuf_free(exts);
sshbuf_free(principals);
free(sig);
return ret;
}
Merge 9.1 (#626) * upstream: fix poll() spin when a channel's output fd closes without data in the channel buffer. Introduce more exact packing of channel fds into the pollfd array. fixes bz3405 and bz3411; ok deraadt@ markus@ OpenBSD-Commit-ID: 06740737849c9047785622ad5d472cb6a3907d10 * upstream: select post-quantum KEX sntrup761x25519-sha512@openssh.com as the default; ok markus@ OpenBSD-Commit-ID: f02d99cbfce22dffec2e2ab1b60905fbddf48fb9 * upstream: add support for the "corp-data" protocol extension to allow server-side copies to be performed without having to go via the client. Patch by Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: 00aa510940fedd66dab1843b58682de4eb7156d5 * upstream: add a sftp client "cp" command that supports server-side copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444 * depend * Skip slow tests on (very) slow test targets. * Set Makefile SHELL as determined by configure. This should improve compatibility for users with non-POSIX shells. If using Makefile.in directly (eg make -f Makefile.in distprep) then SHELL will need to be specified on the command line (along with MANFMT in that particular case). ok djm@ * Use bash or ksh if available for SH in Makefile. * Increase test timeout to allow slow VMs to finish * Only run regression tests on slow VMs. * Only return events from ppoll that were requested. If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@ * Specify TEST_SHELL=bash on AIX. The system shells cause the agent-restrict test to fail due to some quoting so explicitly specify bash until we can get configure to autmatically work around that. * Disable security key on fbsd6 test host. * upstream: man pages: add missing commas between subordinate and main clauses jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@ OpenBSD-Commit-ID: 9520801729bebcb3c9fe43ad7f9776ab4dd05ea3 * upstream: ssh: document sntrup761x25519-sha512@openssh.com as default KEX OpenBSD-Commit-ID: 12545bfa10bcbf552d04d9d9520d0f4e98b0e171 * upstream: openssh-9.0 OpenBSD-Commit-ID: 0dfb461188f4513ec024c1534da8c1ce14c20b64 * update version numbers for release * update build-aux files to match autoconf-2.71 i.e. config.guess, config.sub and install-sh * Revert "update build-aux files to match autoconf-2.71" This reverts commit 0a8ca39fac6ad19096b6c263436f8b2dd51606f2. It turns out that the checked-in copies of these files are actually newer than autoconf-2.71's copies, so this was effectively a downgrade. Spotted by Bo Anderson via github * upstream: two defensive changes from Tobias Stoeckmann via GHPR287 enforce stricter invarient for sshbuf_set_parent() - never allow a buffer to have a previously-set parent changed. In sshbuf_reset(), if the reallocation fails, then zero the entire buffer and not the (potentially smaller) default initial alloc size. OpenBSD-Commit-ID: 14583203aa5d50ad38d2e209ae10abaf8955e6a9 * upstream: Note that curve25519-sha256 was later published in RFC8731. ok djm@ OpenBSD-Commit-ID: 2ac2b5d642d4cf5918eaec8653cad9a4460b2743 * upstream: clear io_want/io_ready flags at start of poll() cycle; avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@ OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967 * Retire fbsd6 test VM. It's long since out of support, relatively slow (it's i686) and the compiler has trouble with PIE. * Resync moduli.5 with upstream. 1.18: remove duplicate publication year; carsten dot kunze at arcor dot de 1.19: ssh-keygen's -G/-T have been replaced with -M generate/screen. * upstream: Correct path for system known hosts file in description of IgnoreUserKnownHosts. Patch from Martin Vahlensieck via tech@ OpenBSD-Commit-ID: 9b7784f054fa5aa4d63cb36bd563889477127215 * upstream: list the correct version number for when usage of the sftp protocol became default and fix a typo from ed maste OpenBSD-Commit-ID: 24e1795ed2283fdeacf16413c2f07503bcdebb31 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: Try to continue running local I/O for channels in state OPEN during SSH transport rekeying. The most visible benefit is that it should make ~-escapes work in the client (e.g. to exit) if the connection happened to have stalled during a rekey event. Based work by and ok dtucker@ OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: regression test for sftp cp command OpenBSD-Regress-ID: c96bea9edde3a384b254785e7f9b2b24a81cdf82 * upstream: Simplify forward-control test. Since we no longer need to support SSH1 we don't need to run shell commands on the other end of the connection and can use ssh -N instead. This also makes the test less racy. OpenBSD-Regress-ID: 32e94ce272820cc398f30b848b2b0f080d10302c * upstream: Use ssh -f and ControlPersist .. to start up test forwards and ssh -O stop to shut them down intead of sleep loops. This speeds up the test by an order of magnitude. OpenBSD-Regress-ID: eb3db5f805100919b092a3b2579c611fba3e83e7 * upstream: It looks like we can't completely avoid waiting for processes to exit so retrieve the pid via controlmaster and use that. OpenBSD-Regress-ID: 8246f00f22b14e49d2ff1744c94897ead33d457b * Cache timezone data in capsicum sandbox. From emaste at freebsd.org, originally part of FreeBSD commit r339216 / fc3c19a9 with autoconf bits added by me. * Include stdlib.h for free() prototype. ... which is used inside the CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG block. * Update OpenSSL and LibreSSL versions in tests. * Add debian-riscv64 test target. * upstream: Avoid an unnecessary xstrdup in rm_env() when matching patterns. Since match_pattern() doesn't modify its arguments (they are const), there is no need to make an extra copy of the strings in options->send_env. From Martin Vahlensieck OpenBSD-Commit-ID: 2c9db31e3f4d3403b49642c64ee048b2a0a39351 * upstream: Add missing includes of stdlib.h and stdint.h. We need stdlib.h for malloc(3) and stdint.h for SIZE_MAX. Unlike the other xmss files, ssh-xmss.c does not include xmss_commons.h so ssh-xmss.c must include those headers itself. From Martin Vahlensieck OpenBSD-Commit-ID: 70e28a9818cee3da1be2ef6503d4b396dd421e6b * upstream: Remove unnecessary includes: openssl/hmac.h and openssl/evp.h. From Martin Vahlensieck. OpenBSD-Commit-ID: a6debb5fb0c8a44e43e8d5ca7cc70ad2f3ea31c3 * upstream: Check sshauthopt_new() for NULL. bz#3425, from tessgauthier at microsoft.com. ok djm@ OpenBSD-Commit-ID: af0315bc3e44aa406daa7e0ae7c2d719a974483f * upstream: Add authfd path to debug output. ok markus@ OpenBSD-Commit-ID: f735a17d1a6f2bee63bfc609d76ef8db8c090890 * upstream: avoid printing hash algorithm twice; from lucas AT sexy.is OpenBSD-Commit-ID: 9d24671e10a84141b7c504396cabad600e47a941 * upstream: fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@ OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e * upstream: Don't leak SK device. Patch from Pedro Martelletto via github PR#316. ok djm@ OpenBSD-Commit-ID: 17d11327545022e727d95fd08b213171c5a4585d * upstream: mention that the helpers are used by ssh(1), ssh-agent(1) and ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto OpenBSD-Commit-ID: 30f880f989d4b329589c1c404315685960a5f153 * Remove now-empty int32_minmax.inc. * Only run tests when source files change. Also run tests on changes to V_9_0 branch. * Add Mac OS X 12 test target. * upstream: be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ OpenBSD-Commit-ID: e267746c047ea86665cdeccef795a8a56082eeb2 * upstream: fix some integer overflows in sieve_large() that show up when trying to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@ OpenBSD-Commit-ID: 81cbc6dd3a21c57bd6fadea10e44afe37bca558e * upstream: remove an obsolete rsa1 format example from an example; from megan batty ok djm OpenBSD-Commit-ID: db2c89879c29bf083df996bd830abfb1e70d62bf * upstream: Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. The wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy OpenBSD-Commit-ID: dd98748d7644df048f78dcf793b3b63db9ab1d25 * upstream: make sure stdout is non-blocking; ok djm@ OpenBSD-Commit-ID: 64940fffbd1b882eda2d7c8c7a43c79368309c0d * upstream: mux.c: mark argument as const; from Martin Vahlensieck OpenBSD-Commit-ID: 69a1a93a55986c7c2ad9f733c093b46a47184341 * upstream: channel_new no longer frees remote_name. So update the comment accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck OpenBSD-Commit-ID: e4e10dc8dc9f40c166ea5a8e991942bedc75a76a * upstream: sshkey_unshield_private() contains a exact duplicate of the code in private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@ OpenBSD-Commit-ID: 876884c3f0e62e8fd8d1594bab06900f971c9c85 * Add ubsan minimal testcase on OpenBSD. As suggested by djm@. * Note that, for now, we need variadic macros. * Also retest OpenBSD upstream on .yml changes. * upstream: When performing operations that glob(3) a remote path, ensure that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef * Remove duplicate bcrypt_pbkdf.o from Makefile bcrypt_pbkdf.o is duplicated in the openbsd-compat Makefile's object file list. * upstream: improve error message when 'ssh-keygen -Y sign' is unable to load a private key; bz3429, reported by Adam Szkoda ok dtucker@ OpenBSD-Commit-ID: bb57b285e67bea536ef81b1055467be2fc380e74 * upstream: Allow existing -U (use agent) flag to work with "-Y sign" operations, where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@ OpenBSD-Commit-ID: a7bc69873b99c32c42c7628ed9ea91565ba08c2f * upstream: Remove errant apostrophe. From haruyama at queen-ml org. OpenBSD-Commit-ID: dc6b294567cb84b384ad6ced9ca469f2bbf0bd10 * upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 * upstream: fix in-place copies; r1.163 incorrectly skipped truncation in all cases, not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@ OpenBSD-Commit-ID: b189f19cd68119548c8e24e39c79f61e115bf92c * upstream: Only run agent-ptrace.sh if gdb is available as all architectures do not ship with gdb. OpenBSD-Regress-ID: ec53e928803e6b87f9ac142d38888ca79a45348d * upstream: regress test for in-place transfers and clobbering larger files with smaller ones; would have caught last regression in scp(1) OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2 * configure.ac: Add missing AC_DEFINE for caph_cache_tzdata test causing HAVE_CAPH_CACHE_TZDATA to be missing from config.h.in. Spotted by Bryan Drewery * upstream: make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via #define) dump to stderr rather than stdout OpenBSD-Commit-ID: 10298513ee32db8390aecb0397d782d68cb14318 * upstream: revert previous; it was broken (spotted by Theo) OpenBSD-Commit-ID: 457c79afaca2f89ec2606405c1059b98b30d8b0d * upstream: Note that ProxyJump also accepts the same tokens as ProxyCommand. From pallxk via github PR#305. OpenBSD-Commit-ID: 7115ac351b129205f1f1ffa6bbfd62abd76be7c5 * upstream: Avoid kill with -1 argument. The out_ctx label can be reached before fork has been called. If this happens, then kill -1 would be called, sending SIGTERM to all processes reachable by the current process. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8 * upstream: f sshpkt functions fail, then password is not cleared with freezero. Unconditionally call freezero to guarantee that password is removed from RAM. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6b093619c9515328e25b0f8093779c52402c89cd * upstream: refactor authorized_keys/principals handling remove "struct ssh *" from arguments - this was only used to pass the remote host/address. These can be passed in instead and the resulting code is less tightly coupled to ssh_api.[ch] ok dtucker@ OpenBSD-Commit-ID: 9d4373d013edc4cc4b5c21a599e1837ac31dda0d * upstream: split the low-level file handling functions out from auth2-pubkey.c Put them in a new auth2-pubkeyfile.c to make it easier to refer to them (e.g. in unit/fuzz tests) without having to refer to everything else pubkey auth brings in. ok dtucker@ OpenBSD-Commit-ID: 3fdca2c61ad97dc1b8d4a7346816f83dc4ce2217 * fuzzer for authorized_keys parsing mostly redundant to authopt_fuzz, but it's sensitive code so IMO it makes sense to test this layer too * Test against LibreSSL 3.5.3. * Test against OpenSSL 1.1.1o and 3.0.3. * fix some bugs in the fuzzer * upstream: keywords ref ssh_config.5; from caspar schutijser OpenBSD-Commit-ID: f146a19d7d5c9374c3b9c520da43b2732d7d1a4e * upstream: ssh-keygen: implement "verify-required" certificate option. This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@ OpenBSD-Commit-ID: f660f973391b593fea4b7b25913c9a15c3eb8a06 * upstream: ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303 from jsegitz with man page text from jmc@, ok markus@ djm@ OpenBSD-Commit-ID: 5c4c57bdd7063ff03381cfb6696659dd3f9f5b9f * upstream: Add period at end of "not known by any other names" message. github PR#320 from jschauma, ok djm@ OpenBSD-Commit-ID: bd60809803c4bfd3ebb7c5c4d918b10e275266f2 * upstream: Add missing *-sk types to ssh-keyscan manpage. From skazi0 via github PR#294. OpenBSD-Commit-ID: fda2c869cdb871f3c90a89fb3f985370bb5d25c0 * upstream: Make SetEnv directives first-match-wins in both sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b * upstream: test setenv in both client and server, test first-match-wins too OpenBSD-Regress-ID: 4c8804f9db38a02db480b9923317457b377fe34b * upstream: move auth_openprincipals() and auth_openkeyfile() over to auth2-pubkeyfile.c too; they make more sense there. OpenBSD-Commit-ID: 9970d99f900e1117fdaab13e9e910a621b7c60ee * upstream: make sure that UseDNS hostname lookup happens in the monitor and not in the pledge(2)'d unprivileged process; fixes regression caused by recent refactoring spotted by henning@ OpenBSD-Commit-ID: a089870b95101cd8881a2dff65b2f1627d13e88d * fix possible NULL deref when built without FIDO Analysis/fix from kircher in bz3443; ok dtucker@ * automatically enable built-in FIDO support If libfido2 is found and usable, then enable the built-in security key support unless --without-security-key-builtin was requested. ok dtucker@ * upstream: Log an error if pipe() fails while accepting a connection. bz#3447, from vincent-openssh at vinc17 net, ok djm@ OpenBSD-Commit-ID: 9d59f19872b94900a5c79da2d57850241ac5df94 * upstream: Don't attempt to fprintf a null identity comment. From Martin Vahlensieck via tech@. OpenBSD-Commit-ID: 4c54d20a8e8e4e9912c38a7b4ef5bfc5ca2e05c2 * upstream: Make sure not to fclose() the same fd twice in case of an error. ok dtucker@ OpenBSD-Commit-ID: e384c4e05d5521e7866b3d53ca59acd2a86eef99 * upstream: make it clear that RekeyLimit applies to both transmitted and received data. GHPR#328 from Jan Pazdziora OpenBSD-Commit-ID: d180a905fec9ff418a75c07bb96ea41c9308c3f9 * request 1.1x API compatibility for OpenSSL >=3.x idea/patch from Pedro Martelletto via GHPR#322; ok dtucker@ * fix broken case statement in previous * Disable SK support if FIDO libs not found. * Zero out LIBFIDO2 when SK support not usable. Prevents us from trying to link them into ssh-sk-helper and failing to build. * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ OpenBSD-Commit-ID: b2f6e5f60f2bba293b831654328a8a0035ef4a1b * upstream: Roll back previous KEX changes as they aren't safe until compat_pkalg_proposal and friends always allocate their returned strings. Reported by Qualys. OpenBSD-Commit-ID: 1c7a88a0d5033f42f88ab9bec58ef1cf72c81ad0 * upstream: allow arguments to sftp -D option, e.g. sftp -D "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce * Update OpenSSL tests to the most recent releases. * upstream: reflect the update to -D arg name in usage(); OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c * upstream: ignore SIGPIPE earlier in main(), specifically before muxclient() which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@ OpenBSD-Commit-ID: 63d8e13276869eebac6d7a05d5a96307f9026e47 * upstream: Always return allocated strings from the kex filtering so that we can free them later. Fix one leak in compat_kex_proposal. Based on github PR#324 from ZoltanFridrich with some simplications by me. ok djm@ OpenBSD-Commit-ID: 9171616da3307612d0ede086fd511142f91246e4 * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ This is a roll-forward of the previous rollback now that the required changes in compat.c have been done. OpenBSD-Commit-ID: c7cd93730b3b9f53cdad3ae32462922834ef73eb * upstream: bump up loglevel from debug to info when unable to open authorized keys/principals file for errno != ENOENT; bz2042 ok dtucker OpenBSD-Commit-ID: e79aa550d91ade6a80f081bda689da24c086d66b * Skip select+rlimit check if sandboxing is disabled It's not needed in that case, and the test can fail when being built with some compiler memory sanitizer flags. bz#3441 * upstream: use consistent field names (s/char/byte) in format description OpenBSD-Commit-ID: 3de33572733ee7fcfd7db33d37db23d2280254f0 * upstream: Remove leftover line. Remove extra line leftover from merge conflict. ok djm@ OpenBSD-Commit-ID: 460e2290875d7ae64971a7e669c244b1d1c0ae2e * Move checks for pollfd.fd and nfds_t. Move the checks for struct pollfd.fd and nfds_t to before the sandboxing checks. This groups all the sandbox checks together so we can skip them all when sandboxing is disabled. * Skip all rlimit tests when sandboxing disabled. The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no. * Add clang sanitizer tests. * upstream: Add TEST_REGRESS_CACHE_DIR. If set, it is used to cache regress test names that have succeeded and skip those on a re-run. OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247 * Move sanitizer logs into regress for collection. * Add GCC address sanitizer build/test. * Update sanitizer test targets: - remove clang-sanitize-memory for now. It takes so long that the test times out. - add gcc sanitize-address and sanitize-undefined test targets. * Test against openssl-3.0.5. * Move unset to before we set anything. * Refuse to use OpenSSL 3.0.4 due to potential RCE. OpenSSL has a potential RCE in its RSA implementation (CVE-2022-2274) so refuse to use that specific version. * Capture stderr output from configure. * Only refuse to use OpenSSL 3.0.4 on x86_64. The potential RCE only impacts x86_64, so only refuse to use it if we're targetting a potentially impacted architecture. ok djm@ * Remove special casing of crypt(). Configure goes to some lengths to pick crypt() from either libcrypt or OpenSSL's libcrypto because they can more or less featureful (eg supporting md5-style passwords). OpenSSL removed its crypt() interface in 2002: https://github.com/openssl/openssl/commit/69deec58 so these hijinks should no longer be necessary. This also only links sshd with libcrypt which is the only thing that needs it. ok djm@ * Clarify README.md text. Clarify the text about the implications of building without OpenSSL, and prefix the "configure --help" example command with a "./" so it's likely to work as-is in more shells. From bz#3461. * Split README.platform into its own line. README.platform has general platform-specific information, having it following text about FIDO2 on the same line could imply that it only has information about FIDO2. * Return ERANGE from getcwd() if buffer size is 1. If getcwd() is supplied a buffer size of exactly 1 and a path of "/", it could result in a nul byte being written out of array bounds. POSIX says it should return ERANGE if the path will not fit in the available buffer (with terminating nul). 1 byte cannot fit any possible path with its nul, so immediately return ERANGE in that case. OpenSSH never uses getcwd() with this buffer size, and all current (and even quite old) platforms that we are currently known to work on have a native getcwd() so this code is not used on those anyway. Reported by Qualys, ok djm@ * Remove unintended changes. I inadvertently included a couple of local changes with the OpenSSL 3.0.4 change. Revert, anything that should be there will be committed separately. * Add AUDIT_ARCH_PPC to supported seccomp arches. Patch from dries.deschout at dodeco.eu. * Rename bbone test target to ARM. * Move vmshutdown to first step. If a previous run on a physical runner has failed to clean up, the next run will fail because it'll try to check out the code to a broken directory mount. Make cleanup the first step. * upstream: pull passphrase reading and confirmation into a separate function so it can be used for FIDO2 PINs; no functional change OpenBSD-Commit-ID: bf34f76b8283cc1d3f54633e0d4f13613d87bb2f * upstream: when enrolling a resident key on a security token, check if a credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust OpenBSD-Commit-ID: e45e9f1bf2b2f32d9850669e7a8dbd64acc5fca4 * upstream: sk-usbhid: preserve error code returned by key_lookup() it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b * upstream: ssh-keygen: fix touch prompt, pin retries; part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: 75d1005bd2ef8f29fa834c90d2684e73556fffe8 * crank SSH_SK_VERSION_MAJOR in sk-dummy.so * Skip scp3 test if there's no scp on remote path. scp -3 ends up using the scp that's in the remote path and will fail if one is not available. Based on a patch from rapier at psc.edu. * Convert "have_prog" function into "which". "which" and its behaviour is not standardized, so convert the existing have_prog function into "which" so we can rely on it being available and what its semantics are. Add a have_prog wrapper that maintains the existing behaviour. * upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not executable. No-op on most platforms but should prevent warnings in -portable on systems that don't have 'date %s'. OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4 * upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test. OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0 * Remove workarounds for OpenSSL missing AES-GCM. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES GCM mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have GCM, so this is no longer needed. ok djm@ * Remove workarounds for OpenSSL missing AES-CTR. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES CTR mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have CTR, so this is no longer needed. ok djm@ * Do not link scp, sftp and sftp-server w/ zlib. Some of our binaries (eg sftp, sftp-server, scp) do not interact with the channels code and thus do use libraries such as zlib and libcrypto although they are linked with them. This adds a CHANNELLIBS and starts by moving zlib into it, which means the aformentioned binaries are no longer linked against zlib. ok djm@ * Group libcrypto and PRNGD checks together. They're related more than the libcrypt or libiaf checks which are currently between them. ok djm@ * Remove seed_rng calls from scp, sftp, sftp-server. These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@ * Move libcrypto into CHANNELLIBS. This will result in sftp, sftp-server and scp no longer being linked against libcrypto. ok djm@ * Move stale-configure check as early as possible. We added a check in Makefile to catch the case where configure needs to be rebuilt, however this did not happen until a build was attempted in which case all of the work done by configure was wasted. Move this check to the start of configure to catch it as early as possible. ok djm@ * Remove deprecated MacOS 10.15 runners. * upstream: avoid double-free in error path introduced in r1.70; report and fix based on GHPR#332 by v-rzh ok dtucker@ OpenBSD-Commit-ID: 3d21aa127b1f37cfc5bdc21461db369a663a951f * Include CHANNEL and FIDO2 libs in configure output * Factor out getrnd() and rename to getentropy(). Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@. * compat code for fido_dev_is_winhello() Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * check_sk_options: add temporary WinHello workaround Up to libfido 1.10.0, WinHello advertises "clientPin" rather than "uv" capability. This is fixed in 1.11.0. For the time being, workaround it here. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * sk_sign: set FIDO2 uv attribute explicitely for WinHello WinHello via libfido2 performs user verification by default. However, if we stick to that, there's no way to differentiate between keys created with or without "-O verify-required". Set FIDO2 uv attribute explicitely to FIDO_OPT_FALSE, then check if user verification has been requested. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: don't prompt for FIDO passphrase before attempting to enroll the credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@ OpenBSD-Commit-ID: bd5342ffc353ee37d39617906867c305564d1ce2 * Give unused param a name. Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello. * Actually put HAVE_STDINT_H around the stdint.h. * Rename our getentropy to prevent possible loops. Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@ * Test hostbased auth on github runners. * fix SANDBOX_SECCOMP_FILTER_DEBUG * Fix conditional for running hostbased tests. * upstream: allow certificate validity intervals, sshsig verification times and authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13 * upstream: add some tests for parse_absolute_time(), including cases where it is forced to the UTC timezone. bz3468 ok dtucker OpenBSD-Regress-ID: ea07ca31c2f3847a38df028ca632763ae44e8759 * Skip hostbased during Valgrind tests. Valgrind doesn't let ssh exec ssh-keysign (because it's setuid) so skip it during the Valgrind based tests. See https://bugs.kde.org/show_bug.cgi?id=119404 for a discussion of this (ironically there the problematic binary was ssh(1) back when it could still be setuid). * Rerun tests if any .github config file changes. * Add a timegm implementation from Heimdal via Samba. Fixes build on (at least Solaris 10). * Replace deprecated ubuntu-18.04 runners with 22.04 * upstream: sftp-server: support home-directory request Add support to the sftp-server for the home-directory extension defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the existing expand-path@openssh.com, but uses a more official protocol name, and so is a bit more likely to be implemented by non-OpenSSH clients. From Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: bfc580d05cc0c817831ae7ecbac4a481c23566ab * fido_dev_is_winhello: return 0, not "false" "false" is not used anywhere in OpenSSH, so return 0 like everywhere else. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * Revert "check_sk_options: add temporary WinHello workaround" Cygwin now comes with libfido2 1.11.0, so this workaround isn't required anymore. This reverts commit 242c044ab111a37aad3b0775727c36a4c5f0102c. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: use .Cm for "sign"; from josiah frentsos OpenBSD-Commit-ID: 7f80a53d54857ac6ae49ea6ad93c5bd12231d1e4 * upstream: add an extra flag to sk_probe() to indicate whether we're probing for a FIDO resident key or not. Unused here, but will make like easier for portable OpenBSD-Commit-ID: 432c8ff70e270378df9dbceb9bdeaa5b43b5a832 * on Cygwin, prefer WinHello FIDO device If no FIDO device was explictly specified, then prefer the windows://hello FIDO device. An exception to this is when probing resident FIDO keys, in which case hardware FIDO devices are preferred. * Check for perms to run agent-getpeereid test. Ubuntu 22.04 defaults to private home dirs which prevents "nobody" running ssh-add during the agent-getpeereid test. Check for this and add the necessary permissions. * upstream: double free() in error path; from Eusgor via GHPR333 OpenBSD-Commit-ID: 39f35e16ba878c8d02b4d01d8826d9b321be26d4 * Add Cygwin (on windows-2019) test target. In addition to installing the requisite Cygwin packages, we also need to explicitly invoke "sh" for steps that run other scripts since the runner environment doesn't understand #! paths. * Add a bit more debug output. * Fix cygwin conditional steps. * upstream: Strictly enforce the maximum allowed SSH2 banner size in ssh-keyscan and prevent a one-byte buffer overflow. Patch from Qualys, ok djm@ OpenBSD-Commit-ID: 6ae664f9f4db6e8a0589425f74cd0bbf3aeef4e4 * upstream: remove incorrect check that can break enrolling a resident key (introduced in r1.40) OpenBSD-Commit-ID: 4cab364d518470e29e624af3d3f9ffa9c92b6f01 * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * fix pester test failures * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * define HAVE_KILLPG * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * add debug on appveyor * add sleep to pester test * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * fix 9.1 compilation errors * disable -p pester tests due to unreliability on older Windows versions * remove extra sleep time from debugging scp pester tests * modify -p tests to only run for Windows OS version 10 and above * add windows specific code back into method moved from auth.c to auth2-pubkeyfile.c * add preprocessor for WinHello * revert preprocessor definition for winhello * add windows preprocessor definition in key_lookup * remove rdp block from appveyor since we are no longer debugging * add ifdef to sftp-server.c * make key_lookup compatible with winhello * appveyor.yml * increase debug of failing pester test * add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed * modify new scp.sh tests for windows * remove in place tests from scp.sh * remove rdp debug from appveyor * retrigger appveyor * change check of OS version in scp test Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: naddy@openbsd.org <naddy@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: tj@openbsd.org <tj@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: florian@openbsd.org <florian@openbsd.org> Co-authored-by: markus@openbsd.org <markus@openbsd.org> Co-authored-by: Tobias Heider <me@tobhe.de> Co-authored-by: anton@openbsd.org <anton@openbsd.org> Co-authored-by: Tim Rice <tim@multitalents.net> Co-authored-by: tobhe@openbsd.org <tobhe@openbsd.org> Co-authored-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org>
2022-11-02 17:06:45 +01:00
int
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
sshkey_deserialize_sk(struct sshbuf *b, struct sshkey *key)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Parse additional security-key application string */
if (sshbuf_get_cstring(b, &key->sk_application, NULL) != 0)
return SSH_ERR_INVALID_FORMAT;
return 0;
}
static int
sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp,
int allow_cert)
{
int type, ret = SSH_ERR_INTERNAL_ERROR;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
char *ktype = NULL;
struct sshkey *key = NULL;
struct sshbuf *copy;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
#ifdef DEBUG_PK /* XXX */
sshbuf_dump(b, stderr);
#endif
if (keyp != NULL)
*keyp = NULL;
if ((copy = sshbuf_fromb(b)) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (sshbuf_get_cstring(b, &ktype, NULL) != 0) {
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
type = sshkey_type_from_name(ktype);
if (!allow_cert && sshkey_type_is_cert(type)) {
ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
goto out;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(type)) == NULL) {
ret = SSH_ERR_KEY_TYPE_UNKNOWN;
goto out;
}
if ((key = sshkey_new(type)) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (sshkey_type_is_cert(type)) {
/* Skip nonce that precedes all certificates */
if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((ret = impl->funcs->deserialize_public(ktype, b, key)) != 0)
goto out;
/* Parse certificate potion */
if (sshkey_is_cert(key) && (ret = cert_parse(b, key, copy)) != 0)
goto out;
if (key != NULL && sshbuf_len(b) != 0) {
ret = SSH_ERR_INVALID_FORMAT;
goto out;
}
ret = 0;
if (keyp != NULL) {
*keyp = key;
key = NULL;
}
out:
sshbuf_free(copy);
sshkey_free(key);
free(ktype);
return ret;
}
int
sshkey_from_blob(const u_char *blob, size_t blen, struct sshkey **keyp)
{
struct sshbuf *b;
int r;
if ((b = sshbuf_from(blob, blen)) == NULL)
return SSH_ERR_ALLOC_FAIL;
r = sshkey_from_blob_internal(b, keyp, 1);
sshbuf_free(b);
return r;
}
int
sshkey_fromb(struct sshbuf *b, struct sshkey **keyp)
{
return sshkey_from_blob_internal(b, keyp, 1);
}
int
sshkey_froms(struct sshbuf *buf, struct sshkey **keyp)
{
struct sshbuf *b;
int r;
if ((r = sshbuf_froms(buf, &b)) != 0)
return r;
r = sshkey_from_blob_internal(b, keyp, 1);
sshbuf_free(b);
return r;
}
int
sshkey_get_sigtype(const u_char *sig, size_t siglen, char **sigtypep)
{
int r;
struct sshbuf *b = NULL;
char *sigtype = NULL;
if (sigtypep != NULL)
*sigtypep = NULL;
if ((b = sshbuf_from(sig, siglen)) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshbuf_get_cstring(b, &sigtype, NULL)) != 0)
goto out;
/* success */
if (sigtypep != NULL) {
*sigtypep = sigtype;
sigtype = NULL;
}
r = 0;
out:
free(sigtype);
sshbuf_free(b);
return r;
}
/*
*
* Checks whether a certificate's signature type is allowed.
* Returns 0 (success) if the certificate signature type appears in the
* "allowed" pattern-list, or the key is not a certificate to begin with.
* Otherwise returns a ssherr.h code.
*/
int
sshkey_check_cert_sigtype(const struct sshkey *key, const char *allowed)
{
if (key == NULL || allowed == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if (!sshkey_type_is_cert(key->type))
return 0;
if (key->cert == NULL || key->cert->signature_type == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if (match_pattern_list(key->cert->signature_type, allowed, 0) != 1)
return SSH_ERR_SIGN_ALG_UNSUPPORTED;
return 0;
}
/*
* Returns the expected signature algorithm for a given public key algorithm.
*/
const char *
sshkey_sigalg_by_name(const char *name)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
int i;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
for (i = 0; keyimpls[i] != NULL; i++) {
impl = keyimpls[i];
if (strcmp(impl->name, name) != 0)
continue;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (impl->sigalg != NULL)
return impl->sigalg;
if (!impl->cert)
return impl->name;
return sshkey_ssh_name_from_type_nid(
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
sshkey_type_plain(impl->type), impl->nid);
}
return NULL;
}
/*
* Verifies that the signature algorithm appearing inside the signature blob
* matches that which was requested.
*/
int
sshkey_check_sigtype(const u_char *sig, size_t siglen,
const char *requested_alg)
{
const char *expected_alg;
char *sigtype = NULL;
int r;
if (requested_alg == NULL)
return 0;
if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0)
return r;
r = strcmp(expected_alg, sigtype) == 0;
free(sigtype);
return r ? 0 : SSH_ERR_SIGN_ALG_UNSUPPORTED;
}
int
sshkey_sign(struct sshkey *key,
u_char **sigp, size_t *lenp,
const u_char *data, size_t datalen,
const char *alg, const char *sk_provider, const char *sk_pin, u_int compat)
{
int was_shielded = sshkey_is_shielded(key);
int r2, r = SSH_ERR_INTERNAL_ERROR;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
if (sigp != NULL)
*sigp = NULL;
if (lenp != NULL)
*lenp = 0;
if (datalen > SSH_KEY_MAX_SIGN_DATA_SIZE)
return SSH_ERR_INVALID_ARGUMENT;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(key)) == NULL)
return SSH_ERR_KEY_TYPE_UNKNOWN;
if ((r = sshkey_unshield_private(key)) != 0)
return r;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (sshkey_is_sk(key)) {
r = sshsk_sign(sk_provider, key, sigp, lenp, data,
datalen, compat, sk_pin);
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
} else {
if (impl->funcs->sign == NULL)
r = SSH_ERR_SIGN_ALG_UNSUPPORTED;
else {
r = impl->funcs->sign(key, sigp, lenp, data, datalen,
alg, sk_provider, sk_pin, compat);
}
}
if (was_shielded && (r2 = sshkey_shield_private(key)) != 0)
return r2;
return r;
}
/*
* ssh_key_verify returns 0 for a correct signature and < 0 on error.
* If "alg" specified, then the signature must use that algorithm.
*/
int
sshkey_verify(const struct sshkey *key,
const u_char *sig, size_t siglen,
const u_char *data, size_t dlen, const char *alg, u_int compat,
struct sshkey_sig_details **detailsp)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
if (detailsp != NULL)
*detailsp = NULL;
if (siglen == 0 || dlen > SSH_KEY_MAX_SIGN_DATA_SIZE)
return SSH_ERR_INVALID_ARGUMENT;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(key)) == NULL)
return SSH_ERR_KEY_TYPE_UNKNOWN;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
return impl->funcs->verify(key, sig, siglen, data, dlen,
alg, compat, detailsp);
}
/* Convert a plain key to their _CERT equivalent */
int
sshkey_to_certified(struct sshkey *k)
{
int newtype;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((newtype = sshkey_type_certified(k->type)) == -1)
return SSH_ERR_INVALID_ARGUMENT;
if ((k->cert = cert_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
k->type = newtype;
return 0;
}
/* Convert a certificate to its raw key equivalent */
int
sshkey_drop_cert(struct sshkey *k)
{
if (!sshkey_type_is_cert(k->type))
return SSH_ERR_KEY_TYPE_UNKNOWN;
cert_free(k->cert);
k->cert = NULL;
k->type = sshkey_type_plain(k->type);
return 0;
}
/* Sign a certified key, (re-)generating the signed certblob. */
int
sshkey_certify_custom(struct sshkey *k, struct sshkey *ca, const char *alg,
const char *sk_provider, const char *sk_pin,
sshkey_certify_signer *signer, void *signer_ctx)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
struct sshbuf *principals = NULL;
u_char *ca_blob = NULL, *sig_blob = NULL, nonce[32];
size_t i, ca_len, sig_len;
int ret = SSH_ERR_INTERNAL_ERROR;
struct sshbuf *cert = NULL;
char *sigtype = NULL;
if (k == NULL || k->cert == NULL ||
k->cert->certblob == NULL || ca == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if (!sshkey_is_cert(k))
return SSH_ERR_KEY_TYPE_UNKNOWN;
if (!sshkey_type_is_valid_ca(ca->type))
return SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(k)) == NULL)
return SSH_ERR_INTERNAL_ERROR;
/*
* If no alg specified as argument but a signature_type was set,
* then prefer that. If both were specified, then they must match.
*/
if (alg == NULL)
alg = k->cert->signature_type;
else if (k->cert->signature_type != NULL &&
strcmp(alg, k->cert->signature_type) != 0)
return SSH_ERR_INVALID_ARGUMENT;
/*
* If no signing algorithm or signature_type was specified and we're
* using a RSA key, then default to a good signature algorithm.
*/
if (alg == NULL && ca->type == KEY_RSA)
alg = "rsa-sha2-512";
if ((ret = sshkey_to_blob(ca, &ca_blob, &ca_len)) != 0)
return SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
cert = k->cert->certblob; /* for readability */
sshbuf_reset(cert);
if ((ret = sshbuf_put_cstring(cert, sshkey_ssh_name(k))) != 0)
goto out;
/* -v01 certs put nonce first */
arc4random_buf(&nonce, sizeof(nonce));
if ((ret = sshbuf_put_string(cert, nonce, sizeof(nonce))) != 0)
goto out;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Public key next */
if ((ret = impl->funcs->serialize_public(k, cert,
SSHKEY_SERIALIZE_DEFAULT)) != 0)
goto out;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Then remaining cert fields */
if ((ret = sshbuf_put_u64(cert, k->cert->serial)) != 0 ||
(ret = sshbuf_put_u32(cert, k->cert->type)) != 0 ||
(ret = sshbuf_put_cstring(cert, k->cert->key_id)) != 0)
goto out;
if ((principals = sshbuf_new()) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
for (i = 0; i < k->cert->nprincipals; i++) {
if ((ret = sshbuf_put_cstring(principals,
k->cert->principals[i])) != 0)
goto out;
}
if ((ret = sshbuf_put_stringb(cert, principals)) != 0 ||
(ret = sshbuf_put_u64(cert, k->cert->valid_after)) != 0 ||
(ret = sshbuf_put_u64(cert, k->cert->valid_before)) != 0 ||
(ret = sshbuf_put_stringb(cert, k->cert->critical)) != 0 ||
(ret = sshbuf_put_stringb(cert, k->cert->extensions)) != 0 ||
(ret = sshbuf_put_string(cert, NULL, 0)) != 0 || /* Reserved */
(ret = sshbuf_put_string(cert, ca_blob, ca_len)) != 0)
goto out;
/* Sign the whole mess */
if ((ret = signer(ca, &sig_blob, &sig_len, sshbuf_ptr(cert),
sshbuf_len(cert), alg, sk_provider, sk_pin, 0, signer_ctx)) != 0)
goto out;
/* Check and update signature_type against what was actually used */
if ((ret = sshkey_get_sigtype(sig_blob, sig_len, &sigtype)) != 0)
goto out;
if (alg != NULL && strcmp(alg, sigtype) != 0) {
ret = SSH_ERR_SIGN_ALG_UNSUPPORTED;
goto out;
}
if (k->cert->signature_type == NULL) {
k->cert->signature_type = sigtype;
sigtype = NULL;
}
/* Append signature and we are done */
if ((ret = sshbuf_put_string(cert, sig_blob, sig_len)) != 0)
goto out;
ret = 0;
out:
if (ret != 0)
sshbuf_reset(cert);
free(sig_blob);
free(ca_blob);
free(sigtype);
sshbuf_free(principals);
return ret;
}
static int
default_key_sign(struct sshkey *key, u_char **sigp, size_t *lenp,
const u_char *data, size_t datalen,
const char *alg, const char *sk_provider, const char *sk_pin,
u_int compat, void *ctx)
{
if (ctx != NULL)
return SSH_ERR_INVALID_ARGUMENT;
return sshkey_sign(key, sigp, lenp, data, datalen, alg,
sk_provider, sk_pin, compat);
}
int
sshkey_certify(struct sshkey *k, struct sshkey *ca, const char *alg,
const char *sk_provider, const char *sk_pin)
{
return sshkey_certify_custom(k, ca, alg, sk_provider, sk_pin,
default_key_sign, NULL);
}
int
sshkey_cert_check_authority(const struct sshkey *k,
int want_host, int require_principal, int wildcard_pattern,
uint64_t verify_time, const char *name, const char **reason)
{
u_int i, principal_matches;
if (reason == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if (!sshkey_is_cert(k)) {
*reason = "Key is not a certificate";
return SSH_ERR_KEY_CERT_INVALID;
}
if (want_host) {
if (k->cert->type != SSH2_CERT_TYPE_HOST) {
*reason = "Certificate invalid: not a host certificate";
return SSH_ERR_KEY_CERT_INVALID;
}
} else {
if (k->cert->type != SSH2_CERT_TYPE_USER) {
*reason = "Certificate invalid: not a user certificate";
return SSH_ERR_KEY_CERT_INVALID;
}
}
if (verify_time < k->cert->valid_after) {
*reason = "Certificate invalid: not yet valid";
return SSH_ERR_KEY_CERT_INVALID;
}
if (verify_time >= k->cert->valid_before) {
*reason = "Certificate invalid: expired";
return SSH_ERR_KEY_CERT_INVALID;
}
if (k->cert->nprincipals == 0) {
if (require_principal) {
*reason = "Certificate lacks principal list";
return SSH_ERR_KEY_CERT_INVALID;
}
} else if (name != NULL) {
principal_matches = 0;
for (i = 0; i < k->cert->nprincipals; i++) {
#ifdef WINDOWS
char cert_principal_name_copy[UNLEN + DNLEN + 1 + 1] = { 0, };
strcpy_s(cert_principal_name_copy, _countof(cert_principal_name_copy), k->cert->principals[i]);
/*
* For domain user we need special handling.
* We support both "domain\user" and "domain/user" formats.
*/
if (strstr(name, "/") || strstr(name, "\\")) {
char *tmp = NULL;
if (tmp = strstr(cert_principal_name_copy, "/"))
*tmp = '\\';
}
/* In windows, usernames are case insensitive */
if (wildcard_pattern) {
/* Use match_pattern_list for case insensitive compairision */
if (match_pattern_list(cert_principal_name_copy,
name, 1)) {
principal_matches = 1;
break;
}
} else if (_strcmpi(name, cert_principal_name_copy) == 0) {
principal_matches = 1;
break;
}
#else
if (wildcard_pattern) {
if (match_pattern(k->cert->principals[i],
name)) {
principal_matches = 1;
break;
}
} else if (strcmp(name, k->cert->principals[i]) == 0) {
principal_matches = 1;
break;
}
#endif
}
if (!principal_matches) {
*reason = "Certificate invalid: name is not a listed "
"principal";
return SSH_ERR_KEY_CERT_INVALID;
}
}
return 0;
}
int
sshkey_cert_check_authority_now(const struct sshkey *k,
int want_host, int require_principal, int wildcard_pattern,
const char *name, const char **reason)
{
time_t now;
if ((now = time(NULL)) < 0) {
/* yikes - system clock before epoch! */
*reason = "Certificate invalid: not yet valid";
return SSH_ERR_KEY_CERT_INVALID;
}
return sshkey_cert_check_authority(k, want_host, require_principal,
wildcard_pattern, (uint64_t)now, name, reason);
}
int
sshkey_cert_check_host(const struct sshkey *key, const char *host,
int wildcard_principals, const char *ca_sign_algorithms,
const char **reason)
{
int r;
if ((r = sshkey_cert_check_authority_now(key, 1, 0, wildcard_principals,
host, reason)) != 0)
return r;
if (sshbuf_len(key->cert->critical) != 0) {
*reason = "Certificate contains unsupported critical options";
return SSH_ERR_KEY_CERT_INVALID;
}
if (ca_sign_algorithms != NULL &&
(r = sshkey_check_cert_sigtype(key, ca_sign_algorithms)) != 0) {
*reason = "Certificate signed with disallowed algorithm";
return SSH_ERR_KEY_CERT_INVALID;
}
return 0;
}
size_t
sshkey_format_cert_validity(const struct sshkey_cert *cert, char *s, size_t l)
{
char from[32], to[32], ret[128];
*from = *to = '\0';
if (cert->valid_after == 0 &&
cert->valid_before == 0xffffffffffffffffULL)
return strlcpy(s, "forever", l);
if (cert->valid_after != 0)
format_absolute_time(cert->valid_after, from, sizeof(from));
if (cert->valid_before != 0xffffffffffffffffULL)
format_absolute_time(cert->valid_before, to, sizeof(to));
if (cert->valid_after == 0)
snprintf(ret, sizeof(ret), "before %s", to);
else if (cert->valid_before == 0xffffffffffffffffULL)
snprintf(ret, sizeof(ret), "after %s", from);
else
snprintf(ret, sizeof(ret), "from %s to %s", from, to);
return strlcpy(s, ret, l);
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Common serialization for FIDO private keys */
int
sshkey_serialize_private_sk(const struct sshkey *key, struct sshbuf *b)
{
int r;
if ((r = sshbuf_put_cstring(b, key->sk_application)) != 0 ||
(r = sshbuf_put_u8(b, key->sk_flags)) != 0 ||
(r = sshbuf_put_stringb(b, key->sk_key_handle)) != 0 ||
(r = sshbuf_put_stringb(b, key->sk_reserved)) != 0)
return r;
return 0;
}
int
sshkey_private_serialize_opt(struct sshkey *key, struct sshbuf *buf,
enum sshkey_serialize_rep opts)
{
int r = SSH_ERR_INTERNAL_ERROR;
int was_shielded = sshkey_is_shielded(key);
struct sshbuf *b = NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_key(key)) == NULL)
return SSH_ERR_INTERNAL_ERROR;
if ((r = sshkey_unshield_private(key)) != 0)
return r;
if ((b = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshbuf_put_cstring(b, sshkey_ssh_name(key))) != 0)
goto out;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if (sshkey_is_cert(key)) {
if (key->cert == NULL ||
sshbuf_len(key->cert->certblob) == 0) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0)
goto out;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((r = impl->funcs->serialize_private(key, b, opts)) != 0)
goto out;
/*
* success (but we still need to append the output to buf after
* possibly re-shielding the private key)
*/
r = 0;
out:
if (was_shielded)
r = sshkey_shield_private(key);
if (r == 0)
r = sshbuf_putb(buf, b);
sshbuf_free(b);
return r;
}
int
sshkey_private_serialize(struct sshkey *key, struct sshbuf *b)
{
return sshkey_private_serialize_opt(key, b,
SSHKEY_SERIALIZE_DEFAULT);
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* Shared deserialization of FIDO private key components */
int
sshkey_private_deserialize_sk(struct sshbuf *buf, struct sshkey *k)
{
int r;
if ((k->sk_key_handle = sshbuf_new()) == NULL ||
(k->sk_reserved = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshbuf_get_cstring(buf, &k->sk_application, NULL)) != 0 ||
(r = sshbuf_get_u8(buf, &k->sk_flags)) != 0 ||
(r = sshbuf_get_stringb(buf, k->sk_key_handle)) != 0 ||
(r = sshbuf_get_stringb(buf, k->sk_reserved)) != 0)
return r;
return 0;
}
int
sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
{
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
const struct sshkey_impl *impl;
char *tname = NULL;
char *expect_sk_application = NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
u_char *expect_ed25519_pk = NULL;
struct sshkey *k = NULL;
int type, r = SSH_ERR_INTERNAL_ERROR;
if (kp != NULL)
*kp = NULL;
if ((r = sshbuf_get_cstring(buf, &tname, NULL)) != 0)
goto out;
type = sshkey_type_from_name(tname);
if (sshkey_type_is_cert(type)) {
/*
* Certificate key private keys begin with the certificate
* itself. Make sure this matches the type of the enclosing
* private key.
*/
if ((r = sshkey_froms(buf, &k)) != 0)
goto out;
if (k->type != type) {
r = SSH_ERR_KEY_CERT_MISMATCH;
goto out;
}
/* For ECDSA keys, the group must match too */
if (k->type == KEY_ECDSA &&
k->ecdsa_nid != sshkey_ecdsa_nid_from_name(tname)) {
r = SSH_ERR_KEY_CERT_MISMATCH;
goto out;
}
/*
* Several fields are redundant between certificate and
* private key body, we require these to match.
*/
expect_sk_application = k->sk_application;
expect_ed25519_pk = k->ed25519_pk;
k->sk_application = NULL;
k->ed25519_pk = NULL;
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
/* XXX xmss too or refactor */
} else {
if ((k = sshkey_new(type)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((impl = sshkey_impl_from_type(type)) == NULL) {
r = SSH_ERR_INTERNAL_ERROR;
goto out;
}
Merge 9.2 (#657) * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * remove mention of --with-security-key-builtin it is enabled by default when libfido2 is installed * mention libfido2 autodetection * whitespace at EOL * Test commits to all branches of portable. Only test OpenBSD upstream on commits to master since that's what it tracks. * Add 9.1 branch to CI status page. * Add LibreSSL 3.6.0 to test suite. While there, bump OpenSSL to latest 1.1.1q release. * 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 * skip bsd-poll.h if poll.h found; ok dtucker * Fix snprintf configure test for clang 15 Clang 15 -Wimplicit-int defaults to an error in C99 mode and above. A handful of tests have "main(..." and not "int main(..." which caused the tests to produce incorrect results. * undef _get{short,long} before redefining * revert c64b62338b4 and guard POLL* defines instead c64b62338b4 broke OSX builds, which do have poll.h but lack ppoll(2) Spotted by dtucker * OpenSSL dev branch now identifies as 3.2.0. * upstream: document "-O no-restrict-websafe"; spotted by Ross L Richardson OpenBSD-Commit-ID: fe9eaa50237693a14ebe5b5614bf32a02145fe8b * upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here, wrap a long line ssh-agent.c: - add -O to usage() OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389 * upstream: use correct type with sizeof ok djm@ OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143 * upstream: when scp(1) is using the SFTP protocol for transport (the default), better match scp/rcp's handling of globs that don't match the globbed characters but do match literally (e.g. trying to transfer "foo.[1]"). Previously scp(1) in SFTP mode would not match these pathnames but legacy scp/rcp mode would. Reported by Michael Yagliyan in bz3488; ok dtucker@ OpenBSD-Commit-ID: d8a3773f53015ba811fddba7473769a2fd343e11 * upstream: regress test for unmatched glob characters; fails before previous commit but passes now. bz3488; prodded by dtucker@ OpenBSD-Regress-ID: 0cc5cc9ea4a6fd170dc61b9212f15badaafb3bbd * upstream: Be more paranoid with host/domain names coming from the never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@ OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad * upstream: begin big refactor of sshkey Move keytype data and some of the type-specific code (allocation, cleanup, etc) out into each key type's implementation. Subsequent commits will move more, with the goal of having each key-*.c file owning as much of its keytype's implementation as possible. lots of feedback + ok markus@ OpenBSD-Commit-ID: 0f2b4334f73914344e9e5b3d33522d41762a57ec * upstream: factor out sshkey_equal_public() feedback/ok markus@ OpenBSD-Commit-ID: 1368ba114cb37732fe6ec3d89c7e6d27ea6fdc94 * upstream: factor out public key serialization feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033 * upstream: refactor and simplify sshkey_read() feedback/ok markus@ OpenBSD-Commit-ID: 0d93b7a56e31cd06a8bb0d2191d084ce254b0971 * upstream: factor out key generation feedback/ok markus@ OpenBSD-Commit-ID: 5b4211bff4de8d9adb84bc72857a8c42c44e7ceb * upstream: refactor sshkey_from_private() feedback/ok markus@ OpenBSD-Commit-ID: e5dbe7a3545930c50f70ee75c867a1e08b382b53 * upstream: refactor sshkey_from_blob_internal() feedback/ok markus@ OpenBSD-Commit-ID: 1f46c0cbb8060ee9666a02749594ad6658c8e283 * upstream: refactor sshkey_sign() and sshkey_verify() feedback/ok markus@ OpenBSD-Commit-ID: 368e662c128c99d05cc043b1308d2b6c71a4d3cc * upstream: refactor certify feedback/ok markus@ OpenBSD-Commit-ID: 35d742992e223eaca3537e6fb3d3002c08eed4f6 * upstream: refactor sshkey_private_serialize_opt() feedback/ok markus@ OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd * upstream: refactor sshkey_private_deserialize feedback/ok markus@ OpenBSD-Commit-ID: f5ca6932fdaf840a5e8250becb38315a29b5fc9f * fix merge botch * upstream: allow ssh-keyscan(1) to accept CIDR address ranges, e.g. ssh-keyscan 192.168.0.0/24 If a CIDR range is passed, then it will be expanded to all possible addresses in the range including the all-0s and all-1s addresses. bz#976 feedback/ok markus@ OpenBSD-Commit-ID: ce6c5211f936ac0053fd4a2ddb415277931e6c4b * upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak OPENSSL=no builds OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e * OpenSSL dev branch is 302 not 320. While there, also accept 301 which it shat it was previously. * upstream: Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. OpenBSD-Regress-ID: 8b8a407115546be1c6d72d350b1e4f1f960d3cd3 * Check for sockaddr_in.sin_len. If found, set SOCK_HAS_LEN which is used in addr.c. Should fix keyscan tests on platforms with this (eg old NetBSD). * Always use compat getentropy. Have it call native getentropy and fall back as required. Should fix issues of platforms where libc has getentropy but it is not implemented in the kernel. Based on github PR#354 from simsergey. * Include time.h when defining timegm. Fixes build on some platforms eg recent AIX. * Compat tests need libcrypto. This was moved to CHANNELLIBS during the libs refactor. Spotted by rapier at psc.edu. * Run compat regress tests too. * Add tests for OpenSSL 3.0.7 and LibreSSL 3.6.1. * Only run opensslver tests if built with OpenSSL. * Increase selfhosted job timeout. The default job timeout of 360 (6h) is not enough to complete the regress tests for some of the slow VMs depending on the load on the host. Increase to 600 (10h). * Fix compat regress to work with non-GNU make. * Link libssh into compat tests. The cygwin compat code uses xmalloc, so add libssh.a so pick up that. * Rerun tests on changes to Makefile.in in any dir. * upstream: replace recently-added valid_domain() check for hostnames going to known_hosts with a more relaxed check for bad characters; previous commit broke address literals. Reported by/feedback from florian@ OpenBSD-Commit-ID: 10b86dc6a4b206adaa0c11b58b6d5933898d43e0 * Don't run openbsd-compat tests on Cygwin. Add "compat-tests" to the default TEST_TARGET so we can override as necessary. Override TEST_TARGET for Cygwin as the tests don't currently compile there. * Fix broken zlib link. * configure.ac: Add <pty.h> include for openpty Another Clang 16ish fix (which makes -Wimplicit-function-declaration an error by default). github PR#355. See: 2efd71da49b9cfeab7987058cf5919e473ff466b See: be197635329feb839865fdc738e34e24afd1fca8 * configure.ac: Fix -Wstrict-prototypes Clang 16 now warns on this and it'll be removed in C23, so let's just be future proof. It also reduces noise when doing general Clang 16 porting work (which is a big job as it is). github PR#355. Signed-off-by: Sam James <sam@gentoo.org> * Fix setres*id checks to work with clang-16. glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE, and clang 16 will error out on implicit function definitions, so add _GNU_SOURCE and the required headers to the configure checks. From sam at @gentoo.org via bz#3497. * Fix tracing disable on FreeBSD. Some versions of FreeBSD do not support using id 0 to refer to the current pid for procctl, so pass getpid() explicitly. From emaste at freebsd.org. * Use "prohibit-password" in -portable comments. "without-password" is the deprecated alias for "prohibit-password", so we should reference the latter. From emaste at freebsd.org. * Link to branch-specific queries for V_9_1 status. * upstream: Fix typo. From pablomh via -portable github PR#344. OpenBSD-Commit-ID: d056ee2e73691dc3ecdb44a6de68e6b88cd93827 * upstream: Import regenerated moduli. OpenBSD-Commit-ID: b0e54ee4d703bd6929bbc624068666a7a42ecb1f * Add CIFuzz integration * Run cifuzz workflow on the actions as regular CI. * Whitespace change to trigger CIFuzz workflow. * Do not run CIFuzz on selfhosted tree. We already run it on the regular tree, no need to double up. * Add CIFuzz status badge. * Branch-specific links for master status badges. * Fix merge conflict. * upstream: fix parsing of hex cert expiry time; was checking whether the start time began with "0x", not the expiry time. from Ed Maste OpenBSD-Commit-ID: 6269242c3e1a130b47c92cfca4d661df15f05739 * upstream: Check for and disallow MaxStartups values less than or equal to zero during config parsing, rather than faling later at runtime. bz#3489, ok djm@ OpenBSD-Commit-ID: d79c2b7a8601eb9be493629a91245d761154308b * upstream: Remove some set but otherwise unused variables, spotted in -portable by clang 16's -Wunused-but-set-variable. ok djm@ OpenBSD-Commit-ID: 3d943ddf2369b38fbf89f5f19728e7dc1daf3982 * upstream: The IdentityFile option in ssh_config can also be used to specify a public key file, as documented in ssh.1 for the -i option. Document this also for IdentityFile in ssh_config.5, for documentation completeness. From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@ OpenBSD-Commit-ID: 2f943be9f96e60ef81a9a4faa25b009999f9883b * Split out rekey test since it runs the longest. * Update checkout and upload actions. Update actions/checkout and actions/upload-artifact to main branch for compatibility with node.js v16. * Add valrind-5 test here too. * Run vm startup and shutdown from runner temp dir. Should work even if the github workspace dir is on a stale sshfs mount. * Shutdown any VM before trying to check out repo. In the case where the previous run did not clean up, the checkout will fail as it'll leave a stale mount. * Avoid assuming layout of fd_set POSIX doesn't specify the internal layout of the fd_set object, so let's not assume it is just a bit mask. This increases compatibility with systems that have a different layout. The assumption is also worthless as we already refuse to use file descriptors over FD_SETSIZE anyway. Meaning that the default size of fd_set is quite sufficient. * Fix comment text. From emaste at freebsd.org. * 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@ * upstream: typo in comment OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a * upstream: rename client_global_hostkeys_private_confirm() to client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change OpenBSD-Commit-ID: 31e09bd3cca6eed26855b88fb8beed18e9bd026d * upstream: Remove errant colon and simplify format string in error messages. Patch from vapier at chromium.org. OpenBSD-Commit-ID: fc28466ebc7b74e0072331947a89bdd239c160d3 * upstream: Fix typo in fatal error message. Patch from vapier at chromium.org. OpenBSD-Commit-ID: 8a0c164a6a25eef0eedfc30df95bfa27644e35cf * Skip reexec test on OpenSSL 1.1.1 specifically. OpenSSL 1.1.1 has a bug in its RNG that breaks reexec fallback, so skip that test. See bz#3483 for details. * Remove seed passing over reexec. This was added for the benefit of platforms using ssh-rand-helper to prevent a delay on each connection as sshd reseeded itself. ssh-random-helper is long gone, and since the re-exec happens before the chroot the re-execed sshd can reseed itself normally. ok djm@ * upstream: Handle dynamic remote port forwarding in escape commandline's -R processing. bz#3499, ok djm@ OpenBSD-Commit-ID: 194ee4cfe7ed0e2b8ad0727f493c798a50454208 * Add dfly62 test target. * If we haven't found it yet, recheck for sys/stat.h. On some very old platforms, sys/stat.h needs sys/types.h, however autoconf 2.71's AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order, which in combination with modern autoconf's "present but cannot be compiled" behaviour causes it to not be detected. * Add fallback for old platforms w/out MAP_ANON. * Remove explicit "default" test config argument. Not specifying the test config implicitly selects default args. * Remove unused self-hosted test targets. * Rename "os" in matrix to "target". This is in preparation to distinguish this from the host that the runner runs on in case where they are separate (eg VMs). * Add "libvirt" label to dfly30. * Make "config" in matrix singular and pass in env. This will allow the startup scripts to adapt their behaviour based on the type and config. * Run vmstartup from temp dir. This will allow us to create ephemeral disk images per-runner. * Rework how selfhosted tests interact with runners. Previously there was one runner per test target (mostly VMs). This had a few limitations: - multiple tests that ran on the same target (eg multiple build configs) were serialized on availability or that runner. - it needed manual balancing of VMs over host machines. To address this, make VMs that use ephemeral disks (ie most of them) all use a pool of runners with the "libvirt" label. This requires that we distinguish between "host" and "target" for those. Native runners and VMs with persistent disks (eg the constantly-updated snapshot ones) specify the same host and target. This should improve test throughput. * Skip unit tests on slow riscv64 hardware. * Use -fzero-call-used-regs=used on clang 15. clang 15 seems to have a problem with -fzero-call-used-reg=all which causes spurious "incorrect signature" failures with ED25519. On those versions, use -fzero-call-used-regs=used instead. (We may add exceptions later if specific versions prove to be OK). Also move the GCC version check to match. Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@ * upstream: In channel_request_remote_forwarding the parameters for permission_set_add are leaked as they are also duplicated in the call. Found by CodeChecker. ok djm OpenBSD-Commit-ID: 4aef50fa9be7c0b138188814c8fe3dccc196f61e * upstream: New EnableEscapeCommandline ssh_config(5) option This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while OpenBSD-Commit-ID: 7e277595d60acb8263118dcb66554472257b387a * upstream: tighten pledge(2) after session establishment feedback, ok & testing in snaps deraadt@ OpenBSD-Commit-ID: aecf4d49d28586dfbcc74328d9333398fef9eb58 * upstream: Add void to client_repledge args to fix compiler warning. ok djm@ OpenBSD-Commit-ID: 7e964a641ce4a0a0a11f047953b29929d7a4b866 * upstream: Log output of ssh-agent and ssh-add This should make debugging easier. OpenBSD-Regress-ID: 5974b02651f428d7e1079b41304c498ca7e306c8 * upstream: Clean up ssh-add and ssh-agent logs. OpenBSD-Regress-ID: 9eda8e4c3714d7f943ab2e73ed58a233bd29cd2c * Restore ssh-agent permissions on exit. ...enough that subsequent builds can overwrite ssh-agent if necessary. * upstream: make struct sshbuf private and remove an unused field; ok dtucker OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3 * upstream: Remove duplicate includes. Patch from AtariDreams via github PR#364. OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea * Fix typo in comment. Spotted by tim@ * Update autotools Regenerate config files using latest autotools * disable SANDBOX_SECCOMP_FILTER_DEBUG It was mistakenly enabled in 2580916e4872 Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net * Add SANDBOX_DEBUG to the kitchensink test build. * upstream: Fix comment typo. OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03 * upstream: remove '?' from getopt(3) loops userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e * upstream: Add server debugging for hostbased auth. auth_debug_add queues messages about the auth process which is sent to the client after successful authentication. This also sends those to the server debug log to aid in debugging. From bz#3507, ok djm@ OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a * upstream: Warn if no host keys for hostbased auth can be loaded. OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977 * use calloc for allocating arc4random structs ok dtucker * Move obsdsnap test VMs to ephemeral runners. * Run upstream obsdsnap tests on ephemeral runners. * obsdsnap test VMs runs-on libvirt too. * Fetch regress logs from obj dir. * Set group perms on regress dir. This ensures that the tests don't fail due to StrictMode checks. * Use sudo when resetting perms on directories. * Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. * Simply handling of SSH_CONNECTION PAM env var. Prompted by bz#3508: there's no need to cache the value of sshpam_conninfo so remove the global. While there, add check of return value from pam_putenv. ok djm@ * 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 * upstream: add a -X option to both scp(1) and sftp(1) to allow control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c * upstream: add -X to usage(); OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0 * 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 * upstream: Mention that scp uses the SFTP protocol and remove reference to legacy flag. Spotted by, feedback and ok jmc@ OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3 * upstream: spelling fixes; from paul tagliamonte amendments to his diff are noted on tech OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a * 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 * upstream: regression test for PermitRemoteOpen OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c * upstream: suppress "Connection closed" message when in quiet mode OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f * upstream: add ptimeout API for keeping track of poll/ppoll timeouts; ok dtucker markus OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead * upstream: replace manual poll/ppoll timeout math with ptimeout API feedback markus / ok markus dtucker OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2 * upstream: Add channel_force_close() This will forcibly close an open channel by simulating read/write errors, draining the IO buffers and calling the detach function. Previously the detach function was only ever called during channel garbage collection, but there was no way to signal the user of a channel (e.g. session.c) that its channel was being closed deliberately (vs. by the usual state-machine logic). So this adds an extra "force" argument to the channel cleanup callback to indicate this condition. ok markus dtucker OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b * upstream: tweak channel ctype names These are now used by sshd_config:ChannelTimeouts to specify timeouts by channel type, so force them all to use a similar format without whitespace. ok dtucker markus OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65 * upstream: Add channel_set_xtype() This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca * upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 * unbreak scp on NetBSD 4.x e555d5cad5 effectively increased the default copy buffer size for SFTP transfers. This caused NetBSD 4.x to hang during the "copy local file to remote file in place" scp.sh regression test. This puts back the original 32KB copy buffer size until we can properly figure out why. lots of debugging assistance from dtucker@ * 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 * upstream: unit tests for misc.c:ptimeout_* API OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94 * upstream: fix typo in verbose logging OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9 * upstream: regression test for ChannelTimeout OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685 * upstream: Save debug logs from ssh for debugging purposes. OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0 * Set OPENSSL_BIN from OpenSSL directory. * Check openssl_bin path is executable before using. * Use autoconf to find openssl binary. It's possible to install an OpenSSL in a path not in the system's default library search path. OpenSSH can still use this (eg if you specify an rpath) but the openssl binary there may not work. If one is available on the system path just use that. * Use our own netcat for dynamic-forward test. That way we can be surer about its behaviour rather than trying to second-guess the behaviour of various netcat implementations. * 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 * don't test IPv6 addresses if platform lacks support * Skip dynamic-forward test on minix3. This test relies on loopback addresses which minix does not have. Previously the test would not run at all since it also doesn't have netcat, but now we use our own netcat it tries and fails. * try to improve logging for dynamic-forward test previously the logs from the ssh used to exercise the forwarding channel would clobber the logs from the ssh actually doing the forwarding * upstream: tweak previous; ok djm OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858 * upstream: Switch scp from using pipes to a socketpair for communication with it's ssh sub-processes. We no longer need to reserve two descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is handled by sanitise_stdfd() in main(). Based on an original diff from djm@. OK deraadt@ djm@ OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d * add back use of pipes in scp.c under USE_PIPES This matches sftp.c which prefers socketpair but uses pipes on some older platforms. * remove buffer len workaround for NetBSD 4.x Switching to from pipes to a socketpair for communicating with the ssh process avoids the (kernel bug?) problem. * upstream: rewrite this test to use a multiplexed ssh session so we can control its lifecycle without risk of race conditions; fixes some of the Github integration tests for openssh-portable OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969 * upstream: remove whitespace at EOL from code extracted from SUPERCOP OpenBSD-Commit-ID: 1ec524ff2fbb9387d731601437c82008f35a60f4 * upstream: ignore bogus upload/download buffer lengths in the limits extension OpenBSD-Commit-ID: c5b023e0954693ba9a5376e4280c739b5db575f8 * upstream: clamp the minimum buffer lengths and number of inflight requests too OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56 * 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 * upstream: Add a "Host" line to the output of ssh -G showing the original host arg. Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@ OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883 * Remove skipping test when scp not in path. An upcoming change renders this obsolete by adding scp's path to the test sshd's PATH, and removing this first will make the subsequent sync easier. * 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 * upstream: Move scp path setting to a helper function. The previous commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4 * Retry package installation 3 times. When setting up the CI environment, retry package installation 3 times before going up. Should help prevent spurious failures during infrastructure issues. * upstream: Document "UserKnownHostsFile none". ok djm@ OpenBSD-Commit-ID: f695742d39e34ecdcc3c861c3739a84648a4bce5 * upstream: fix double phrase in previous; OpenBSD-Commit-ID: 671e6c8dc5e9230518b2bbfa143daaa88adc66c2 * 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 * upstream: Shell syntax fix. From ren mingshuai vi github PR#369. OpenBSD-Regress-ID: 6696b2eeefe128099fc3d7ea9f23252cc35156f9 * Allow writev is seccomp sandbox. This seems to be used by recent glibcs at least in some configurations. From bz#3512, ok djm@ * upstream: update OpenSSH's Ed25519 code to the last version of SUPERCOP (20221122) and change the import approach to the same one we use for Streamlined NTRUPrime: use a shell script to extract the bits we need from SUPERCOP, make some minor adjustments and squish them all into a single file. ok tb@ tobhe@ OpenBSD-Commit-ID: 1bc0fd624cb6af440905b8ba74ac7c03311b8e3b * upstream: adapt to ed25519 changes in src/usr.bin/ssh OpenBSD-Regress-ID: 4b3e7ba7ee486ae8a0b4790f8112eded2bb7dcd5 * upstream: Add a sshd_config UnusedConnectionTimeout option to terminate client connections that have no open channels for some length of time. This complements the recently-added ChannelTimeout option that terminates inactive channels after a timeout. ok markus@ OpenBSD-Commit-ID: ca983be74c0350364c11f8ba3bd692f6f24f5da9 * upstream: unbreak test: cannot access shell positional parameters past $9 without wrapping the position in braces (i.e. need ${10}, etc.) OpenBSD-Regress-ID: 3750ec98d5d409ce6a93406fedde6f220d2ea2ac * upstream: regression test for UnusedConnectionTimeout OpenBSD-Regress-ID: 7f29001374a68e71e5e078f69e4520cf4bcca084 * upstream: also check that an active session inhibits UnusedConnectionTimeout idea markus@ OpenBSD-Regress-ID: 55c0fb61f3bf9e092b0a53f9041d3d2012f14003 * upstream: For "ssh -V" always exit 0, there is no need to check opt again. This was missed when the fallthrough in the switch case above it was removed. OK deraadt@ OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120 * upstream: Add a -V (version) option to sshd like the ssh client has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e * upstream: when restoring non-blocking mode to stdio fds, restore exactly the flags that ssh started with and don't just clobber them with zero, as this could also remove the append flag from the set; bz3523; ok dtucker@ OpenBSD-Commit-ID: 1336b03e881db7564a4b66014eb24c5230e9a0c0 * Skip connection-timeout when missing FD passing. This tests uses multiplexing which uses file descriptor passing, so skip it if we don't have that. Fixes test failures on Cygwin. * Skip connection-timeout test under Valgrind. Valgrind slows things down so much that the timeout test fails. Skip this test until we figure out if we can make it work. * upstream: tweak previous; ok djm OpenBSD-Commit-ID: df71ce4180c58202dfdc1d92626cfe900b91b7c3 * upstream: Create and install sshd random relink kit. ../Makefile.inc and Makfile are concatenated for reuse, which hopefully won't be too fragile, we'll see if we need a different approach. The resulting sshd binary is tested with the new sshd -V option before installation. As the binary layout is now semi-unknown (meaning relative, fixed, and gadget offsets are not precisely known), change the filesystem permissions to 511 to prevent what I call "logged in BROP". I have ideas for improving this further but this is a first step ok djm OpenBSD-Commit-ID: 1e0a2692b7e20b126dda60bf04999d1d30d959d8 * upstream: delete useless dependency OpenBSD-Commit-ID: e1dc11143f83082e3154d6094f9136d0dc2637ad * fix libfido2 detection without pkg-config Place libfido2 before additional libraries (that it may depend upon) and not after. bz3530 from James Zhang; ok dtucker@ * Skip connection-timeout test on minix3. Minix 3's Unix domain sockets don't seem to work the way we expect, so skip connection-timeout test on that platform. While there, group together all similarly skipped tests and explicitly comment. * upstream: fix double-free caused by compat_kex_proposal(); bz3522 by dtucker@, ok me OpenBSD-Commit-ID: 2bfc37cd2d41f67dad64c17a64cf2cd3806a5c80 * upstream: openssh-9.2 OpenBSD-Commit-ID: f7389f32413c74d6e2055f05cf65e7082de03923 * upstream: Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. OpenBSD-Regress-ID: 731b96ae74d02d5744e1f1a8e51d09877ffd9b6d * upstream: test compat_kex_proposal(); by dtucker@ OpenBSD-Regress-ID: 0e404ee264db546f9fdbf53390689ab5f8d38bf2 * adapt compat_kex_proposal() test to portable * update version in README * crank versions in RPM specs * remove files from libssh project * re-merge arc4random.c * re-merge misc.c * remove unused files from libssh.vcxproj * fix outstanding merge conflicts * fix build errors * modify upstream workflows to trigger on workflow dispatch instead of all PRs * fix scp client hanging with pipes * fix some failing bash tests * make bash test compatible with Windows * address scp's sftp mode buf len limitations * address review feedback * address review feedback * update comment --------- Signed-off-by: Sam James <sam@gentoo.org> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com> Co-authored-by: Rochdi Nassah <rochdinassah.1998@gmail.com> Co-authored-by: David Korczynski <david@adalogics.com> Co-authored-by: Pierre Ossman <ossman@cendio.se> Co-authored-by: mbuhl@openbsd.org <mbuhl@openbsd.org> Co-authored-by: Rose <83477269+AtariDreams@users.noreply.github.com> Co-authored-by: cheloha@openbsd.org <cheloha@openbsd.org> Co-authored-by: deraadt@openbsd.org <deraadt@openbsd.org> Co-authored-by: tb@openbsd.org <tb@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org>
2023-02-09 22:57:36 +01:00
if ((r = impl->funcs->deserialize_private(tname, buf, k)) != 0)
goto out;
/* XXX xmss too or refactor */
if ((expect_sk_application != NULL && (k->sk_application == NULL ||
strcmp(expect_sk_application, k->sk_application) != 0)) ||
(expect_ed25519_pk != NULL && (k->ed25519_pk == NULL ||
memcmp(expect_ed25519_pk, k->ed25519_pk, ED25519_PK_SZ) != 0))) {
r = SSH_ERR_KEY_CERT_MISMATCH;
goto out;
}
/* success */
r = 0;
if (kp != NULL) {
*kp = k;
k = NULL;
}
out:
free(tname);
sshkey_free(k);
free(expect_sk_application);
free(expect_ed25519_pk);
return r;
}
#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
int
sshkey_ec_validate_public(const EC_GROUP *group, const EC_POINT *public)
{
EC_POINT *nq = NULL;
BIGNUM *order = NULL, *x = NULL, *y = NULL, *tmp = NULL;
int ret = SSH_ERR_KEY_INVALID_EC_VALUE;
/*
* NB. This assumes OpenSSL has already verified that the public
* point lies on the curve. This is done by EC_POINT_oct2point()
* implicitly calling EC_POINT_is_on_curve(). If this code is ever
* reachable with public points not unmarshalled using
* EC_POINT_oct2point then the caller will need to explicitly check.
*/
/*
* We shouldn't ever hit this case because bignum_get_ecpoint()
* refuses to load GF2m points.
*/
if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
NID_X9_62_prime_field)
goto out;
/* Q != infinity */
if (EC_POINT_is_at_infinity(group, public))
goto out;
if ((x = BN_new()) == NULL ||
(y = BN_new()) == NULL ||
(order = BN_new()) == NULL ||
(tmp = BN_new()) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
/* log2(x) > log2(order)/2, log2(y) > log2(order)/2 */
if (EC_GROUP_get_order(group, order, NULL) != 1 ||
EC_POINT_get_affine_coordinates_GFp(group, public,
x, y, NULL) != 1) {
ret = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (BN_num_bits(x) <= BN_num_bits(order) / 2 ||
BN_num_bits(y) <= BN_num_bits(order) / 2)
goto out;
/* nQ == infinity (n == order of subgroup) */
if ((nq = EC_POINT_new(group)) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (EC_POINT_mul(group, nq, NULL, public, order, NULL) != 1) {
ret = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (EC_POINT_is_at_infinity(group, nq) != 1)
goto out;
/* x < order - 1, y < order - 1 */
if (!BN_sub(tmp, order, BN_value_one())) {
ret = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (BN_cmp(x, tmp) >= 0 || BN_cmp(y, tmp) >= 0)
goto out;
ret = 0;
out:
BN_clear_free(x);
BN_clear_free(y);
BN_clear_free(order);
BN_clear_free(tmp);
EC_POINT_free(nq);
return ret;
}
int
sshkey_ec_validate_private(const EC_KEY *key)
{
BIGNUM *order = NULL, *tmp = NULL;
int ret = SSH_ERR_KEY_INVALID_EC_VALUE;
if ((order = BN_new()) == NULL || (tmp = BN_new()) == NULL) {
ret = SSH_ERR_ALLOC_FAIL;
goto out;
}
/* log2(private) > log2(order)/2 */
if (EC_GROUP_get_order(EC_KEY_get0_group(key), order, NULL) != 1) {
ret = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (BN_num_bits(EC_KEY_get0_private_key(key)) <=
BN_num_bits(order) / 2)
goto out;
/* private < order - 1 */
if (!BN_sub(tmp, order, BN_value_one())) {
ret = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (BN_cmp(EC_KEY_get0_private_key(key), tmp) >= 0)
goto out;
ret = 0;
out:
BN_clear_free(order);
BN_clear_free(tmp);
return ret;
}
void
sshkey_dump_ec_point(const EC_GROUP *group, const EC_POINT *point)
{
BIGNUM *x = NULL, *y = NULL;
if (point == NULL) {
fputs("point=(NULL)\n", stderr);
return;
}
if ((x = BN_new()) == NULL || (y = BN_new()) == NULL) {
fprintf(stderr, "%s: BN_new failed\n", __func__);
goto out;
}
if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
NID_X9_62_prime_field) {
fprintf(stderr, "%s: group is not a prime field\n", __func__);
goto out;
}
if (EC_POINT_get_affine_coordinates_GFp(group, point,
x, y, NULL) != 1) {
fprintf(stderr, "%s: EC_POINT_get_affine_coordinates_GFp\n",
__func__);
goto out;
}
fputs("x=", stderr);
BN_print_fp(stderr, x);
fputs("\ny=", stderr);
BN_print_fp(stderr, y);
fputs("\n", stderr);
out:
BN_clear_free(x);
BN_clear_free(y);
}
void
sshkey_dump_ec_key(const EC_KEY *key)
{
const BIGNUM *exponent;
sshkey_dump_ec_point(EC_KEY_get0_group(key),
EC_KEY_get0_public_key(key));
fputs("exponent=", stderr);
if ((exponent = EC_KEY_get0_private_key(key)) == NULL)
fputs("(NULL)", stderr);
else
BN_print_fp(stderr, EC_KEY_get0_private_key(key));
fputs("\n", stderr);
}
#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */
static int
sshkey_private_to_blob2(struct sshkey *prv, struct sshbuf *blob,
const char *passphrase, const char *comment, const char *ciphername,
int rounds)
{
u_char *cp, *key = NULL, *pubkeyblob = NULL;
u_char salt[SALT_LEN];
size_t i, pubkeylen, keylen, ivlen, blocksize, authlen;
u_int check;
int r = SSH_ERR_INTERNAL_ERROR;
struct sshcipher_ctx *ciphercontext = NULL;
const struct sshcipher *cipher;
const char *kdfname = KDFNAME;
struct sshbuf *encoded = NULL, *encrypted = NULL, *kdf = NULL;
if (rounds <= 0)
rounds = DEFAULT_ROUNDS;
if (passphrase == NULL || !strlen(passphrase)) {
ciphername = "none";
kdfname = "none";
} else if (ciphername == NULL)
ciphername = DEFAULT_CIPHERNAME;
if ((cipher = cipher_by_name(ciphername)) == NULL) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
if ((kdf = sshbuf_new()) == NULL ||
(encoded = sshbuf_new()) == NULL ||
(encrypted = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
blocksize = cipher_blocksize(cipher);
keylen = cipher_keylen(cipher);
ivlen = cipher_ivlen(cipher);
authlen = cipher_authlen(cipher);
if ((key = calloc(1, keylen + ivlen)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (strcmp(kdfname, "bcrypt") == 0) {
arc4random_buf(salt, SALT_LEN);
if (bcrypt_pbkdf(passphrase, strlen(passphrase),
salt, SALT_LEN, key, keylen + ivlen, rounds) < 0) {
r = SSH_ERR_INVALID_ARGUMENT;
goto out;
}
if ((r = sshbuf_put_string(kdf, salt, SALT_LEN)) != 0 ||
(r = sshbuf_put_u32(kdf, rounds)) != 0)
goto out;
} else if (strcmp(kdfname, "none") != 0) {
/* Unsupported KDF type */
r = SSH_ERR_KEY_UNKNOWN_CIPHER;
goto out;
}
if ((r = cipher_init(&ciphercontext, cipher, key, keylen,
key + keylen, ivlen, 1)) != 0)
goto out;
if ((r = sshbuf_put(encoded, AUTH_MAGIC, sizeof(AUTH_MAGIC))) != 0 ||
(r = sshbuf_put_cstring(encoded, ciphername)) != 0 ||
(r = sshbuf_put_cstring(encoded, kdfname)) != 0 ||
(r = sshbuf_put_stringb(encoded, kdf)) != 0 ||
(r = sshbuf_put_u32(encoded, 1)) != 0 || /* number of keys */
(r = sshkey_to_blob(prv, &pubkeyblob, &pubkeylen)) != 0 ||
(r = sshbuf_put_string(encoded, pubkeyblob, pubkeylen)) != 0)
goto out;
/* set up the buffer that will be encrypted */
/* Random check bytes */
check = arc4random();
if ((r = sshbuf_put_u32(encrypted, check)) != 0 ||
(r = sshbuf_put_u32(encrypted, check)) != 0)
goto out;
/* append private key and comment*/
if ((r = sshkey_private_serialize_opt(prv, encrypted,
SSHKEY_SERIALIZE_FULL)) != 0 ||
(r = sshbuf_put_cstring(encrypted, comment)) != 0)
goto out;
/* padding */
i = 0;
while (sshbuf_len(encrypted) % blocksize) {
if ((r = sshbuf_put_u8(encrypted, ++i & 0xff)) != 0)
goto out;
}
/* length in destination buffer */
if ((r = sshbuf_put_u32(encoded, sshbuf_len(encrypted))) != 0)
goto out;
/* encrypt */
if ((r = sshbuf_reserve(encoded,
sshbuf_len(encrypted) + authlen, &cp)) != 0)
goto out;
if ((r = cipher_crypt(ciphercontext, 0, cp,
sshbuf_ptr(encrypted), sshbuf_len(encrypted), 0, authlen)) != 0)
goto out;
sshbuf_reset(blob);
/* assemble uuencoded key */
if ((r = sshbuf_put(blob, MARK_BEGIN, MARK_BEGIN_LEN)) != 0 ||
(r = sshbuf_dtob64(encoded, blob, 1)) != 0 ||
(r = sshbuf_put(blob, MARK_END, MARK_END_LEN)) != 0)
goto out;
/* success */
r = 0;
out:
sshbuf_free(kdf);
sshbuf_free(encoded);
sshbuf_free(encrypted);
cipher_free(ciphercontext);
explicit_bzero(salt, sizeof(salt));
if (key != NULL)
freezero(key, keylen + ivlen);
Merge 9.1 (#626) * upstream: fix poll() spin when a channel's output fd closes without data in the channel buffer. Introduce more exact packing of channel fds into the pollfd array. fixes bz3405 and bz3411; ok deraadt@ markus@ OpenBSD-Commit-ID: 06740737849c9047785622ad5d472cb6a3907d10 * upstream: select post-quantum KEX sntrup761x25519-sha512@openssh.com as the default; ok markus@ OpenBSD-Commit-ID: f02d99cbfce22dffec2e2ab1b60905fbddf48fb9 * upstream: add support for the "corp-data" protocol extension to allow server-side copies to be performed without having to go via the client. Patch by Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: 00aa510940fedd66dab1843b58682de4eb7156d5 * upstream: add a sftp client "cp" command that supports server-side copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444 * depend * Skip slow tests on (very) slow test targets. * Set Makefile SHELL as determined by configure. This should improve compatibility for users with non-POSIX shells. If using Makefile.in directly (eg make -f Makefile.in distprep) then SHELL will need to be specified on the command line (along with MANFMT in that particular case). ok djm@ * Use bash or ksh if available for SH in Makefile. * Increase test timeout to allow slow VMs to finish * Only run regression tests on slow VMs. * Only return events from ppoll that were requested. If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@ * Specify TEST_SHELL=bash on AIX. The system shells cause the agent-restrict test to fail due to some quoting so explicitly specify bash until we can get configure to autmatically work around that. * Disable security key on fbsd6 test host. * upstream: man pages: add missing commas between subordinate and main clauses jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@ OpenBSD-Commit-ID: 9520801729bebcb3c9fe43ad7f9776ab4dd05ea3 * upstream: ssh: document sntrup761x25519-sha512@openssh.com as default KEX OpenBSD-Commit-ID: 12545bfa10bcbf552d04d9d9520d0f4e98b0e171 * upstream: openssh-9.0 OpenBSD-Commit-ID: 0dfb461188f4513ec024c1534da8c1ce14c20b64 * update version numbers for release * update build-aux files to match autoconf-2.71 i.e. config.guess, config.sub and install-sh * Revert "update build-aux files to match autoconf-2.71" This reverts commit 0a8ca39fac6ad19096b6c263436f8b2dd51606f2. It turns out that the checked-in copies of these files are actually newer than autoconf-2.71's copies, so this was effectively a downgrade. Spotted by Bo Anderson via github * upstream: two defensive changes from Tobias Stoeckmann via GHPR287 enforce stricter invarient for sshbuf_set_parent() - never allow a buffer to have a previously-set parent changed. In sshbuf_reset(), if the reallocation fails, then zero the entire buffer and not the (potentially smaller) default initial alloc size. OpenBSD-Commit-ID: 14583203aa5d50ad38d2e209ae10abaf8955e6a9 * upstream: Note that curve25519-sha256 was later published in RFC8731. ok djm@ OpenBSD-Commit-ID: 2ac2b5d642d4cf5918eaec8653cad9a4460b2743 * upstream: clear io_want/io_ready flags at start of poll() cycle; avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@ OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967 * Retire fbsd6 test VM. It's long since out of support, relatively slow (it's i686) and the compiler has trouble with PIE. * Resync moduli.5 with upstream. 1.18: remove duplicate publication year; carsten dot kunze at arcor dot de 1.19: ssh-keygen's -G/-T have been replaced with -M generate/screen. * upstream: Correct path for system known hosts file in description of IgnoreUserKnownHosts. Patch from Martin Vahlensieck via tech@ OpenBSD-Commit-ID: 9b7784f054fa5aa4d63cb36bd563889477127215 * upstream: list the correct version number for when usage of the sftp protocol became default and fix a typo from ed maste OpenBSD-Commit-ID: 24e1795ed2283fdeacf16413c2f07503bcdebb31 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: Try to continue running local I/O for channels in state OPEN during SSH transport rekeying. The most visible benefit is that it should make ~-escapes work in the client (e.g. to exit) if the connection happened to have stalled during a rekey event. Based work by and ok dtucker@ OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: regression test for sftp cp command OpenBSD-Regress-ID: c96bea9edde3a384b254785e7f9b2b24a81cdf82 * upstream: Simplify forward-control test. Since we no longer need to support SSH1 we don't need to run shell commands on the other end of the connection and can use ssh -N instead. This also makes the test less racy. OpenBSD-Regress-ID: 32e94ce272820cc398f30b848b2b0f080d10302c * upstream: Use ssh -f and ControlPersist .. to start up test forwards and ssh -O stop to shut them down intead of sleep loops. This speeds up the test by an order of magnitude. OpenBSD-Regress-ID: eb3db5f805100919b092a3b2579c611fba3e83e7 * upstream: It looks like we can't completely avoid waiting for processes to exit so retrieve the pid via controlmaster and use that. OpenBSD-Regress-ID: 8246f00f22b14e49d2ff1744c94897ead33d457b * Cache timezone data in capsicum sandbox. From emaste at freebsd.org, originally part of FreeBSD commit r339216 / fc3c19a9 with autoconf bits added by me. * Include stdlib.h for free() prototype. ... which is used inside the CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG block. * Update OpenSSL and LibreSSL versions in tests. * Add debian-riscv64 test target. * upstream: Avoid an unnecessary xstrdup in rm_env() when matching patterns. Since match_pattern() doesn't modify its arguments (they are const), there is no need to make an extra copy of the strings in options->send_env. From Martin Vahlensieck OpenBSD-Commit-ID: 2c9db31e3f4d3403b49642c64ee048b2a0a39351 * upstream: Add missing includes of stdlib.h and stdint.h. We need stdlib.h for malloc(3) and stdint.h for SIZE_MAX. Unlike the other xmss files, ssh-xmss.c does not include xmss_commons.h so ssh-xmss.c must include those headers itself. From Martin Vahlensieck OpenBSD-Commit-ID: 70e28a9818cee3da1be2ef6503d4b396dd421e6b * upstream: Remove unnecessary includes: openssl/hmac.h and openssl/evp.h. From Martin Vahlensieck. OpenBSD-Commit-ID: a6debb5fb0c8a44e43e8d5ca7cc70ad2f3ea31c3 * upstream: Check sshauthopt_new() for NULL. bz#3425, from tessgauthier at microsoft.com. ok djm@ OpenBSD-Commit-ID: af0315bc3e44aa406daa7e0ae7c2d719a974483f * upstream: Add authfd path to debug output. ok markus@ OpenBSD-Commit-ID: f735a17d1a6f2bee63bfc609d76ef8db8c090890 * upstream: avoid printing hash algorithm twice; from lucas AT sexy.is OpenBSD-Commit-ID: 9d24671e10a84141b7c504396cabad600e47a941 * upstream: fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@ OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e * upstream: Don't leak SK device. Patch from Pedro Martelletto via github PR#316. ok djm@ OpenBSD-Commit-ID: 17d11327545022e727d95fd08b213171c5a4585d * upstream: mention that the helpers are used by ssh(1), ssh-agent(1) and ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto OpenBSD-Commit-ID: 30f880f989d4b329589c1c404315685960a5f153 * Remove now-empty int32_minmax.inc. * Only run tests when source files change. Also run tests on changes to V_9_0 branch. * Add Mac OS X 12 test target. * upstream: be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ OpenBSD-Commit-ID: e267746c047ea86665cdeccef795a8a56082eeb2 * upstream: fix some integer overflows in sieve_large() that show up when trying to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@ OpenBSD-Commit-ID: 81cbc6dd3a21c57bd6fadea10e44afe37bca558e * upstream: remove an obsolete rsa1 format example from an example; from megan batty ok djm OpenBSD-Commit-ID: db2c89879c29bf083df996bd830abfb1e70d62bf * upstream: Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. The wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy OpenBSD-Commit-ID: dd98748d7644df048f78dcf793b3b63db9ab1d25 * upstream: make sure stdout is non-blocking; ok djm@ OpenBSD-Commit-ID: 64940fffbd1b882eda2d7c8c7a43c79368309c0d * upstream: mux.c: mark argument as const; from Martin Vahlensieck OpenBSD-Commit-ID: 69a1a93a55986c7c2ad9f733c093b46a47184341 * upstream: channel_new no longer frees remote_name. So update the comment accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck OpenBSD-Commit-ID: e4e10dc8dc9f40c166ea5a8e991942bedc75a76a * upstream: sshkey_unshield_private() contains a exact duplicate of the code in private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@ OpenBSD-Commit-ID: 876884c3f0e62e8fd8d1594bab06900f971c9c85 * Add ubsan minimal testcase on OpenBSD. As suggested by djm@. * Note that, for now, we need variadic macros. * Also retest OpenBSD upstream on .yml changes. * upstream: When performing operations that glob(3) a remote path, ensure that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef * Remove duplicate bcrypt_pbkdf.o from Makefile bcrypt_pbkdf.o is duplicated in the openbsd-compat Makefile's object file list. * upstream: improve error message when 'ssh-keygen -Y sign' is unable to load a private key; bz3429, reported by Adam Szkoda ok dtucker@ OpenBSD-Commit-ID: bb57b285e67bea536ef81b1055467be2fc380e74 * upstream: Allow existing -U (use agent) flag to work with "-Y sign" operations, where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@ OpenBSD-Commit-ID: a7bc69873b99c32c42c7628ed9ea91565ba08c2f * upstream: Remove errant apostrophe. From haruyama at queen-ml org. OpenBSD-Commit-ID: dc6b294567cb84b384ad6ced9ca469f2bbf0bd10 * upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 * upstream: fix in-place copies; r1.163 incorrectly skipped truncation in all cases, not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@ OpenBSD-Commit-ID: b189f19cd68119548c8e24e39c79f61e115bf92c * upstream: Only run agent-ptrace.sh if gdb is available as all architectures do not ship with gdb. OpenBSD-Regress-ID: ec53e928803e6b87f9ac142d38888ca79a45348d * upstream: regress test for in-place transfers and clobbering larger files with smaller ones; would have caught last regression in scp(1) OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2 * configure.ac: Add missing AC_DEFINE for caph_cache_tzdata test causing HAVE_CAPH_CACHE_TZDATA to be missing from config.h.in. Spotted by Bryan Drewery * upstream: make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via #define) dump to stderr rather than stdout OpenBSD-Commit-ID: 10298513ee32db8390aecb0397d782d68cb14318 * upstream: revert previous; it was broken (spotted by Theo) OpenBSD-Commit-ID: 457c79afaca2f89ec2606405c1059b98b30d8b0d * upstream: Note that ProxyJump also accepts the same tokens as ProxyCommand. From pallxk via github PR#305. OpenBSD-Commit-ID: 7115ac351b129205f1f1ffa6bbfd62abd76be7c5 * upstream: Avoid kill with -1 argument. The out_ctx label can be reached before fork has been called. If this happens, then kill -1 would be called, sending SIGTERM to all processes reachable by the current process. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8 * upstream: f sshpkt functions fail, then password is not cleared with freezero. Unconditionally call freezero to guarantee that password is removed from RAM. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6b093619c9515328e25b0f8093779c52402c89cd * upstream: refactor authorized_keys/principals handling remove "struct ssh *" from arguments - this was only used to pass the remote host/address. These can be passed in instead and the resulting code is less tightly coupled to ssh_api.[ch] ok dtucker@ OpenBSD-Commit-ID: 9d4373d013edc4cc4b5c21a599e1837ac31dda0d * upstream: split the low-level file handling functions out from auth2-pubkey.c Put them in a new auth2-pubkeyfile.c to make it easier to refer to them (e.g. in unit/fuzz tests) without having to refer to everything else pubkey auth brings in. ok dtucker@ OpenBSD-Commit-ID: 3fdca2c61ad97dc1b8d4a7346816f83dc4ce2217 * fuzzer for authorized_keys parsing mostly redundant to authopt_fuzz, but it's sensitive code so IMO it makes sense to test this layer too * Test against LibreSSL 3.5.3. * Test against OpenSSL 1.1.1o and 3.0.3. * fix some bugs in the fuzzer * upstream: keywords ref ssh_config.5; from caspar schutijser OpenBSD-Commit-ID: f146a19d7d5c9374c3b9c520da43b2732d7d1a4e * upstream: ssh-keygen: implement "verify-required" certificate option. This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@ OpenBSD-Commit-ID: f660f973391b593fea4b7b25913c9a15c3eb8a06 * upstream: ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303 from jsegitz with man page text from jmc@, ok markus@ djm@ OpenBSD-Commit-ID: 5c4c57bdd7063ff03381cfb6696659dd3f9f5b9f * upstream: Add period at end of "not known by any other names" message. github PR#320 from jschauma, ok djm@ OpenBSD-Commit-ID: bd60809803c4bfd3ebb7c5c4d918b10e275266f2 * upstream: Add missing *-sk types to ssh-keyscan manpage. From skazi0 via github PR#294. OpenBSD-Commit-ID: fda2c869cdb871f3c90a89fb3f985370bb5d25c0 * upstream: Make SetEnv directives first-match-wins in both sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b * upstream: test setenv in both client and server, test first-match-wins too OpenBSD-Regress-ID: 4c8804f9db38a02db480b9923317457b377fe34b * upstream: move auth_openprincipals() and auth_openkeyfile() over to auth2-pubkeyfile.c too; they make more sense there. OpenBSD-Commit-ID: 9970d99f900e1117fdaab13e9e910a621b7c60ee * upstream: make sure that UseDNS hostname lookup happens in the monitor and not in the pledge(2)'d unprivileged process; fixes regression caused by recent refactoring spotted by henning@ OpenBSD-Commit-ID: a089870b95101cd8881a2dff65b2f1627d13e88d * fix possible NULL deref when built without FIDO Analysis/fix from kircher in bz3443; ok dtucker@ * automatically enable built-in FIDO support If libfido2 is found and usable, then enable the built-in security key support unless --without-security-key-builtin was requested. ok dtucker@ * upstream: Log an error if pipe() fails while accepting a connection. bz#3447, from vincent-openssh at vinc17 net, ok djm@ OpenBSD-Commit-ID: 9d59f19872b94900a5c79da2d57850241ac5df94 * upstream: Don't attempt to fprintf a null identity comment. From Martin Vahlensieck via tech@. OpenBSD-Commit-ID: 4c54d20a8e8e4e9912c38a7b4ef5bfc5ca2e05c2 * upstream: Make sure not to fclose() the same fd twice in case of an error. ok dtucker@ OpenBSD-Commit-ID: e384c4e05d5521e7866b3d53ca59acd2a86eef99 * upstream: make it clear that RekeyLimit applies to both transmitted and received data. GHPR#328 from Jan Pazdziora OpenBSD-Commit-ID: d180a905fec9ff418a75c07bb96ea41c9308c3f9 * request 1.1x API compatibility for OpenSSL >=3.x idea/patch from Pedro Martelletto via GHPR#322; ok dtucker@ * fix broken case statement in previous * Disable SK support if FIDO libs not found. * Zero out LIBFIDO2 when SK support not usable. Prevents us from trying to link them into ssh-sk-helper and failing to build. * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ OpenBSD-Commit-ID: b2f6e5f60f2bba293b831654328a8a0035ef4a1b * upstream: Roll back previous KEX changes as they aren't safe until compat_pkalg_proposal and friends always allocate their returned strings. Reported by Qualys. OpenBSD-Commit-ID: 1c7a88a0d5033f42f88ab9bec58ef1cf72c81ad0 * upstream: allow arguments to sftp -D option, e.g. sftp -D "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce * Update OpenSSL tests to the most recent releases. * upstream: reflect the update to -D arg name in usage(); OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c * upstream: ignore SIGPIPE earlier in main(), specifically before muxclient() which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@ OpenBSD-Commit-ID: 63d8e13276869eebac6d7a05d5a96307f9026e47 * upstream: Always return allocated strings from the kex filtering so that we can free them later. Fix one leak in compat_kex_proposal. Based on github PR#324 from ZoltanFridrich with some simplications by me. ok djm@ OpenBSD-Commit-ID: 9171616da3307612d0ede086fd511142f91246e4 * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ This is a roll-forward of the previous rollback now that the required changes in compat.c have been done. OpenBSD-Commit-ID: c7cd93730b3b9f53cdad3ae32462922834ef73eb * upstream: bump up loglevel from debug to info when unable to open authorized keys/principals file for errno != ENOENT; bz2042 ok dtucker OpenBSD-Commit-ID: e79aa550d91ade6a80f081bda689da24c086d66b * Skip select+rlimit check if sandboxing is disabled It's not needed in that case, and the test can fail when being built with some compiler memory sanitizer flags. bz#3441 * upstream: use consistent field names (s/char/byte) in format description OpenBSD-Commit-ID: 3de33572733ee7fcfd7db33d37db23d2280254f0 * upstream: Remove leftover line. Remove extra line leftover from merge conflict. ok djm@ OpenBSD-Commit-ID: 460e2290875d7ae64971a7e669c244b1d1c0ae2e * Move checks for pollfd.fd and nfds_t. Move the checks for struct pollfd.fd and nfds_t to before the sandboxing checks. This groups all the sandbox checks together so we can skip them all when sandboxing is disabled. * Skip all rlimit tests when sandboxing disabled. The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no. * Add clang sanitizer tests. * upstream: Add TEST_REGRESS_CACHE_DIR. If set, it is used to cache regress test names that have succeeded and skip those on a re-run. OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247 * Move sanitizer logs into regress for collection. * Add GCC address sanitizer build/test. * Update sanitizer test targets: - remove clang-sanitize-memory for now. It takes so long that the test times out. - add gcc sanitize-address and sanitize-undefined test targets. * Test against openssl-3.0.5. * Move unset to before we set anything. * Refuse to use OpenSSL 3.0.4 due to potential RCE. OpenSSL has a potential RCE in its RSA implementation (CVE-2022-2274) so refuse to use that specific version. * Capture stderr output from configure. * Only refuse to use OpenSSL 3.0.4 on x86_64. The potential RCE only impacts x86_64, so only refuse to use it if we're targetting a potentially impacted architecture. ok djm@ * Remove special casing of crypt(). Configure goes to some lengths to pick crypt() from either libcrypt or OpenSSL's libcrypto because they can more or less featureful (eg supporting md5-style passwords). OpenSSL removed its crypt() interface in 2002: https://github.com/openssl/openssl/commit/69deec58 so these hijinks should no longer be necessary. This also only links sshd with libcrypt which is the only thing that needs it. ok djm@ * Clarify README.md text. Clarify the text about the implications of building without OpenSSL, and prefix the "configure --help" example command with a "./" so it's likely to work as-is in more shells. From bz#3461. * Split README.platform into its own line. README.platform has general platform-specific information, having it following text about FIDO2 on the same line could imply that it only has information about FIDO2. * Return ERANGE from getcwd() if buffer size is 1. If getcwd() is supplied a buffer size of exactly 1 and a path of "/", it could result in a nul byte being written out of array bounds. POSIX says it should return ERANGE if the path will not fit in the available buffer (with terminating nul). 1 byte cannot fit any possible path with its nul, so immediately return ERANGE in that case. OpenSSH never uses getcwd() with this buffer size, and all current (and even quite old) platforms that we are currently known to work on have a native getcwd() so this code is not used on those anyway. Reported by Qualys, ok djm@ * Remove unintended changes. I inadvertently included a couple of local changes with the OpenSSL 3.0.4 change. Revert, anything that should be there will be committed separately. * Add AUDIT_ARCH_PPC to supported seccomp arches. Patch from dries.deschout at dodeco.eu. * Rename bbone test target to ARM. * Move vmshutdown to first step. If a previous run on a physical runner has failed to clean up, the next run will fail because it'll try to check out the code to a broken directory mount. Make cleanup the first step. * upstream: pull passphrase reading and confirmation into a separate function so it can be used for FIDO2 PINs; no functional change OpenBSD-Commit-ID: bf34f76b8283cc1d3f54633e0d4f13613d87bb2f * upstream: when enrolling a resident key on a security token, check if a credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust OpenBSD-Commit-ID: e45e9f1bf2b2f32d9850669e7a8dbd64acc5fca4 * upstream: sk-usbhid: preserve error code returned by key_lookup() it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b * upstream: ssh-keygen: fix touch prompt, pin retries; part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: 75d1005bd2ef8f29fa834c90d2684e73556fffe8 * crank SSH_SK_VERSION_MAJOR in sk-dummy.so * Skip scp3 test if there's no scp on remote path. scp -3 ends up using the scp that's in the remote path and will fail if one is not available. Based on a patch from rapier at psc.edu. * Convert "have_prog" function into "which". "which" and its behaviour is not standardized, so convert the existing have_prog function into "which" so we can rely on it being available and what its semantics are. Add a have_prog wrapper that maintains the existing behaviour. * upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not executable. No-op on most platforms but should prevent warnings in -portable on systems that don't have 'date %s'. OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4 * upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test. OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0 * Remove workarounds for OpenSSL missing AES-GCM. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES GCM mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have GCM, so this is no longer needed. ok djm@ * Remove workarounds for OpenSSL missing AES-CTR. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES CTR mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have CTR, so this is no longer needed. ok djm@ * Do not link scp, sftp and sftp-server w/ zlib. Some of our binaries (eg sftp, sftp-server, scp) do not interact with the channels code and thus do use libraries such as zlib and libcrypto although they are linked with them. This adds a CHANNELLIBS and starts by moving zlib into it, which means the aformentioned binaries are no longer linked against zlib. ok djm@ * Group libcrypto and PRNGD checks together. They're related more than the libcrypt or libiaf checks which are currently between them. ok djm@ * Remove seed_rng calls from scp, sftp, sftp-server. These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@ * Move libcrypto into CHANNELLIBS. This will result in sftp, sftp-server and scp no longer being linked against libcrypto. ok djm@ * Move stale-configure check as early as possible. We added a check in Makefile to catch the case where configure needs to be rebuilt, however this did not happen until a build was attempted in which case all of the work done by configure was wasted. Move this check to the start of configure to catch it as early as possible. ok djm@ * Remove deprecated MacOS 10.15 runners. * upstream: avoid double-free in error path introduced in r1.70; report and fix based on GHPR#332 by v-rzh ok dtucker@ OpenBSD-Commit-ID: 3d21aa127b1f37cfc5bdc21461db369a663a951f * Include CHANNEL and FIDO2 libs in configure output * Factor out getrnd() and rename to getentropy(). Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@. * compat code for fido_dev_is_winhello() Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * check_sk_options: add temporary WinHello workaround Up to libfido 1.10.0, WinHello advertises "clientPin" rather than "uv" capability. This is fixed in 1.11.0. For the time being, workaround it here. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * sk_sign: set FIDO2 uv attribute explicitely for WinHello WinHello via libfido2 performs user verification by default. However, if we stick to that, there's no way to differentiate between keys created with or without "-O verify-required". Set FIDO2 uv attribute explicitely to FIDO_OPT_FALSE, then check if user verification has been requested. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: don't prompt for FIDO passphrase before attempting to enroll the credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@ OpenBSD-Commit-ID: bd5342ffc353ee37d39617906867c305564d1ce2 * Give unused param a name. Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello. * Actually put HAVE_STDINT_H around the stdint.h. * Rename our getentropy to prevent possible loops. Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@ * Test hostbased auth on github runners. * fix SANDBOX_SECCOMP_FILTER_DEBUG * Fix conditional for running hostbased tests. * upstream: allow certificate validity intervals, sshsig verification times and authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13 * upstream: add some tests for parse_absolute_time(), including cases where it is forced to the UTC timezone. bz3468 ok dtucker OpenBSD-Regress-ID: ea07ca31c2f3847a38df028ca632763ae44e8759 * Skip hostbased during Valgrind tests. Valgrind doesn't let ssh exec ssh-keysign (because it's setuid) so skip it during the Valgrind based tests. See https://bugs.kde.org/show_bug.cgi?id=119404 for a discussion of this (ironically there the problematic binary was ssh(1) back when it could still be setuid). * Rerun tests if any .github config file changes. * Add a timegm implementation from Heimdal via Samba. Fixes build on (at least Solaris 10). * Replace deprecated ubuntu-18.04 runners with 22.04 * upstream: sftp-server: support home-directory request Add support to the sftp-server for the home-directory extension defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the existing expand-path@openssh.com, but uses a more official protocol name, and so is a bit more likely to be implemented by non-OpenSSH clients. From Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: bfc580d05cc0c817831ae7ecbac4a481c23566ab * fido_dev_is_winhello: return 0, not "false" "false" is not used anywhere in OpenSSH, so return 0 like everywhere else. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * Revert "check_sk_options: add temporary WinHello workaround" Cygwin now comes with libfido2 1.11.0, so this workaround isn't required anymore. This reverts commit 242c044ab111a37aad3b0775727c36a4c5f0102c. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: use .Cm for "sign"; from josiah frentsos OpenBSD-Commit-ID: 7f80a53d54857ac6ae49ea6ad93c5bd12231d1e4 * upstream: add an extra flag to sk_probe() to indicate whether we're probing for a FIDO resident key or not. Unused here, but will make like easier for portable OpenBSD-Commit-ID: 432c8ff70e270378df9dbceb9bdeaa5b43b5a832 * on Cygwin, prefer WinHello FIDO device If no FIDO device was explictly specified, then prefer the windows://hello FIDO device. An exception to this is when probing resident FIDO keys, in which case hardware FIDO devices are preferred. * Check for perms to run agent-getpeereid test. Ubuntu 22.04 defaults to private home dirs which prevents "nobody" running ssh-add during the agent-getpeereid test. Check for this and add the necessary permissions. * upstream: double free() in error path; from Eusgor via GHPR333 OpenBSD-Commit-ID: 39f35e16ba878c8d02b4d01d8826d9b321be26d4 * Add Cygwin (on windows-2019) test target. In addition to installing the requisite Cygwin packages, we also need to explicitly invoke "sh" for steps that run other scripts since the runner environment doesn't understand #! paths. * Add a bit more debug output. * Fix cygwin conditional steps. * upstream: Strictly enforce the maximum allowed SSH2 banner size in ssh-keyscan and prevent a one-byte buffer overflow. Patch from Qualys, ok djm@ OpenBSD-Commit-ID: 6ae664f9f4db6e8a0589425f74cd0bbf3aeef4e4 * upstream: remove incorrect check that can break enrolling a resident key (introduced in r1.40) OpenBSD-Commit-ID: 4cab364d518470e29e624af3d3f9ffa9c92b6f01 * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * fix pester test failures * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * define HAVE_KILLPG * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * add debug on appveyor * add sleep to pester test * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * fix 9.1 compilation errors * disable -p pester tests due to unreliability on older Windows versions * remove extra sleep time from debugging scp pester tests * modify -p tests to only run for Windows OS version 10 and above * add windows specific code back into method moved from auth.c to auth2-pubkeyfile.c * add preprocessor for WinHello * revert preprocessor definition for winhello * add windows preprocessor definition in key_lookup * remove rdp block from appveyor since we are no longer debugging * add ifdef to sftp-server.c * make key_lookup compatible with winhello * appveyor.yml * increase debug of failing pester test * add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed * modify new scp.sh tests for windows * remove in place tests from scp.sh * remove rdp debug from appveyor * retrigger appveyor * change check of OS version in scp test Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: naddy@openbsd.org <naddy@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: tj@openbsd.org <tj@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: florian@openbsd.org <florian@openbsd.org> Co-authored-by: markus@openbsd.org <markus@openbsd.org> Co-authored-by: Tobias Heider <me@tobhe.de> Co-authored-by: anton@openbsd.org <anton@openbsd.org> Co-authored-by: Tim Rice <tim@multitalents.net> Co-authored-by: tobhe@openbsd.org <tobhe@openbsd.org> Co-authored-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org>
2022-11-02 17:06:45 +01:00
if (pubkeyblob != NULL)
freezero(pubkeyblob, pubkeylen);
return r;
}
static int
private2_uudecode(struct sshbuf *blob, struct sshbuf **decodedp)
{
const u_char *cp;
size_t encoded_len;
int r;
u_char last;
struct sshbuf *encoded = NULL, *decoded = NULL;
if (blob == NULL || decodedp == NULL)
return SSH_ERR_INVALID_ARGUMENT;
*decodedp = NULL;
if ((encoded = sshbuf_new()) == NULL ||
(decoded = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
/* check preamble */
cp = sshbuf_ptr(blob);
if (cp == NULL) { // fix CodeQL SM02313
r = SSH_ERR_INTERNAL_ERROR;
goto out;
}
encoded_len = sshbuf_len(blob);
#ifdef SUPPORT_CRLF
if ((encoded_len < (MARK_BEGIN_LEN + MARK_END_LEN) ||
memcmp(cp, MARK_BEGIN, MARK_BEGIN_LEN) != 0) &&
(encoded_len < (MARK_BEGIN_LEN_CRLF + MARK_END_LEN_CRLF) ||
memcmp(cp, MARK_BEGIN_CRLF, MARK_BEGIN_LEN_CRLF) != 0)) {
#else /* !SUPPORT_CRLF */
if (encoded_len < (MARK_BEGIN_LEN + MARK_END_LEN) ||
memcmp(cp, MARK_BEGIN, MARK_BEGIN_LEN) != 0) {
#endif /* !SUPPORT_CRLF */
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
cp += MARK_BEGIN_LEN;
encoded_len -= MARK_BEGIN_LEN;
/* Look for end marker, removing whitespace as we go */
while (encoded_len > 0) {
if (*cp != '\n' && *cp != '\r') {
if ((r = sshbuf_put_u8(encoded, *cp)) != 0)
goto out;
}
last = *cp;
encoded_len--;
cp++;
if (last == '\n') {
#ifdef SUPPORT_CRLF
if ((encoded_len >= MARK_END_LEN &&
memcmp(cp, MARK_END, MARK_END_LEN) == 0) ||
(encoded_len >= MARK_END_LEN_CRLF &&
memcmp(cp, MARK_END_CRLF, MARK_END_LEN_CRLF) == 0)) {
#else /* !SUPPORT_CRLF */
if (encoded_len >= MARK_END_LEN &&
memcmp(cp, MARK_END, MARK_END_LEN) == 0) {
#endif /* !SUPPORT_CRLF */
/* \0 terminate */
if ((r = sshbuf_put_u8(encoded, 0)) != 0)
goto out;
break;
}
}
}
if (encoded_len == 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* decode base64 */
if ((r = sshbuf_b64tod(decoded, (char *)sshbuf_ptr(encoded))) != 0)
goto out;
/* check magic */
if (sshbuf_len(decoded) < sizeof(AUTH_MAGIC) ||
memcmp(sshbuf_ptr(decoded), AUTH_MAGIC, sizeof(AUTH_MAGIC))) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* success */
*decodedp = decoded;
decoded = NULL;
r = 0;
out:
sshbuf_free(encoded);
sshbuf_free(decoded);
return r;
}
static int
private2_decrypt(struct sshbuf *decoded, const char *passphrase,
struct sshbuf **decryptedp, struct sshkey **pubkeyp)
{
char *ciphername = NULL, *kdfname = NULL;
const struct sshcipher *cipher = NULL;
int r = SSH_ERR_INTERNAL_ERROR;
size_t keylen = 0, ivlen = 0, authlen = 0, slen = 0;
struct sshbuf *kdf = NULL, *decrypted = NULL;
struct sshcipher_ctx *ciphercontext = NULL;
struct sshkey *pubkey = NULL;
u_char *key = NULL, *salt = NULL, *dp;
u_int blocksize, rounds, nkeys, encrypted_len, check1, check2;
if (decoded == NULL || decryptedp == NULL || pubkeyp == NULL)
return SSH_ERR_INVALID_ARGUMENT;
*decryptedp = NULL;
*pubkeyp = NULL;
if ((decrypted = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
/* parse public portion of key */
if ((r = sshbuf_consume(decoded, sizeof(AUTH_MAGIC))) != 0 ||
(r = sshbuf_get_cstring(decoded, &ciphername, NULL)) != 0 ||
(r = sshbuf_get_cstring(decoded, &kdfname, NULL)) != 0 ||
(r = sshbuf_froms(decoded, &kdf)) != 0 ||
(r = sshbuf_get_u32(decoded, &nkeys)) != 0)
goto out;
if (nkeys != 1) {
/* XXX only one key supported at present */
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
if ((r = sshkey_froms(decoded, &pubkey)) != 0 ||
(r = sshbuf_get_u32(decoded, &encrypted_len)) != 0)
goto out;
if ((cipher = cipher_by_name(ciphername)) == NULL) {
r = SSH_ERR_KEY_UNKNOWN_CIPHER;
goto out;
}
if (strcmp(kdfname, "none") != 0 && strcmp(kdfname, "bcrypt") != 0) {
r = SSH_ERR_KEY_UNKNOWN_CIPHER;
goto out;
}
if (strcmp(kdfname, "none") == 0 && strcmp(ciphername, "none") != 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
if ((passphrase == NULL || strlen(passphrase) == 0) &&
strcmp(kdfname, "none") != 0) {
/* passphrase required */
r = SSH_ERR_KEY_WRONG_PASSPHRASE;
goto out;
}
/* check size of encrypted key blob */
blocksize = cipher_blocksize(cipher);
if (encrypted_len < blocksize || (encrypted_len % blocksize) != 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* setup key */
keylen = cipher_keylen(cipher);
ivlen = cipher_ivlen(cipher);
authlen = cipher_authlen(cipher);
if ((key = calloc(1, keylen + ivlen)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (strcmp(kdfname, "bcrypt") == 0) {
if ((r = sshbuf_get_string(kdf, &salt, &slen)) != 0 ||
(r = sshbuf_get_u32(kdf, &rounds)) != 0)
goto out;
if (bcrypt_pbkdf(passphrase, strlen(passphrase), salt, slen,
key, keylen + ivlen, rounds) < 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
}
/* check that an appropriate amount of auth data is present */
if (sshbuf_len(decoded) < authlen ||
sshbuf_len(decoded) - authlen < encrypted_len) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* decrypt private portion of key */
if ((r = sshbuf_reserve(decrypted, encrypted_len, &dp)) != 0 ||
(r = cipher_init(&ciphercontext, cipher, key, keylen,
key + keylen, ivlen, 0)) != 0)
goto out;
if ((r = cipher_crypt(ciphercontext, 0, dp, sshbuf_ptr(decoded),
encrypted_len, 0, authlen)) != 0) {
/* an integrity error here indicates an incorrect passphrase */
if (r == SSH_ERR_MAC_INVALID)
r = SSH_ERR_KEY_WRONG_PASSPHRASE;
goto out;
}
if ((r = sshbuf_consume(decoded, encrypted_len + authlen)) != 0)
goto out;
/* there should be no trailing data */
if (sshbuf_len(decoded) != 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* check check bytes */
if ((r = sshbuf_get_u32(decrypted, &check1)) != 0 ||
(r = sshbuf_get_u32(decrypted, &check2)) != 0)
goto out;
if (check1 != check2) {
r = SSH_ERR_KEY_WRONG_PASSPHRASE;
goto out;
}
/* success */
*decryptedp = decrypted;
decrypted = NULL;
*pubkeyp = pubkey;
pubkey = NULL;
r = 0;
out:
cipher_free(ciphercontext);
free(ciphername);
free(kdfname);
sshkey_free(pubkey);
if (salt != NULL) {
explicit_bzero(salt, slen);
free(salt);
}
if (key != NULL) {
explicit_bzero(key, keylen + ivlen);
free(key);
}
sshbuf_free(kdf);
sshbuf_free(decrypted);
return r;
}
static int
sshkey_parse_private2(struct sshbuf *blob, int type, const char *passphrase,
struct sshkey **keyp, char **commentp)
{
char *comment = NULL;
int r = SSH_ERR_INTERNAL_ERROR;
struct sshbuf *decoded = NULL, *decrypted = NULL;
struct sshkey *k = NULL, *pubkey = NULL;
if (keyp != NULL)
*keyp = NULL;
if (commentp != NULL)
*commentp = NULL;
/* Undo base64 encoding and decrypt the private section */
if ((r = private2_uudecode(blob, &decoded)) != 0 ||
(r = private2_decrypt(decoded, passphrase,
&decrypted, &pubkey)) != 0)
goto out;
if (type != KEY_UNSPEC &&
sshkey_type_plain(type) != sshkey_type_plain(pubkey->type)) {
r = SSH_ERR_KEY_TYPE_MISMATCH;
goto out;
}
/* Load the private key and comment */
if ((r = sshkey_private_deserialize(decrypted, &k)) != 0 ||
(r = sshbuf_get_cstring(decrypted, &comment, NULL)) != 0)
goto out;
/* Check deterministic padding after private section */
if ((r = private2_check_padding(decrypted)) != 0)
goto out;
/* Check that the public key in the envelope matches the private key */
if (!sshkey_equal(pubkey, k)) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* success */
r = 0;
if (keyp != NULL) {
*keyp = k;
k = NULL;
}
if (commentp != NULL) {
*commentp = comment;
comment = NULL;
}
out:
free(comment);
sshbuf_free(decoded);
sshbuf_free(decrypted);
sshkey_free(k);
sshkey_free(pubkey);
return r;
}
static int
sshkey_parse_private2_pubkey(struct sshbuf *blob, int type,
struct sshkey **keyp)
{
int r = SSH_ERR_INTERNAL_ERROR;
struct sshbuf *decoded = NULL;
struct sshkey *pubkey = NULL;
u_int nkeys = 0;
if (keyp != NULL)
*keyp = NULL;
if ((r = private2_uudecode(blob, &decoded)) != 0)
goto out;
/* parse public key from unencrypted envelope */
if ((r = sshbuf_consume(decoded, sizeof(AUTH_MAGIC))) != 0 ||
(r = sshbuf_skip_string(decoded)) != 0 || /* cipher */
(r = sshbuf_skip_string(decoded)) != 0 || /* KDF alg */
(r = sshbuf_skip_string(decoded)) != 0 || /* KDF hint */
(r = sshbuf_get_u32(decoded, &nkeys)) != 0)
goto out;
if (nkeys != 1) {
/* XXX only one key supported at present */
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* Parse the public key */
if ((r = sshkey_froms(decoded, &pubkey)) != 0)
goto out;
if (type != KEY_UNSPEC &&
sshkey_type_plain(type) != sshkey_type_plain(pubkey->type)) {
r = SSH_ERR_KEY_TYPE_MISMATCH;
goto out;
}
/* success */
r = 0;
if (keyp != NULL) {
*keyp = pubkey;
pubkey = NULL;
}
out:
sshbuf_free(decoded);
sshkey_free(pubkey);
return r;
}
#ifdef WITH_OPENSSL
/* convert SSH v2 key to PEM or PKCS#8 format */
static int
sshkey_private_to_blob_pem_pkcs8(struct sshkey *key, struct sshbuf *buf,
int format, const char *_passphrase, const char *comment)
{
int was_shielded = sshkey_is_shielded(key);
int success, r;
int blen, len = strlen(_passphrase);
u_char *passphrase = (len > 0) ? (u_char *)_passphrase : NULL;
const EVP_CIPHER *cipher = (len > 0) ? EVP_aes_128_cbc() : NULL;
char *bptr;
BIO *bio = NULL;
struct sshbuf *blob;
EVP_PKEY *pkey = NULL;
if (len > 0 && len <= 4)
return SSH_ERR_PASSPHRASE_TOO_SHORT;
if ((blob = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
2021-04-03 08:47:37 +02:00
if ((bio = BIO_new(BIO_s_mem())) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
if (format == SSHKEY_PRIVATE_PKCS8 && (pkey = EVP_PKEY_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
2021-04-03 08:47:37 +02:00
}
if ((r = sshkey_unshield_private(key)) != 0)
goto out;
switch (key->type) {
#ifdef WITH_DSA
case KEY_DSA:
if (format == SSHKEY_PRIVATE_PEM) {
success = PEM_write_bio_DSAPrivateKey(bio, key->dsa,
cipher, passphrase, len, NULL, NULL);
} else {
success = EVP_PKEY_set1_DSA(pkey, key->dsa);
}
break;
#endif
#ifdef OPENSSL_HAS_ECC
case KEY_ECDSA:
if (format == SSHKEY_PRIVATE_PEM) {
success = PEM_write_bio_ECPrivateKey(bio, key->ecdsa,
cipher, passphrase, len, NULL, NULL);
} else {
success = EVP_PKEY_set1_EC_KEY(pkey, key->ecdsa);
}
break;
#endif
case KEY_RSA:
if (format == SSHKEY_PRIVATE_PEM) {
success = PEM_write_bio_RSAPrivateKey(bio, key->rsa,
cipher, passphrase, len, NULL, NULL);
} else {
success = EVP_PKEY_set1_RSA(pkey, key->rsa);
}
break;
default:
success = 0;
break;
}
if (success == 0) {
r = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (format == SSHKEY_PRIVATE_PKCS8) {
if ((success = PEM_write_bio_PrivateKey(bio, pkey, cipher,
passphrase, len, NULL, NULL)) == 0) {
r = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
}
if ((blen = BIO_get_mem_data(bio, &bptr)) <= 0) {
r = SSH_ERR_INTERNAL_ERROR;
goto out;
}
if ((r = sshbuf_put(blob, bptr, blen)) != 0)
goto out;
r = 0;
out:
if (was_shielded)
r = sshkey_shield_private(key);
if (r == 0)
r = sshbuf_putb(buf, blob);
EVP_PKEY_free(pkey);
sshbuf_free(blob);
BIO_free(bio);
return r;
}
#endif /* WITH_OPENSSL */
/* Serialise "key" to buffer "blob" */
int
sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
const char *passphrase, const char *comment,
int format, const char *openssh_format_cipher, int openssh_format_rounds)
{
switch (key->type) {
#ifdef WITH_OPENSSL
case KEY_DSA:
case KEY_ECDSA:
case KEY_RSA:
break; /* see below */
#endif /* WITH_OPENSSL */
case KEY_ED25519:
case KEY_ED25519_SK:
#ifdef WITH_XMSS
case KEY_XMSS:
#endif /* WITH_XMSS */
#ifdef WITH_OPENSSL
case KEY_ECDSA_SK:
#endif /* WITH_OPENSSL */
return sshkey_private_to_blob2(key, blob, passphrase,
comment, openssh_format_cipher, openssh_format_rounds);
default:
return SSH_ERR_KEY_TYPE_UNKNOWN;
}
#ifdef WITH_OPENSSL
switch (format) {
case SSHKEY_PRIVATE_OPENSSH:
return sshkey_private_to_blob2(key, blob, passphrase,
comment, openssh_format_cipher, openssh_format_rounds);
case SSHKEY_PRIVATE_PEM:
case SSHKEY_PRIVATE_PKCS8:
return sshkey_private_to_blob_pem_pkcs8(key, blob,
format, passphrase, comment);
default:
return SSH_ERR_INVALID_ARGUMENT;
}
#endif /* WITH_OPENSSL */
}
#ifdef WITH_OPENSSL
static int
translate_libcrypto_error(unsigned long pem_err)
{
int pem_reason = ERR_GET_REASON(pem_err);
switch (ERR_GET_LIB(pem_err)) {
case ERR_LIB_PEM:
switch (pem_reason) {
case PEM_R_BAD_PASSWORD_READ:
2023-03-24 05:23:05 +01:00
#ifdef PEM_R_PROBLEMS_GETTING_PASSWORD
case PEM_R_PROBLEMS_GETTING_PASSWORD:
2023-03-24 05:23:05 +01:00
#endif
#ifdef PEM_R_BAD_DECRYPT
case PEM_R_BAD_DECRYPT:
2023-03-24 05:23:05 +01:00
#endif
return SSH_ERR_KEY_WRONG_PASSPHRASE;
default:
return SSH_ERR_INVALID_FORMAT;
}
case ERR_LIB_EVP:
switch (pem_reason) {
2023-03-24 05:23:05 +01:00
#ifdef EVP_R_BAD_DECRYPT
case EVP_R_BAD_DECRYPT:
return SSH_ERR_KEY_WRONG_PASSPHRASE;
2023-03-24 05:23:05 +01:00
#endif
#ifdef EVP_R_BN_DECODE_ERROR
case EVP_R_BN_DECODE_ERROR:
#endif
case EVP_R_DECODE_ERROR:
#ifdef EVP_R_PRIVATE_KEY_DECODE_ERROR
case EVP_R_PRIVATE_KEY_DECODE_ERROR:
#endif
return SSH_ERR_INVALID_FORMAT;
default:
return SSH_ERR_LIBCRYPTO_ERROR;
}
case ERR_LIB_ASN1:
return SSH_ERR_INVALID_FORMAT;
}
return SSH_ERR_LIBCRYPTO_ERROR;
}
static void
clear_libcrypto_errors(void)
{
while (ERR_get_error() != 0)
;
}
/*
* Translate OpenSSL error codes to determine whether
* passphrase is required/incorrect.
*/
static int
convert_libcrypto_error(void)
{
/*
* Some password errors are reported at the beginning
* of the error queue.
*/
if (translate_libcrypto_error(ERR_peek_error()) ==
SSH_ERR_KEY_WRONG_PASSPHRASE)
return SSH_ERR_KEY_WRONG_PASSPHRASE;
return translate_libcrypto_error(ERR_peek_last_error());
}
static int
pem_passphrase_cb(char *buf, int size, int rwflag, void *u)
{
char *p = (char *)u;
size_t len;
if (p == NULL || (len = strlen(p)) == 0)
return -1;
if (size < 0 || len > (size_t)size)
return -1;
memcpy(buf, p, len);
return (int)len;
}
static int
sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
const char *passphrase, struct sshkey **keyp)
{
EVP_PKEY *pk = NULL;
struct sshkey *prv = NULL;
BIO *bio = NULL;
int r;
if (keyp != NULL)
*keyp = NULL;
if ((bio = BIO_new(BIO_s_mem())) == NULL || sshbuf_len(blob) > INT_MAX)
return SSH_ERR_ALLOC_FAIL;
if (BIO_write(bio, sshbuf_ptr(blob), sshbuf_len(blob)) !=
(int)sshbuf_len(blob)) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
clear_libcrypto_errors();
if ((pk = PEM_read_bio_PrivateKey(bio, NULL, pem_passphrase_cb,
(char *)passphrase)) == NULL) {
/*
* libcrypto may return various ASN.1 errors when attempting
* to parse a key with an incorrect passphrase.
* Treat all format errors as "incorrect passphrase" if a
* passphrase was supplied.
*/
if (passphrase != NULL && *passphrase != '\0')
r = SSH_ERR_KEY_WRONG_PASSPHRASE;
else
r = convert_libcrypto_error();
goto out;
}
if (EVP_PKEY_base_id(pk) == EVP_PKEY_RSA &&
(type == KEY_UNSPEC || type == KEY_RSA)) {
if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
prv->rsa = EVP_PKEY_get1_RSA(pk);
prv->type = KEY_RSA;
#ifdef DEBUG_PK
RSA_print_fp(stderr, prv->rsa, 8);
#endif
if (RSA_blinding_on(prv->rsa, NULL) != 1) {
r = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
Merge 9.1 (#626) * upstream: fix poll() spin when a channel's output fd closes without data in the channel buffer. Introduce more exact packing of channel fds into the pollfd array. fixes bz3405 and bz3411; ok deraadt@ markus@ OpenBSD-Commit-ID: 06740737849c9047785622ad5d472cb6a3907d10 * upstream: select post-quantum KEX sntrup761x25519-sha512@openssh.com as the default; ok markus@ OpenBSD-Commit-ID: f02d99cbfce22dffec2e2ab1b60905fbddf48fb9 * upstream: add support for the "corp-data" protocol extension to allow server-side copies to be performed without having to go via the client. Patch by Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: 00aa510940fedd66dab1843b58682de4eb7156d5 * upstream: add a sftp client "cp" command that supports server-side copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444 * depend * Skip slow tests on (very) slow test targets. * Set Makefile SHELL as determined by configure. This should improve compatibility for users with non-POSIX shells. If using Makefile.in directly (eg make -f Makefile.in distprep) then SHELL will need to be specified on the command line (along with MANFMT in that particular case). ok djm@ * Use bash or ksh if available for SH in Makefile. * Increase test timeout to allow slow VMs to finish * Only run regression tests on slow VMs. * Only return events from ppoll that were requested. If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@ * Specify TEST_SHELL=bash on AIX. The system shells cause the agent-restrict test to fail due to some quoting so explicitly specify bash until we can get configure to autmatically work around that. * Disable security key on fbsd6 test host. * upstream: man pages: add missing commas between subordinate and main clauses jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@ OpenBSD-Commit-ID: 9520801729bebcb3c9fe43ad7f9776ab4dd05ea3 * upstream: ssh: document sntrup761x25519-sha512@openssh.com as default KEX OpenBSD-Commit-ID: 12545bfa10bcbf552d04d9d9520d0f4e98b0e171 * upstream: openssh-9.0 OpenBSD-Commit-ID: 0dfb461188f4513ec024c1534da8c1ce14c20b64 * update version numbers for release * update build-aux files to match autoconf-2.71 i.e. config.guess, config.sub and install-sh * Revert "update build-aux files to match autoconf-2.71" This reverts commit 0a8ca39fac6ad19096b6c263436f8b2dd51606f2. It turns out that the checked-in copies of these files are actually newer than autoconf-2.71's copies, so this was effectively a downgrade. Spotted by Bo Anderson via github * upstream: two defensive changes from Tobias Stoeckmann via GHPR287 enforce stricter invarient for sshbuf_set_parent() - never allow a buffer to have a previously-set parent changed. In sshbuf_reset(), if the reallocation fails, then zero the entire buffer and not the (potentially smaller) default initial alloc size. OpenBSD-Commit-ID: 14583203aa5d50ad38d2e209ae10abaf8955e6a9 * upstream: Note that curve25519-sha256 was later published in RFC8731. ok djm@ OpenBSD-Commit-ID: 2ac2b5d642d4cf5918eaec8653cad9a4460b2743 * upstream: clear io_want/io_ready flags at start of poll() cycle; avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@ OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967 * Retire fbsd6 test VM. It's long since out of support, relatively slow (it's i686) and the compiler has trouble with PIE. * Resync moduli.5 with upstream. 1.18: remove duplicate publication year; carsten dot kunze at arcor dot de 1.19: ssh-keygen's -G/-T have been replaced with -M generate/screen. * upstream: Correct path for system known hosts file in description of IgnoreUserKnownHosts. Patch from Martin Vahlensieck via tech@ OpenBSD-Commit-ID: 9b7784f054fa5aa4d63cb36bd563889477127215 * upstream: list the correct version number for when usage of the sftp protocol became default and fix a typo from ed maste OpenBSD-Commit-ID: 24e1795ed2283fdeacf16413c2f07503bcdebb31 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: Try to continue running local I/O for channels in state OPEN during SSH transport rekeying. The most visible benefit is that it should make ~-escapes work in the client (e.g. to exit) if the connection happened to have stalled during a rekey event. Based work by and ok dtucker@ OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45 * upstream: Import regenerated moduli OpenBSD-Commit-ID: f9a0726d957cf10692a231996a1f34e7f9cdfeb0 * upstream: regression test for sftp cp command OpenBSD-Regress-ID: c96bea9edde3a384b254785e7f9b2b24a81cdf82 * upstream: Simplify forward-control test. Since we no longer need to support SSH1 we don't need to run shell commands on the other end of the connection and can use ssh -N instead. This also makes the test less racy. OpenBSD-Regress-ID: 32e94ce272820cc398f30b848b2b0f080d10302c * upstream: Use ssh -f and ControlPersist .. to start up test forwards and ssh -O stop to shut them down intead of sleep loops. This speeds up the test by an order of magnitude. OpenBSD-Regress-ID: eb3db5f805100919b092a3b2579c611fba3e83e7 * upstream: It looks like we can't completely avoid waiting for processes to exit so retrieve the pid via controlmaster and use that. OpenBSD-Regress-ID: 8246f00f22b14e49d2ff1744c94897ead33d457b * Cache timezone data in capsicum sandbox. From emaste at freebsd.org, originally part of FreeBSD commit r339216 / fc3c19a9 with autoconf bits added by me. * Include stdlib.h for free() prototype. ... which is used inside the CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG block. * Update OpenSSL and LibreSSL versions in tests. * Add debian-riscv64 test target. * upstream: Avoid an unnecessary xstrdup in rm_env() when matching patterns. Since match_pattern() doesn't modify its arguments (they are const), there is no need to make an extra copy of the strings in options->send_env. From Martin Vahlensieck OpenBSD-Commit-ID: 2c9db31e3f4d3403b49642c64ee048b2a0a39351 * upstream: Add missing includes of stdlib.h and stdint.h. We need stdlib.h for malloc(3) and stdint.h for SIZE_MAX. Unlike the other xmss files, ssh-xmss.c does not include xmss_commons.h so ssh-xmss.c must include those headers itself. From Martin Vahlensieck OpenBSD-Commit-ID: 70e28a9818cee3da1be2ef6503d4b396dd421e6b * upstream: Remove unnecessary includes: openssl/hmac.h and openssl/evp.h. From Martin Vahlensieck. OpenBSD-Commit-ID: a6debb5fb0c8a44e43e8d5ca7cc70ad2f3ea31c3 * upstream: Check sshauthopt_new() for NULL. bz#3425, from tessgauthier at microsoft.com. ok djm@ OpenBSD-Commit-ID: af0315bc3e44aa406daa7e0ae7c2d719a974483f * upstream: Add authfd path to debug output. ok markus@ OpenBSD-Commit-ID: f735a17d1a6f2bee63bfc609d76ef8db8c090890 * upstream: avoid printing hash algorithm twice; from lucas AT sexy.is OpenBSD-Commit-ID: 9d24671e10a84141b7c504396cabad600e47a941 * upstream: fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@ OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e * upstream: Don't leak SK device. Patch from Pedro Martelletto via github PR#316. ok djm@ OpenBSD-Commit-ID: 17d11327545022e727d95fd08b213171c5a4585d * upstream: mention that the helpers are used by ssh(1), ssh-agent(1) and ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto OpenBSD-Commit-ID: 30f880f989d4b329589c1c404315685960a5f153 * Remove now-empty int32_minmax.inc. * Only run tests when source files change. Also run tests on changes to V_9_0 branch. * Add Mac OS X 12 test target. * upstream: be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ OpenBSD-Commit-ID: e267746c047ea86665cdeccef795a8a56082eeb2 * upstream: fix some integer overflows in sieve_large() that show up when trying to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@ OpenBSD-Commit-ID: 81cbc6dd3a21c57bd6fadea10e44afe37bca558e * upstream: remove an obsolete rsa1 format example from an example; from megan batty ok djm OpenBSD-Commit-ID: db2c89879c29bf083df996bd830abfb1e70d62bf * upstream: Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. The wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy OpenBSD-Commit-ID: dd98748d7644df048f78dcf793b3b63db9ab1d25 * upstream: make sure stdout is non-blocking; ok djm@ OpenBSD-Commit-ID: 64940fffbd1b882eda2d7c8c7a43c79368309c0d * upstream: mux.c: mark argument as const; from Martin Vahlensieck OpenBSD-Commit-ID: 69a1a93a55986c7c2ad9f733c093b46a47184341 * upstream: channel_new no longer frees remote_name. So update the comment accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck OpenBSD-Commit-ID: e4e10dc8dc9f40c166ea5a8e991942bedc75a76a * upstream: sshkey_unshield_private() contains a exact duplicate of the code in private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@ OpenBSD-Commit-ID: 876884c3f0e62e8fd8d1594bab06900f971c9c85 * Add ubsan minimal testcase on OpenBSD. As suggested by djm@. * Note that, for now, we need variadic macros. * Also retest OpenBSD upstream on .yml changes. * upstream: When performing operations that glob(3) a remote path, ensure that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef * Remove duplicate bcrypt_pbkdf.o from Makefile bcrypt_pbkdf.o is duplicated in the openbsd-compat Makefile's object file list. * upstream: improve error message when 'ssh-keygen -Y sign' is unable to load a private key; bz3429, reported by Adam Szkoda ok dtucker@ OpenBSD-Commit-ID: bb57b285e67bea536ef81b1055467be2fc380e74 * upstream: Allow existing -U (use agent) flag to work with "-Y sign" operations, where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@ OpenBSD-Commit-ID: a7bc69873b99c32c42c7628ed9ea91565ba08c2f * upstream: Remove errant apostrophe. From haruyama at queen-ml org. OpenBSD-Commit-ID: dc6b294567cb84b384ad6ced9ca469f2bbf0bd10 * upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 * upstream: fix in-place copies; r1.163 incorrectly skipped truncation in all cases, not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@ OpenBSD-Commit-ID: b189f19cd68119548c8e24e39c79f61e115bf92c * upstream: Only run agent-ptrace.sh if gdb is available as all architectures do not ship with gdb. OpenBSD-Regress-ID: ec53e928803e6b87f9ac142d38888ca79a45348d * upstream: regress test for in-place transfers and clobbering larger files with smaller ones; would have caught last regression in scp(1) OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2 * configure.ac: Add missing AC_DEFINE for caph_cache_tzdata test causing HAVE_CAPH_CACHE_TZDATA to be missing from config.h.in. Spotted by Bryan Drewery * upstream: make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via #define) dump to stderr rather than stdout OpenBSD-Commit-ID: 10298513ee32db8390aecb0397d782d68cb14318 * upstream: revert previous; it was broken (spotted by Theo) OpenBSD-Commit-ID: 457c79afaca2f89ec2606405c1059b98b30d8b0d * upstream: Note that ProxyJump also accepts the same tokens as ProxyCommand. From pallxk via github PR#305. OpenBSD-Commit-ID: 7115ac351b129205f1f1ffa6bbfd62abd76be7c5 * upstream: Avoid kill with -1 argument. The out_ctx label can be reached before fork has been called. If this happens, then kill -1 would be called, sending SIGTERM to all processes reachable by the current process. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8 * upstream: f sshpkt functions fail, then password is not cleared with freezero. Unconditionally call freezero to guarantee that password is removed from RAM. From tobias@ and c3h2_ctf via github PR#286, ok djm@ OpenBSD-Commit-ID: 6b093619c9515328e25b0f8093779c52402c89cd * upstream: refactor authorized_keys/principals handling remove "struct ssh *" from arguments - this was only used to pass the remote host/address. These can be passed in instead and the resulting code is less tightly coupled to ssh_api.[ch] ok dtucker@ OpenBSD-Commit-ID: 9d4373d013edc4cc4b5c21a599e1837ac31dda0d * upstream: split the low-level file handling functions out from auth2-pubkey.c Put them in a new auth2-pubkeyfile.c to make it easier to refer to them (e.g. in unit/fuzz tests) without having to refer to everything else pubkey auth brings in. ok dtucker@ OpenBSD-Commit-ID: 3fdca2c61ad97dc1b8d4a7346816f83dc4ce2217 * fuzzer for authorized_keys parsing mostly redundant to authopt_fuzz, but it's sensitive code so IMO it makes sense to test this layer too * Test against LibreSSL 3.5.3. * Test against OpenSSL 1.1.1o and 3.0.3. * fix some bugs in the fuzzer * upstream: keywords ref ssh_config.5; from caspar schutijser OpenBSD-Commit-ID: f146a19d7d5c9374c3b9c520da43b2732d7d1a4e * upstream: ssh-keygen: implement "verify-required" certificate option. This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@ OpenBSD-Commit-ID: f660f973391b593fea4b7b25913c9a15c3eb8a06 * upstream: ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303 from jsegitz with man page text from jmc@, ok markus@ djm@ OpenBSD-Commit-ID: 5c4c57bdd7063ff03381cfb6696659dd3f9f5b9f * upstream: Add period at end of "not known by any other names" message. github PR#320 from jschauma, ok djm@ OpenBSD-Commit-ID: bd60809803c4bfd3ebb7c5c4d918b10e275266f2 * upstream: Add missing *-sk types to ssh-keyscan manpage. From skazi0 via github PR#294. OpenBSD-Commit-ID: fda2c869cdb871f3c90a89fb3f985370bb5d25c0 * upstream: Make SetEnv directives first-match-wins in both sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b * upstream: test setenv in both client and server, test first-match-wins too OpenBSD-Regress-ID: 4c8804f9db38a02db480b9923317457b377fe34b * upstream: move auth_openprincipals() and auth_openkeyfile() over to auth2-pubkeyfile.c too; they make more sense there. OpenBSD-Commit-ID: 9970d99f900e1117fdaab13e9e910a621b7c60ee * upstream: make sure that UseDNS hostname lookup happens in the monitor and not in the pledge(2)'d unprivileged process; fixes regression caused by recent refactoring spotted by henning@ OpenBSD-Commit-ID: a089870b95101cd8881a2dff65b2f1627d13e88d * fix possible NULL deref when built without FIDO Analysis/fix from kircher in bz3443; ok dtucker@ * automatically enable built-in FIDO support If libfido2 is found and usable, then enable the built-in security key support unless --without-security-key-builtin was requested. ok dtucker@ * upstream: Log an error if pipe() fails while accepting a connection. bz#3447, from vincent-openssh at vinc17 net, ok djm@ OpenBSD-Commit-ID: 9d59f19872b94900a5c79da2d57850241ac5df94 * upstream: Don't attempt to fprintf a null identity comment. From Martin Vahlensieck via tech@. OpenBSD-Commit-ID: 4c54d20a8e8e4e9912c38a7b4ef5bfc5ca2e05c2 * upstream: Make sure not to fclose() the same fd twice in case of an error. ok dtucker@ OpenBSD-Commit-ID: e384c4e05d5521e7866b3d53ca59acd2a86eef99 * upstream: make it clear that RekeyLimit applies to both transmitted and received data. GHPR#328 from Jan Pazdziora OpenBSD-Commit-ID: d180a905fec9ff418a75c07bb96ea41c9308c3f9 * request 1.1x API compatibility for OpenSSL >=3.x idea/patch from Pedro Martelletto via GHPR#322; ok dtucker@ * fix broken case statement in previous * Disable SK support if FIDO libs not found. * Zero out LIBFIDO2 when SK support not usable. Prevents us from trying to link them into ssh-sk-helper and failing to build. * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ OpenBSD-Commit-ID: b2f6e5f60f2bba293b831654328a8a0035ef4a1b * upstream: Roll back previous KEX changes as they aren't safe until compat_pkalg_proposal and friends always allocate their returned strings. Reported by Qualys. OpenBSD-Commit-ID: 1c7a88a0d5033f42f88ab9bec58ef1cf72c81ad0 * upstream: allow arguments to sftp -D option, e.g. sftp -D "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce * Update OpenSSL tests to the most recent releases. * upstream: reflect the update to -D arg name in usage(); OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c * upstream: ignore SIGPIPE earlier in main(), specifically before muxclient() which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@ OpenBSD-Commit-ID: 63d8e13276869eebac6d7a05d5a96307f9026e47 * upstream: Always return allocated strings from the kex filtering so that we can free them later. Fix one leak in compat_kex_proposal. Based on github PR#324 from ZoltanFridrich with some simplications by me. ok djm@ OpenBSD-Commit-ID: 9171616da3307612d0ede086fd511142f91246e4 * upstream: Don't leak the strings allocated by order_hostkeyalgs() and list_hostkey_types() that are passed to compat_pkalg_proposal(). Part of github PR#324 from ZoltanFridrich, ok djm@ This is a roll-forward of the previous rollback now that the required changes in compat.c have been done. OpenBSD-Commit-ID: c7cd93730b3b9f53cdad3ae32462922834ef73eb * upstream: bump up loglevel from debug to info when unable to open authorized keys/principals file for errno != ENOENT; bz2042 ok dtucker OpenBSD-Commit-ID: e79aa550d91ade6a80f081bda689da24c086d66b * Skip select+rlimit check if sandboxing is disabled It's not needed in that case, and the test can fail when being built with some compiler memory sanitizer flags. bz#3441 * upstream: use consistent field names (s/char/byte) in format description OpenBSD-Commit-ID: 3de33572733ee7fcfd7db33d37db23d2280254f0 * upstream: Remove leftover line. Remove extra line leftover from merge conflict. ok djm@ OpenBSD-Commit-ID: 460e2290875d7ae64971a7e669c244b1d1c0ae2e * Move checks for pollfd.fd and nfds_t. Move the checks for struct pollfd.fd and nfds_t to before the sandboxing checks. This groups all the sandbox checks together so we can skip them all when sandboxing is disabled. * Skip all rlimit tests when sandboxing disabled. The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no. * Add clang sanitizer tests. * upstream: Add TEST_REGRESS_CACHE_DIR. If set, it is used to cache regress test names that have succeeded and skip those on a re-run. OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247 * Move sanitizer logs into regress for collection. * Add GCC address sanitizer build/test. * Update sanitizer test targets: - remove clang-sanitize-memory for now. It takes so long that the test times out. - add gcc sanitize-address and sanitize-undefined test targets. * Test against openssl-3.0.5. * Move unset to before we set anything. * Refuse to use OpenSSL 3.0.4 due to potential RCE. OpenSSL has a potential RCE in its RSA implementation (CVE-2022-2274) so refuse to use that specific version. * Capture stderr output from configure. * Only refuse to use OpenSSL 3.0.4 on x86_64. The potential RCE only impacts x86_64, so only refuse to use it if we're targetting a potentially impacted architecture. ok djm@ * Remove special casing of crypt(). Configure goes to some lengths to pick crypt() from either libcrypt or OpenSSL's libcrypto because they can more or less featureful (eg supporting md5-style passwords). OpenSSL removed its crypt() interface in 2002: https://github.com/openssl/openssl/commit/69deec58 so these hijinks should no longer be necessary. This also only links sshd with libcrypt which is the only thing that needs it. ok djm@ * Clarify README.md text. Clarify the text about the implications of building without OpenSSL, and prefix the "configure --help" example command with a "./" so it's likely to work as-is in more shells. From bz#3461. * Split README.platform into its own line. README.platform has general platform-specific information, having it following text about FIDO2 on the same line could imply that it only has information about FIDO2. * Return ERANGE from getcwd() if buffer size is 1. If getcwd() is supplied a buffer size of exactly 1 and a path of "/", it could result in a nul byte being written out of array bounds. POSIX says it should return ERANGE if the path will not fit in the available buffer (with terminating nul). 1 byte cannot fit any possible path with its nul, so immediately return ERANGE in that case. OpenSSH never uses getcwd() with this buffer size, and all current (and even quite old) platforms that we are currently known to work on have a native getcwd() so this code is not used on those anyway. Reported by Qualys, ok djm@ * Remove unintended changes. I inadvertently included a couple of local changes with the OpenSSL 3.0.4 change. Revert, anything that should be there will be committed separately. * Add AUDIT_ARCH_PPC to supported seccomp arches. Patch from dries.deschout at dodeco.eu. * Rename bbone test target to ARM. * Move vmshutdown to first step. If a previous run on a physical runner has failed to clean up, the next run will fail because it'll try to check out the code to a broken directory mount. Make cleanup the first step. * upstream: pull passphrase reading and confirmation into a separate function so it can be used for FIDO2 PINs; no functional change OpenBSD-Commit-ID: bf34f76b8283cc1d3f54633e0d4f13613d87bb2f * upstream: when enrolling a resident key on a security token, check if a credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust OpenBSD-Commit-ID: e45e9f1bf2b2f32d9850669e7a8dbd64acc5fca4 * upstream: sk-usbhid: preserve error code returned by key_lookup() it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b * upstream: ssh-keygen: fix touch prompt, pin retries; part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: 75d1005bd2ef8f29fa834c90d2684e73556fffe8 * crank SSH_SK_VERSION_MAJOR in sk-dummy.so * Skip scp3 test if there's no scp on remote path. scp -3 ends up using the scp that's in the remote path and will fail if one is not available. Based on a patch from rapier at psc.edu. * Convert "have_prog" function into "which". "which" and its behaviour is not standardized, so convert the existing have_prog function into "which" so we can rely on it being available and what its semantics are. Add a have_prog wrapper that maintains the existing behaviour. * upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not executable. No-op on most platforms but should prevent warnings in -portable on systems that don't have 'date %s'. OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4 * upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test. OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0 * Remove workarounds for OpenSSL missing AES-GCM. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES GCM mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have GCM, so this is no longer needed. ok djm@ * Remove workarounds for OpenSSL missing AES-CTR. We have some compatibility hacks that were added to support OpenSSL versions that do not support AES CTR mode. Since that time, however, the minimum OpenSSL version that we support has moved to 1.0.1 which *does* have CTR, so this is no longer needed. ok djm@ * Do not link scp, sftp and sftp-server w/ zlib. Some of our binaries (eg sftp, sftp-server, scp) do not interact with the channels code and thus do use libraries such as zlib and libcrypto although they are linked with them. This adds a CHANNELLIBS and starts by moving zlib into it, which means the aformentioned binaries are no longer linked against zlib. ok djm@ * Group libcrypto and PRNGD checks together. They're related more than the libcrypt or libiaf checks which are currently between them. ok djm@ * Remove seed_rng calls from scp, sftp, sftp-server. These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@ * Move libcrypto into CHANNELLIBS. This will result in sftp, sftp-server and scp no longer being linked against libcrypto. ok djm@ * Move stale-configure check as early as possible. We added a check in Makefile to catch the case where configure needs to be rebuilt, however this did not happen until a build was attempted in which case all of the work done by configure was wasted. Move this check to the start of configure to catch it as early as possible. ok djm@ * Remove deprecated MacOS 10.15 runners. * upstream: avoid double-free in error path introduced in r1.70; report and fix based on GHPR#332 by v-rzh ok dtucker@ OpenBSD-Commit-ID: 3d21aa127b1f37cfc5bdc21461db369a663a951f * Include CHANNEL and FIDO2 libs in configure output * Factor out getrnd() and rename to getentropy(). Factor out the arc4random seeding into its own file and change the interface to match getentropy. Use native getentropy if available. This will make it easier to resync OpenBSD changes to arc4random. Prompted by bz#3467, ok djm@. * compat code for fido_dev_is_winhello() Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * check_sk_options: add temporary WinHello workaround Up to libfido 1.10.0, WinHello advertises "clientPin" rather than "uv" capability. This is fixed in 1.11.0. For the time being, workaround it here. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * sk_sign: set FIDO2 uv attribute explicitely for WinHello WinHello via libfido2 performs user verification by default. However, if we stick to that, there's no way to differentiate between keys created with or without "-O verify-required". Set FIDO2 uv attribute explicitely to FIDO_OPT_FALSE, then check if user verification has been requested. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: don't prompt for FIDO passphrase before attempting to enroll the credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@ OpenBSD-Commit-ID: bd5342ffc353ee37d39617906867c305564d1ce2 * Give unused param a name. Fixes builds on platforms that do have fido2 but don't have fido_dev_is_winhello. * Actually put HAVE_STDINT_H around the stdint.h. * Rename our getentropy to prevent possible loops. Since arc4random seeds from getentropy, and we use OpenSSL for that if enabled, there's the possibility that if we build on a system that does not have getentropy then run on a system that does have it, then OpenSSL could end up calling our getentropy and getting stuck in a loop. Pointed out by deraadt@, ok djm@ * Test hostbased auth on github runners. * fix SANDBOX_SECCOMP_FILTER_DEBUG * Fix conditional for running hostbased tests. * upstream: allow certificate validity intervals, sshsig verification times and authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13 * upstream: add some tests for parse_absolute_time(), including cases where it is forced to the UTC timezone. bz3468 ok dtucker OpenBSD-Regress-ID: ea07ca31c2f3847a38df028ca632763ae44e8759 * Skip hostbased during Valgrind tests. Valgrind doesn't let ssh exec ssh-keysign (because it's setuid) so skip it during the Valgrind based tests. See https://bugs.kde.org/show_bug.cgi?id=119404 for a discussion of this (ironically there the problematic binary was ssh(1) back when it could still be setuid). * Rerun tests if any .github config file changes. * Add a timegm implementation from Heimdal via Samba. Fixes build on (at least Solaris 10). * Replace deprecated ubuntu-18.04 runners with 22.04 * upstream: sftp-server: support home-directory request Add support to the sftp-server for the home-directory extension defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the existing expand-path@openssh.com, but uses a more official protocol name, and so is a bit more likely to be implemented by non-OpenSSH clients. From Mike Frysinger, ok dtucker@ OpenBSD-Commit-ID: bfc580d05cc0c817831ae7ecbac4a481c23566ab * fido_dev_is_winhello: return 0, not "false" "false" is not used anywhere in OpenSSH, so return 0 like everywhere else. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * Revert "check_sk_options: add temporary WinHello workaround" Cygwin now comes with libfido2 1.11.0, so this workaround isn't required anymore. This reverts commit 242c044ab111a37aad3b0775727c36a4c5f0102c. Signed-off-by: Corinna Vinschen <vinschen@redhat.com> * upstream: use .Cm for "sign"; from josiah frentsos OpenBSD-Commit-ID: 7f80a53d54857ac6ae49ea6ad93c5bd12231d1e4 * upstream: add an extra flag to sk_probe() to indicate whether we're probing for a FIDO resident key or not. Unused here, but will make like easier for portable OpenBSD-Commit-ID: 432c8ff70e270378df9dbceb9bdeaa5b43b5a832 * on Cygwin, prefer WinHello FIDO device If no FIDO device was explictly specified, then prefer the windows://hello FIDO device. An exception to this is when probing resident FIDO keys, in which case hardware FIDO devices are preferred. * Check for perms to run agent-getpeereid test. Ubuntu 22.04 defaults to private home dirs which prevents "nobody" running ssh-add during the agent-getpeereid test. Check for this and add the necessary permissions. * upstream: double free() in error path; from Eusgor via GHPR333 OpenBSD-Commit-ID: 39f35e16ba878c8d02b4d01d8826d9b321be26d4 * Add Cygwin (on windows-2019) test target. In addition to installing the requisite Cygwin packages, we also need to explicitly invoke "sh" for steps that run other scripts since the runner environment doesn't understand #! paths. * Add a bit more debug output. * Fix cygwin conditional steps. * upstream: Strictly enforce the maximum allowed SSH2 banner size in ssh-keyscan and prevent a one-byte buffer overflow. Patch from Qualys, ok djm@ OpenBSD-Commit-ID: 6ae664f9f4db6e8a0589425f74cd0bbf3aeef4e4 * upstream: remove incorrect check that can break enrolling a resident key (introduced in r1.40) OpenBSD-Commit-ID: 4cab364d518470e29e624af3d3f9ffa9c92b6f01 * upstream: attemp FIDO key signing without PIN and use the error code returned to fall back only if necessary. Avoids PIN prompts for FIDO tokens that don't require them; part of GHPR#302 OpenBSD-Commit-ID: 4f752aaf9f2e7c28bcaaf3d4f8fc290131bd038e * Install Cygwin packages based on OS not config. * initial list of allowed signers * upstream: whitespace OpenBSD-Commit-ID: d297e4387935d4aef091c5e9432578c2e513f538 * upstream: whitespace OpenBSD-Commit-ID: a5d015efbfd228dc598ffdef612d2da3a579e5d8 * Add cygwin-release test target. This also moves the cygwin package install from the workflow file to setup_ci.sh so that we can install different sets of Cygwin packages for different test configs. * Add Windows 2022 test targets. * Add libcrypt-devel to cygwin-release deps. Based on feedback from vinschen at redhat.com. * cross-sign allowed_signers with PGP key Provides continuity of trust from legacy PGP release key to the SSHSIG signing keys that we will use henceforth for git signing. * additional keys * upstream: whitespace OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232 * Move sftp from valgrind-2 to 3 to rebalance. * upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV explicitly test whether the token performs built-in UV (e.g. biometric tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388 OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd * Remove arc4random_uniform from arc4random.c This was previously moved into its own file (matching OpenBSD) which prematurely committed in commit 73541f2. * Move OPENBSD ORIGINAL marker. Putting this after the copyright statement (which doesn't change) instead of before the version identifier (which does) prevents merge conflicts when resyncing changes. * Resync arc4random with OpenBSD. This brings us up to current, including djm's random-reseeding change, as prompted by logan at cyberstorm.mu in bz#3467. It brings the platform-specific hooks from LibreSSL Portable, simplified to match our use case. ok djm@. * Remove DEF_WEAK, it's already in defines.h. * openbsd-compat/bsd-asprintf: add <stdio.h> include for vsnprintf Fixes the following build failure with Clang 15 on musl: ``` bsd-asprintf.c:51:8: error: call to undeclared library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)'; ISO C99 and laterclang -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/usr/lib/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c cipher-aes.c -o cipher-aes.o do not support implicit function declarations [-Wimplicit-function-declaration] ret = vsnprintf(string, INIT_SZ, fmt, ap2); ^ bsd-asprintf.c:51:8: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf' 1 error generated. ``` * upstream: notifier_complete(NULL, ...) is a noop, so no need to test that ctx!=NULL; from Corinna Vinschen OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a * fix pester test failures * upstream: fix repeated words ok miod@ jmc@ OpenBSD-Commit-ID: 6765daefe26a6b648cc15cadbbe337596af709b7 * upstream: .Li -> .Vt where appropriate; from josiah frentsos, tweaked by schwarze ok schwarze OpenBSD-Commit-ID: 565046e3ce68b46c2f440a93d67c2a92726de8ed * upstream: ssh-agent: attempt FIDO key signing without PIN and use the error to determine whether a PIN is required and prompt only if necessary. from Corinna Vinschen OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd * upstream: a little extra debugging OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a * upstream: sk_enroll: never drop SSH_SK_USER_VERIFICATION_REQD flag from response Now that all FIDO signing calls attempt first without PIN and then fall back to trying PIN only if that attempt fails, we can remove the hack^wtrick that removed the UV flag from the keys returned during enroll. By Corinna Vinschen OpenBSD-Commit-ID: 684517608c8491503bf80cd175425f0178d91d7f * define HAVE_KILLPG * upstream: sftp: Don't attempt to complete arguments for non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a * upstream: sftp: Be a bit more clever about completions There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b * upstream: correct error value OpenBSD-Commit-ID: 780efcbad76281f11f14b2a5ff04eb6db3dfdad4 * upstream: actually hook up restrict_websafe; the command-line flag was never actually used. Spotted by Matthew Garrett OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1 * upstream: Add a sshkey_check_rsa_length() call for checking the length of an RSA key; ok markus@ OpenBSD-Commit-ID: de77cd5b11594297eda82edc594b0d32b8535134 * upstream: add a RequiredRSASize for checking RSA key length in ssh(1). User authentication keys that fall beneath this limit will be ignored. If a host presents a host key beneath this limit then the connection will be terminated (unfortunately there are no fallbacks in the protocol for host authentication). feedback deraadt, Dmitry Belyavskiy; ok markus@ OpenBSD-Commit-ID: 430e339b2a79fa9ecc63f2837b06fdd88a7da13a * upstream: Add RequiredRSASize for sshd(8); RSA keys that fall beneath this limit will be ignored for user and host-based authentication. Feedback deraadt@ ok markus@ OpenBSD-Commit-ID: 187931dfc19d51873df5930a04f2d972adf1f7f1 * upstream: better debugging for connect_next() OpenBSD-Commit-ID: d16a307a0711499c971807f324484ed3a6036640 * upstream: sftp-server(8): add a "users-groups-by-id@openssh.com" extension request that allows the client to obtain user/group names that correspond to a set of uids/gids. Will be used to make directory listings more useful and consistent in sftp(1). ok markus@ OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3 * upstream: extend sftp-common.c:extend ls_file() to support supplied user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0 * upstream: sftp client library support for users-groups-by-id@openssh.com; ok markus@ OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de * upstream: use users-groups-by-id@openssh.com sftp-server extension (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e * avoid Wuninitialized false positive in gcc-12ish * no need for glob.h here it also causes portability problems * add debug on appveyor * add sleep to pester test * upstream: add RequiredRSASize to the list of keywords accepted by -o; spotted by jmc@ OpenBSD-Commit-ID: fe871408cf6f9d3699afeda876f8adbac86a035e * upstream: Fix typo. From AlexanderStohr via github PR#343. OpenBSD-Commit-ID: a134c9b4039e48803fc6a87f955b0f4a03181497 * upstream: openssh-9.1 OpenBSD-Commit-ID: 5a467b2ee81da01a86adf1ad93b62b1728494e56 * crank versions in RPM spec files * update release notes URL * update .depend * fix 9.1 compilation errors * disable -p pester tests due to unreliability on older Windows versions * remove extra sleep time from debugging scp pester tests * modify -p tests to only run for Windows OS version 10 and above * add windows specific code back into method moved from auth.c to auth2-pubkeyfile.c * add preprocessor for WinHello * revert preprocessor definition for winhello * add windows preprocessor definition in key_lookup * remove rdp block from appveyor since we are no longer debugging * add ifdef to sftp-server.c * make key_lookup compatible with winhello * appveyor.yml * increase debug of failing pester test * add #ifdef SUPPORT_CRLF back into auth_check_principals_line method that was moved/renamed * modify new scp.sh tests for windows * remove in place tests from scp.sh * remove rdp debug from appveyor * retrigger appveyor * change check of OS version in scp test Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: djm@openbsd.org <djm@openbsd.org> Co-authored-by: Damien Miller <djm@mindrot.org> Co-authored-by: Darren Tucker <dtucker@dtucker.net> Co-authored-by: naddy@openbsd.org <naddy@openbsd.org> Co-authored-by: dtucker@openbsd.org <dtucker@openbsd.org> Co-authored-by: tj@openbsd.org <tj@openbsd.org> Co-authored-by: millert@openbsd.org <millert@openbsd.org> Co-authored-by: jmc@openbsd.org <jmc@openbsd.org> Co-authored-by: florian@openbsd.org <florian@openbsd.org> Co-authored-by: markus@openbsd.org <markus@openbsd.org> Co-authored-by: Tobias Heider <me@tobhe.de> Co-authored-by: anton@openbsd.org <anton@openbsd.org> Co-authored-by: Tim Rice <tim@multitalents.net> Co-authored-by: tobhe@openbsd.org <tobhe@openbsd.org> Co-authored-by: Corinna Vinschen <vinschen@redhat.com> Co-authored-by: Sam James <sam@gentoo.org> Co-authored-by: jsg@openbsd.org <jsg@openbsd.org>
2022-11-02 17:06:45 +01:00
if ((r = sshkey_check_rsa_length(prv, 0)) != 0)
goto out;
#ifdef WITH_DSA
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_DSA &&
(type == KEY_UNSPEC || type == KEY_DSA)) {
if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
prv->dsa = EVP_PKEY_get1_DSA(pk);
prv->type = KEY_DSA;
#ifdef DEBUG_PK
DSA_print_fp(stderr, prv->dsa, 8);
#endif
#endif
#ifdef OPENSSL_HAS_ECC
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_EC &&
(type == KEY_UNSPEC || type == KEY_ECDSA)) {
if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
prv->ecdsa = EVP_PKEY_get1_EC_KEY(pk);
prv->type = KEY_ECDSA;
prv->ecdsa_nid = sshkey_ecdsa_key_to_nid(prv->ecdsa);
if (prv->ecdsa_nid == -1 ||
sshkey_curve_nid_to_name(prv->ecdsa_nid) == NULL ||
sshkey_ec_validate_public(EC_KEY_get0_group(prv->ecdsa),
EC_KEY_get0_public_key(prv->ecdsa)) != 0 ||
sshkey_ec_validate_private(prv->ecdsa) != 0) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
# ifdef DEBUG_PK
if (prv != NULL && prv->ecdsa != NULL)
sshkey_dump_ec_key(prv->ecdsa);
# endif
#endif /* OPENSSL_HAS_ECC */
#ifdef OPENSSL_HAS_ED25519
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_ED25519 &&
(type == KEY_UNSPEC || type == KEY_ED25519)) {
size_t len;
if ((prv = sshkey_new(KEY_UNSPEC)) == NULL ||
(prv->ed25519_sk = calloc(1, ED25519_SK_SZ)) == NULL ||
(prv->ed25519_pk = calloc(1, ED25519_PK_SZ)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
prv->type = KEY_ED25519;
len = ED25519_PK_SZ;
if (!EVP_PKEY_get_raw_public_key(pk, prv->ed25519_pk, &len)) {
r = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (len != ED25519_PK_SZ) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
len = ED25519_SK_SZ - ED25519_PK_SZ;
if (!EVP_PKEY_get_raw_private_key(pk, prv->ed25519_sk, &len)) {
r = SSH_ERR_LIBCRYPTO_ERROR;
goto out;
}
if (len != ED25519_SK_SZ - ED25519_PK_SZ) {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
/* Append the public key to our private key */
memcpy(prv->ed25519_sk + (ED25519_SK_SZ - ED25519_PK_SZ),
prv->ed25519_pk, ED25519_PK_SZ);
# ifdef DEBUG_PK
sshbuf_dump_data(prv->ed25519_sk, ED25519_SK_SZ, stderr);
# endif
#endif /* OPENSSL_HAS_ED25519 */
} else {
r = SSH_ERR_INVALID_FORMAT;
goto out;
}
r = 0;
if (keyp != NULL) {
*keyp = prv;
prv = NULL;
}
out:
BIO_free(bio);
EVP_PKEY_free(pk);
sshkey_free(prv);
return r;
}
#endif /* WITH_OPENSSL */
int
sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
const char *passphrase, struct sshkey **keyp, char **commentp)
{
int r = SSH_ERR_INTERNAL_ERROR;
if (keyp != NULL)
*keyp = NULL;
if (commentp != NULL)
*commentp = NULL;
switch (type) {
case KEY_XMSS:
/* No fallback for new-format-only keys */
return sshkey_parse_private2(blob, type, passphrase,
keyp, commentp);
default:
r = sshkey_parse_private2(blob, type, passphrase, keyp,
commentp);
/* Only fallback to PEM parser if a format error occurred. */
if (r != SSH_ERR_INVALID_FORMAT)
return r;
#ifdef WITH_OPENSSL
return sshkey_parse_private_pem_fileblob(blob, type,
passphrase, keyp);
#else
return SSH_ERR_INVALID_FORMAT;
#endif /* WITH_OPENSSL */
}
}
int
sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase,
struct sshkey **keyp, char **commentp)
{
if (keyp != NULL)
*keyp = NULL;
if (commentp != NULL)
*commentp = NULL;
return sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC,
passphrase, keyp, commentp);
}
void
sshkey_sig_details_free(struct sshkey_sig_details *details)
{
freezero(details, sizeof(*details));
}
int
sshkey_parse_pubkey_from_private_fileblob_type(struct sshbuf *blob, int type,
struct sshkey **pubkeyp)
{
int r = SSH_ERR_INTERNAL_ERROR;
if (pubkeyp != NULL)
*pubkeyp = NULL;
/* only new-format private keys bundle a public key inside */
if ((r = sshkey_parse_private2_pubkey(blob, type, pubkeyp)) != 0)
return r;
return 0;
}
#ifdef WITH_XMSS
/*
* serialize the key with the current state and forward the state
* maxsign times.
*/
int
sshkey_private_serialize_maxsign(struct sshkey *k, struct sshbuf *b,
u_int32_t maxsign, int printerror)
{
int r, rupdate;
if (maxsign == 0 ||
sshkey_type_plain(k->type) != KEY_XMSS)
return sshkey_private_serialize_opt(k, b,
SSHKEY_SERIALIZE_DEFAULT);
if ((r = sshkey_xmss_get_state(k, printerror)) != 0 ||
(r = sshkey_private_serialize_opt(k, b,
SSHKEY_SERIALIZE_STATE)) != 0 ||
(r = sshkey_xmss_forward_state(k, maxsign)) != 0)
goto out;
r = 0;
out:
if ((rupdate = sshkey_xmss_update_state(k, printerror)) != 0) {
if (r == 0)
r = rupdate;
}
return r;
}
u_int32_t
sshkey_signatures_left(const struct sshkey *k)
{
if (sshkey_type_plain(k->type) == KEY_XMSS)
return sshkey_xmss_signatures_left(k);
return 0;
}
int
sshkey_enable_maxsign(struct sshkey *k, u_int32_t maxsign)
{
if (sshkey_type_plain(k->type) != KEY_XMSS)
return SSH_ERR_INVALID_ARGUMENT;
return sshkey_xmss_enable_maxsign(k, maxsign);
}
int
sshkey_set_filename(struct sshkey *k, const char *filename)
{
if (k == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if (sshkey_type_plain(k->type) != KEY_XMSS)
return 0;
if (filename == NULL)
return SSH_ERR_INVALID_ARGUMENT;
if ((k->xmss_filename = strdup(filename)) == NULL)
return SSH_ERR_ALLOC_FAIL;
return 0;
}
#else
int
sshkey_private_serialize_maxsign(struct sshkey *k, struct sshbuf *b,
u_int32_t maxsign, int printerror)
{
return sshkey_private_serialize_opt(k, b, SSHKEY_SERIALIZE_DEFAULT);
}
u_int32_t
sshkey_signatures_left(const struct sshkey *k)
{
return 0;
}
int
sshkey_enable_maxsign(struct sshkey *k, u_int32_t maxsign)
{
return SSH_ERR_INVALID_ARGUMENT;
}
int
sshkey_set_filename(struct sshkey *k, const char *filename)
{
if (k == NULL)
return SSH_ERR_INVALID_ARGUMENT;
return 0;
}
#endif /* WITH_XMSS */