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
|
|
|
/* $OpenBSD: misc.c,v 1.177 2022/08/11 01:56:51 djm Exp $ */
|
2000-09-16 04:29:08 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
2020-05-26 03:06:52 +02:00
|
|
|
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
|
|
|
|
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
|
2000-09-16 04:29:08 +02:00
|
|
|
*
|
2020-05-26 03:06:52 +02:00
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
2000-09-16 04:29:08 +02:00
|
|
|
*
|
2020-05-26 03:06:52 +02:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2000-09-16 04:29:08 +02:00
|
|
|
*/
|
|
|
|
|
2020-05-26 03:06:52 +02:00
|
|
|
|
2000-08-18 06:01:04 +02:00
|
|
|
#include "includes.h"
|
2006-03-15 01:28:34 +01:00
|
|
|
|
2006-07-10 12:53:08 +02:00
|
|
|
#include <sys/types.h>
|
2006-08-05 04:39:39 +02:00
|
|
|
#include <sys/ioctl.h>
|
2006-07-10 12:35:38 +02:00
|
|
|
#include <sys/socket.h>
|
2017-08-18 07:36:45 +02:00
|
|
|
#include <sys/stat.h>
|
2016-01-20 10:22:39 +01:00
|
|
|
#include <sys/time.h>
|
2017-08-18 07:36:45 +02:00
|
|
|
#include <sys/wait.h>
|
2014-07-18 06:11:24 +02:00
|
|
|
#include <sys/un.h>
|
2006-07-10 12:35:38 +02:00
|
|
|
|
2015-01-16 07:40:12 +01:00
|
|
|
#include <limits.h>
|
2017-08-18 07:36:45 +02:00
|
|
|
#ifdef HAVE_LIBGEN_H
|
|
|
|
# include <libgen.h>
|
|
|
|
#endif
|
2019-10-28 05:53:25 +01:00
|
|
|
#ifdef HAVE_POLL_H
|
2018-12-27 04:25:24 +01:00
|
|
|
#include <poll.h>
|
2019-10-28 05:53:25 +01:00
|
|
|
#endif
|
2017-08-18 07:36:45 +02:00
|
|
|
#include <signal.h>
|
2006-07-12 14:15:16 +02:00
|
|
|
#include <stdarg.h>
|
2006-08-05 03:37:59 +02:00
|
|
|
#include <stdio.h>
|
2006-08-05 03:34:19 +02:00
|
|
|
#include <stdlib.h>
|
2006-07-24 06:13:33 +02:00
|
|
|
#include <string.h>
|
2011-01-13 02:21:34 +01:00
|
|
|
#include <time.h>
|
2006-07-24 06:01:23 +02:00
|
|
|
#include <unistd.h>
|
2006-07-12 14:15:16 +02:00
|
|
|
|
2006-07-10 12:35:38 +02:00
|
|
|
#include <netinet/in.h>
|
2010-11-20 05:19:38 +01:00
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/ip.h>
|
2006-03-15 01:19:42 +01:00
|
|
|
#include <netinet/tcp.h>
|
2018-10-05 16:26:09 +02:00
|
|
|
#include <arpa/inet.h>
|
2006-07-10 12:35:38 +02:00
|
|
|
|
2013-10-15 03:14:12 +02:00
|
|
|
#include <ctype.h>
|
2006-07-12 14:22:46 +02:00
|
|
|
#include <errno.h>
|
2006-07-10 13:13:46 +02:00
|
|
|
#include <fcntl.h>
|
2007-12-28 16:43:51 +01:00
|
|
|
#include <netdb.h>
|
2006-03-15 01:16:59 +01:00
|
|
|
#ifdef HAVE_PATHS_H
|
2006-03-15 01:18:26 +01:00
|
|
|
# include <paths.h>
|
2006-07-10 12:53:08 +02:00
|
|
|
#include <pwd.h>
|
2021-09-26 16:03:19 +02:00
|
|
|
#include <grp.h>
|
2006-03-15 01:16:59 +01:00
|
|
|
#endif
|
2006-01-02 13:40:10 +01:00
|
|
|
#ifdef SSH_TUN_OPENBSD
|
|
|
|
#include <net/if.h>
|
|
|
|
#endif
|
2000-08-18 06:01:04 +02:00
|
|
|
|
2006-08-05 04:39:39 +02:00
|
|
|
#include "xmalloc.h"
|
2001-02-04 14:20:36 +01:00
|
|
|
#include "misc.h"
|
2001-01-22 06:34:40 +01:00
|
|
|
#include "log.h"
|
2006-07-10 15:04:19 +02:00
|
|
|
#include "ssh.h"
|
2017-08-18 07:36:45 +02:00
|
|
|
#include "sshbuf.h"
|
|
|
|
#include "ssherr.h"
|
2017-08-23 12:13:18 +02:00
|
|
|
#include "platform.h"
|
2000-08-18 06:01:04 +02:00
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
/* remove newline at end of string */
|
2000-08-18 06:01:04 +02:00
|
|
|
char *
|
|
|
|
chop(char *s)
|
|
|
|
{
|
|
|
|
char *t = s;
|
|
|
|
while (*t) {
|
2001-12-06 19:00:18 +01:00
|
|
|
if (*t == '\n' || *t == '\r') {
|
2000-08-18 06:01:04 +02:00
|
|
|
*t = '\0';
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
t++;
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-08 08:54:40 +02:00
|
|
|
/* remove whitespace from end of string */
|
|
|
|
void
|
|
|
|
rtrim(char *s)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
if ((i = strlen(s)) == 0)
|
|
|
|
return;
|
|
|
|
for (i--; i > 0; i--) {
|
|
|
|
if (isspace((int)s[i]))
|
|
|
|
s[i] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
/* set/unset filedescriptor to non-blocking */
|
2004-06-15 02:35:30 +02:00
|
|
|
int
|
2000-08-18 06:01:04 +02:00
|
|
|
set_nonblock(int fd)
|
|
|
|
{
|
|
|
|
int val;
|
2001-05-12 02:08:37 +02:00
|
|
|
|
2016-04-02 16:37:42 +02:00
|
|
|
val = fcntl(fd, F_GETFL);
|
2019-06-28 15:35:04 +02:00
|
|
|
if (val == -1) {
|
2016-04-02 16:37:42 +02:00
|
|
|
error("fcntl(%d, F_GETFL): %s", fd, strerror(errno));
|
2004-06-15 02:35:30 +02:00
|
|
|
return (-1);
|
2000-08-18 06:01:04 +02:00
|
|
|
}
|
2000-10-28 05:19:58 +02:00
|
|
|
if (val & O_NONBLOCK) {
|
2004-06-15 02:35:30 +02:00
|
|
|
debug3("fd %d is O_NONBLOCK", fd);
|
|
|
|
return (0);
|
2000-10-28 05:19:58 +02:00
|
|
|
}
|
2003-05-14 05:41:39 +02:00
|
|
|
debug2("fd %d setting O_NONBLOCK", fd);
|
2000-08-18 06:01:04 +02:00
|
|
|
val |= O_NONBLOCK;
|
2004-06-15 02:35:30 +02:00
|
|
|
if (fcntl(fd, F_SETFL, val) == -1) {
|
|
|
|
debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd,
|
|
|
|
strerror(errno));
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
return (0);
|
2000-08-18 06:01:04 +02:00
|
|
|
}
|
|
|
|
|
2004-06-15 02:35:30 +02:00
|
|
|
int
|
2001-05-12 02:08:37 +02:00
|
|
|
unset_nonblock(int fd)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
|
2016-04-02 16:37:42 +02:00
|
|
|
val = fcntl(fd, F_GETFL);
|
2019-06-28 15:35:04 +02:00
|
|
|
if (val == -1) {
|
2016-04-02 16:37:42 +02:00
|
|
|
error("fcntl(%d, F_GETFL): %s", fd, strerror(errno));
|
2004-06-15 02:35:30 +02:00
|
|
|
return (-1);
|
2001-05-12 02:08:37 +02:00
|
|
|
}
|
|
|
|
if (!(val & O_NONBLOCK)) {
|
2004-06-15 02:35:30 +02:00
|
|
|
debug3("fd %d is not O_NONBLOCK", fd);
|
|
|
|
return (0);
|
2001-05-12 02:08:37 +02:00
|
|
|
}
|
2001-06-21 05:04:37 +02:00
|
|
|
debug("fd %d clearing O_NONBLOCK", fd);
|
2001-05-12 02:08:37 +02:00
|
|
|
val &= ~O_NONBLOCK;
|
2004-06-15 02:35:30 +02:00
|
|
|
if (fcntl(fd, F_SETFL, val) == -1) {
|
|
|
|
debug("fcntl(%d, F_SETFL, ~O_NONBLOCK): %s",
|
2002-03-05 02:48:09 +01:00
|
|
|
fd, strerror(errno));
|
2004-06-15 02:35:30 +02:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
return (0);
|
2001-05-12 02:08:37 +02:00
|
|
|
}
|
|
|
|
|
2007-12-28 16:43:51 +01:00
|
|
|
const char *
|
|
|
|
ssh_gai_strerror(int gaierr)
|
|
|
|
{
|
2013-07-18 08:13:19 +02:00
|
|
|
if (gaierr == EAI_SYSTEM && errno != 0)
|
2008-01-01 10:33:35 +01:00
|
|
|
return strerror(errno);
|
|
|
|
return gai_strerror(gaierr);
|
2007-12-28 16:43:51 +01:00
|
|
|
}
|
|
|
|
|
2002-02-05 01:52:13 +01:00
|
|
|
/* disable nagle on socket */
|
|
|
|
void
|
|
|
|
set_nodelay(int fd)
|
|
|
|
{
|
2002-03-05 02:28:14 +01:00
|
|
|
int opt;
|
|
|
|
socklen_t optlen;
|
2002-02-05 01:52:13 +01:00
|
|
|
|
2002-02-26 19:12:51 +01:00
|
|
|
optlen = sizeof opt;
|
|
|
|
if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen) == -1) {
|
2003-11-03 10:07:14 +01:00
|
|
|
debug("getsockopt TCP_NODELAY: %.100s", strerror(errno));
|
2002-02-26 19:12:51 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (opt == 1) {
|
|
|
|
debug2("fd %d is TCP_NODELAY", fd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opt = 1;
|
2002-12-23 03:44:36 +01:00
|
|
|
debug2("fd %d setting TCP_NODELAY", fd);
|
2002-02-26 19:12:51 +01:00
|
|
|
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt) == -1)
|
2002-02-05 01:52:13 +01:00
|
|
|
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
|
|
|
|
}
|
|
|
|
|
2017-10-25 02:15:35 +02:00
|
|
|
/* Allow local port reuse in TIME_WAIT */
|
|
|
|
int
|
|
|
|
set_reuseaddr(int fd)
|
|
|
|
{
|
|
|
|
int on = 1;
|
|
|
|
|
|
|
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
|
|
|
|
error("setsockopt SO_REUSEADDR fd %d: %s", fd, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-10-25 02:17:08 +02:00
|
|
|
/* Get/set routing domain */
|
|
|
|
char *
|
|
|
|
get_rdomain(int fd)
|
|
|
|
{
|
2017-10-25 04:10:59 +02:00
|
|
|
#if defined(HAVE_SYS_GET_RDOMAIN)
|
|
|
|
return sys_get_rdomain(fd);
|
|
|
|
#elif defined(__OpenBSD__)
|
2017-10-25 02:17:08 +02:00
|
|
|
int rtable;
|
|
|
|
char *ret;
|
|
|
|
socklen_t len = sizeof(rtable);
|
|
|
|
|
|
|
|
if (getsockopt(fd, SOL_SOCKET, SO_RTABLE, &rtable, &len) == -1) {
|
|
|
|
error("Failed to get routing domain for fd %d: %s",
|
|
|
|
fd, strerror(errno));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
xasprintf(&ret, "%d", rtable);
|
|
|
|
return ret;
|
2017-10-25 04:10:59 +02:00
|
|
|
#else /* defined(__OpenBSD__) */
|
|
|
|
return NULL;
|
|
|
|
#endif
|
2017-10-25 02:17:08 +02:00
|
|
|
}
|
|
|
|
|
2017-10-25 02:15:35 +02:00
|
|
|
int
|
|
|
|
set_rdomain(int fd, const char *name)
|
|
|
|
{
|
2017-10-25 04:10:59 +02:00
|
|
|
#if defined(HAVE_SYS_SET_RDOMAIN)
|
|
|
|
return sys_set_rdomain(fd, name);
|
|
|
|
#elif defined(__OpenBSD__)
|
2017-10-25 02:15:35 +02:00
|
|
|
int rtable;
|
|
|
|
const char *errstr;
|
|
|
|
|
|
|
|
if (name == NULL)
|
|
|
|
return 0; /* default table */
|
|
|
|
|
|
|
|
rtable = (int)strtonum(name, 0, 255, &errstr);
|
|
|
|
if (errstr != NULL) {
|
|
|
|
/* Shouldn't happen */
|
|
|
|
error("Invalid routing domain \"%s\": %s", name, errstr);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (setsockopt(fd, SOL_SOCKET, SO_RTABLE,
|
|
|
|
&rtable, sizeof(rtable)) == -1) {
|
|
|
|
error("Failed to set routing domain %d on fd %d: %s",
|
|
|
|
rtable, fd, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
2017-10-25 04:10:59 +02:00
|
|
|
#else /* defined(__OpenBSD__) */
|
|
|
|
error("Setting routing domain is not supported on this platform");
|
|
|
|
return -1;
|
|
|
|
#endif
|
2017-10-25 02:15:35 +02:00
|
|
|
}
|
|
|
|
|
2020-11-27 01:49:58 +01:00
|
|
|
int
|
|
|
|
get_sock_af(int fd)
|
|
|
|
{
|
|
|
|
struct sockaddr_storage to;
|
|
|
|
socklen_t tolen = sizeof(to);
|
|
|
|
|
|
|
|
memset(&to, 0, sizeof(to));
|
|
|
|
if (getsockname(fd, (struct sockaddr *)&to, &tolen) == -1)
|
|
|
|
return -1;
|
|
|
|
#ifdef IPV4_IN_IPV6
|
|
|
|
if (to.ss_family == AF_INET6 &&
|
|
|
|
IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr))
|
|
|
|
return AF_INET;
|
|
|
|
#endif
|
|
|
|
return to.ss_family;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_sock_tos(int fd, int tos)
|
|
|
|
{
|
|
|
|
#ifndef IP_TOS_IS_BROKEN
|
|
|
|
int af;
|
|
|
|
|
|
|
|
switch ((af = get_sock_af(fd))) {
|
|
|
|
case -1:
|
|
|
|
/* assume not a socket */
|
|
|
|
break;
|
|
|
|
case AF_INET:
|
|
|
|
# ifdef IP_TOS
|
|
|
|
debug3_f("set socket %d IP_TOS 0x%02x", fd, tos);
|
|
|
|
if (setsockopt(fd, IPPROTO_IP, IP_TOS,
|
|
|
|
&tos, sizeof(tos)) == -1) {
|
|
|
|
error("setsockopt socket %d IP_TOS %d: %s:",
|
|
|
|
fd, tos, strerror(errno));
|
|
|
|
}
|
|
|
|
# endif /* IP_TOS */
|
|
|
|
break;
|
|
|
|
case AF_INET6:
|
|
|
|
# ifdef IPV6_TCLASS
|
|
|
|
debug3_f("set socket %d IPV6_TCLASS 0x%02x", fd, tos);
|
|
|
|
if (setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS,
|
|
|
|
&tos, sizeof(tos)) == -1) {
|
|
|
|
error("setsockopt socket %d IPV6_TCLASS %d: %.100s:",
|
|
|
|
fd, tos, strerror(errno));
|
|
|
|
}
|
|
|
|
# endif /* IPV6_TCLASS */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
debug2_f("unsupported socket family %d", af);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif /* IP_TOS_IS_BROKEN */
|
|
|
|
}
|
|
|
|
|
2018-12-27 04:25:24 +01:00
|
|
|
/*
|
2019-11-22 07:50:30 +01:00
|
|
|
* Wait up to *timeoutp milliseconds for events on fd. Updates
|
2018-12-27 04:25:24 +01:00
|
|
|
* *timeoutp with time remaining.
|
|
|
|
* Returns 0 if fd ready or -1 on timeout or error (see errno).
|
|
|
|
*/
|
2019-11-22 07:50:30 +01:00
|
|
|
static int
|
|
|
|
waitfd(int fd, int *timeoutp, short events)
|
2018-12-27 04:25:24 +01:00
|
|
|
{
|
|
|
|
struct pollfd pfd;
|
|
|
|
struct timeval t_start;
|
|
|
|
int oerrno, r;
|
|
|
|
|
|
|
|
pfd.fd = fd;
|
2019-11-22 07:50:30 +01:00
|
|
|
pfd.events = events;
|
2018-12-27 04:25:24 +01:00
|
|
|
for (; *timeoutp >= 0;) {
|
2021-01-15 03:32:41 +01:00
|
|
|
monotime_tv(&t_start);
|
2018-12-27 04:25:24 +01:00
|
|
|
r = poll(&pfd, 1, *timeoutp);
|
|
|
|
oerrno = errno;
|
|
|
|
ms_subtract_diff(&t_start, timeoutp);
|
|
|
|
errno = oerrno;
|
|
|
|
if (r > 0)
|
|
|
|
return 0;
|
2020-06-26 07:16:38 +02:00
|
|
|
else if (r == -1 && errno != EAGAIN && errno != EINTR)
|
2018-12-27 04:25:24 +01:00
|
|
|
return -1;
|
|
|
|
else if (r == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* timeout */
|
|
|
|
errno = ETIMEDOUT;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-11-22 07:50:30 +01:00
|
|
|
/*
|
|
|
|
* Wait up to *timeoutp milliseconds for fd to be readable. Updates
|
|
|
|
* *timeoutp with time remaining.
|
|
|
|
* Returns 0 if fd ready or -1 on timeout or error (see errno).
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
waitrfd(int fd, int *timeoutp) {
|
|
|
|
return waitfd(fd, timeoutp, POLLIN);
|
|
|
|
}
|
|
|
|
|
2018-12-27 04:25:24 +01:00
|
|
|
/*
|
|
|
|
* Attempt a non-blocking connect(2) to the specified address, waiting up to
|
|
|
|
* *timeoutp milliseconds for the connection to complete. If the timeout is
|
|
|
|
* <=0, then wait indefinitely.
|
|
|
|
*
|
|
|
|
* Returns 0 on success or -1 on failure.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
timeout_connect(int sockfd, const struct sockaddr *serv_addr,
|
|
|
|
socklen_t addrlen, int *timeoutp)
|
|
|
|
{
|
|
|
|
int optval = 0;
|
|
|
|
socklen_t optlen = sizeof(optval);
|
|
|
|
|
|
|
|
/* No timeout: just do a blocking connect() */
|
|
|
|
if (timeoutp == NULL || *timeoutp <= 0)
|
|
|
|
return connect(sockfd, serv_addr, addrlen);
|
|
|
|
|
|
|
|
set_nonblock(sockfd);
|
2020-06-26 07:16:38 +02:00
|
|
|
for (;;) {
|
|
|
|
if (connect(sockfd, serv_addr, addrlen) == 0) {
|
|
|
|
/* Succeeded already? */
|
|
|
|
unset_nonblock(sockfd);
|
|
|
|
return 0;
|
|
|
|
} else if (errno == EINTR)
|
|
|
|
continue;
|
|
|
|
else if (errno != EINPROGRESS)
|
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
}
|
2018-12-27 04:25:24 +01:00
|
|
|
|
2019-11-22 07:50:30 +01:00
|
|
|
if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT) == -1)
|
2018-12-27 04:25:24 +01:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* Completed or failed */
|
|
|
|
if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, &optlen) == -1) {
|
|
|
|
debug("getsockopt: %s", strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (optval != 0) {
|
|
|
|
errno = optval;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
unset_nonblock(sockfd);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-08-18 06:01:04 +02:00
|
|
|
/* Characters considered whitespace in strsep calls. */
|
|
|
|
#define WHITESPACE " \t\r\n"
|
2006-03-15 02:05:59 +01:00
|
|
|
#define QUOTE "\""
|
2000-08-18 06:01:04 +02:00
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
/* return next token in configuration line */
|
2018-06-09 05:01:12 +02:00
|
|
|
static char *
|
|
|
|
strdelim_internal(char **s, int split_equals)
|
2000-08-18 06:01:04 +02:00
|
|
|
{
|
|
|
|
char *old;
|
|
|
|
int wspace = 0;
|
|
|
|
|
|
|
|
if (*s == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
old = *s;
|
|
|
|
|
2018-06-09 05:01:12 +02:00
|
|
|
*s = strpbrk(*s,
|
|
|
|
split_equals ? WHITESPACE QUOTE "=" : WHITESPACE QUOTE);
|
2000-08-18 06:01:04 +02:00
|
|
|
if (*s == NULL)
|
|
|
|
return (old);
|
|
|
|
|
2006-03-15 02:05:59 +01:00
|
|
|
if (*s[0] == '\"') {
|
|
|
|
memmove(*s, *s + 1, strlen(*s)); /* move nul too */
|
|
|
|
/* Find matching quote */
|
|
|
|
if ((*s = strpbrk(*s, QUOTE)) == NULL) {
|
|
|
|
return (NULL); /* no matching quote */
|
|
|
|
} else {
|
|
|
|
*s[0] = '\0';
|
2010-07-16 05:56:01 +02:00
|
|
|
*s += strspn(*s + 1, WHITESPACE) + 1;
|
2006-03-15 02:05:59 +01:00
|
|
|
return (old);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-18 06:01:04 +02:00
|
|
|
/* Allow only one '=' to be skipped */
|
2018-06-09 05:01:12 +02:00
|
|
|
if (split_equals && *s[0] == '=')
|
2000-08-18 06:01:04 +02:00
|
|
|
wspace = 1;
|
|
|
|
*s[0] = '\0';
|
|
|
|
|
2006-03-15 02:05:59 +01:00
|
|
|
/* Skip any extra whitespace after first token */
|
2000-08-18 06:01:04 +02:00
|
|
|
*s += strspn(*s + 1, WHITESPACE) + 1;
|
2018-06-09 05:01:12 +02:00
|
|
|
if (split_equals && *s[0] == '=' && !wspace)
|
2000-08-18 06:01:04 +02:00
|
|
|
*s += strspn(*s + 1, WHITESPACE) + 1;
|
|
|
|
|
|
|
|
return (old);
|
|
|
|
}
|
2001-02-04 14:20:36 +01:00
|
|
|
|
2018-06-09 05:01:12 +02:00
|
|
|
/*
|
|
|
|
* Return next token in configuration line; splts on whitespace or a
|
|
|
|
* single '=' character.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
strdelim(char **s)
|
|
|
|
{
|
|
|
|
return strdelim_internal(s, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return next token in configuration line; splts on whitespace only.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
strdelimw(char **s)
|
|
|
|
{
|
|
|
|
return strdelim_internal(s, 0);
|
|
|
|
}
|
|
|
|
|
2001-03-05 06:56:40 +01:00
|
|
|
struct passwd *
|
|
|
|
pwcopy(struct passwd *pw)
|
|
|
|
{
|
2006-03-26 05:19:21 +02:00
|
|
|
struct passwd *copy = xcalloc(1, sizeof(*copy));
|
2001-03-05 07:22:01 +01:00
|
|
|
|
2001-03-05 06:56:40 +01:00
|
|
|
copy->pw_name = xstrdup(pw->pw_name);
|
2021-05-17 01:40:23 +02:00
|
|
|
copy->pw_passwd = xstrdup(pw->pw_passwd == NULL ? "*" : pw->pw_passwd);
|
2013-04-23 06:25:52 +02:00
|
|
|
#ifdef HAVE_STRUCT_PASSWD_PW_GECOS
|
2001-03-05 07:22:01 +01:00
|
|
|
copy->pw_gecos = xstrdup(pw->pw_gecos);
|
2013-04-23 06:25:52 +02:00
|
|
|
#endif
|
2001-03-05 06:56:40 +01:00
|
|
|
copy->pw_uid = pw->pw_uid;
|
|
|
|
copy->pw_gid = pw->pw_gid;
|
2013-04-23 06:25:52 +02:00
|
|
|
#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
|
2001-06-21 05:11:27 +02:00
|
|
|
copy->pw_expire = pw->pw_expire;
|
2001-06-22 23:14:18 +02:00
|
|
|
#endif
|
2013-04-23 06:25:52 +02:00
|
|
|
#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE
|
2001-06-21 05:11:27 +02:00
|
|
|
copy->pw_change = pw->pw_change;
|
2001-06-22 23:14:18 +02:00
|
|
|
#endif
|
2013-04-23 06:25:52 +02:00
|
|
|
#ifdef HAVE_STRUCT_PASSWD_PW_CLASS
|
2001-03-05 06:56:40 +01:00
|
|
|
copy->pw_class = xstrdup(pw->pw_class);
|
2001-03-05 08:57:09 +01:00
|
|
|
#endif
|
2001-03-05 06:56:40 +01:00
|
|
|
copy->pw_dir = xstrdup(pw->pw_dir);
|
|
|
|
copy->pw_shell = xstrdup(pw->pw_shell);
|
2017-02-03 08:54:02 +01:00
|
|
|
|
2001-03-05 06:56:40 +01:00
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
/*
|
|
|
|
* Convert ASCII string to TCP/IP port number.
|
2009-01-28 06:31:22 +01:00
|
|
|
* Port must be >=0 and <=65535.
|
|
|
|
* Return -1 if invalid.
|
2001-07-04 06:46:56 +02:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
a2port(const char *s)
|
2001-04-13 01:39:26 +02:00
|
|
|
{
|
2018-10-05 16:26:09 +02:00
|
|
|
struct servent *se;
|
2009-01-28 06:31:22 +01:00
|
|
|
long long port;
|
|
|
|
const char *errstr;
|
2001-04-13 01:39:26 +02:00
|
|
|
|
2009-01-28 06:31:22 +01:00
|
|
|
port = strtonum(s, 0, 65535, &errstr);
|
2018-10-05 16:26:09 +02:00
|
|
|
if (errstr == NULL)
|
|
|
|
return (int)port;
|
|
|
|
if ((se = getservbyname(s, "tcp")) != NULL)
|
|
|
|
return ntohs(se->s_port);
|
|
|
|
return -1;
|
2001-04-13 01:39:26 +02:00
|
|
|
}
|
|
|
|
|
2005-12-13 09:29:02 +01:00
|
|
|
int
|
|
|
|
a2tun(const char *s, int *remote)
|
|
|
|
{
|
|
|
|
const char *errstr = NULL;
|
|
|
|
char *sp, *ep;
|
|
|
|
int tun;
|
|
|
|
|
|
|
|
if (remote != NULL) {
|
2005-12-13 09:33:19 +01:00
|
|
|
*remote = SSH_TUNID_ANY;
|
2005-12-13 09:29:02 +01:00
|
|
|
sp = xstrdup(s);
|
|
|
|
if ((ep = strchr(sp, ':')) == NULL) {
|
2013-06-01 23:31:17 +02:00
|
|
|
free(sp);
|
2005-12-13 09:29:02 +01:00
|
|
|
return (a2tun(s, NULL));
|
|
|
|
}
|
|
|
|
ep[0] = '\0'; ep++;
|
|
|
|
*remote = a2tun(ep, NULL);
|
|
|
|
tun = a2tun(sp, NULL);
|
2013-06-01 23:31:17 +02:00
|
|
|
free(sp);
|
2005-12-13 09:33:19 +01:00
|
|
|
return (*remote == SSH_TUNID_ERR ? *remote : tun);
|
2005-12-13 09:29:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (strcasecmp(s, "any") == 0)
|
2005-12-13 09:33:19 +01:00
|
|
|
return (SSH_TUNID_ANY);
|
2005-12-13 09:29:02 +01:00
|
|
|
|
2005-12-13 09:33:19 +01:00
|
|
|
tun = strtonum(s, 0, SSH_TUNID_MAX, &errstr);
|
|
|
|
if (errstr != NULL)
|
|
|
|
return (SSH_TUNID_ERR);
|
2005-12-13 09:29:02 +01:00
|
|
|
|
|
|
|
return (tun);
|
|
|
|
}
|
|
|
|
|
2001-06-05 21:59:08 +02:00
|
|
|
#define SECONDS 1
|
|
|
|
#define MINUTES (SECONDS * 60)
|
|
|
|
#define HOURS (MINUTES * 60)
|
|
|
|
#define DAYS (HOURS * 24)
|
|
|
|
#define WEEKS (DAYS * 7)
|
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
/*
|
|
|
|
* Convert a time string into seconds; format is
|
|
|
|
* a sequence of:
|
|
|
|
* time[qualifier]
|
|
|
|
*
|
|
|
|
* Valid time qualifiers are:
|
|
|
|
* <none> seconds
|
|
|
|
* s|S seconds
|
|
|
|
* m|M minutes
|
|
|
|
* h|H hours
|
|
|
|
* d|D days
|
|
|
|
* w|W weeks
|
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
* 90m 90 minutes
|
|
|
|
* 1h30m 90 minutes
|
|
|
|
* 2d 2 days
|
|
|
|
* 1w 1 week
|
|
|
|
*
|
|
|
|
* Return -1 if time string is invalid.
|
|
|
|
*/
|
2021-01-11 03:12:57 +01:00
|
|
|
int
|
2001-07-04 06:46:56 +02:00
|
|
|
convtime(const char *s)
|
2001-06-05 21:59:08 +02:00
|
|
|
{
|
2020-05-29 03:20:46 +02:00
|
|
|
long total, secs, multiplier;
|
2001-06-05 21:59:08 +02:00
|
|
|
const char *p;
|
|
|
|
char *endp;
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
total = 0;
|
|
|
|
p = s;
|
|
|
|
|
|
|
|
if (p == NULL || *p == '\0')
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
while (*p) {
|
|
|
|
secs = strtol(p, &endp, 10);
|
|
|
|
if (p == endp ||
|
2021-01-11 03:12:57 +01:00
|
|
|
(errno == ERANGE && (secs == INT_MIN || secs == INT_MAX)) ||
|
2001-06-05 21:59:08 +02:00
|
|
|
secs < 0)
|
|
|
|
return -1;
|
|
|
|
|
2020-05-29 03:20:46 +02:00
|
|
|
multiplier = 1;
|
2001-06-05 21:59:08 +02:00
|
|
|
switch (*endp++) {
|
|
|
|
case '\0':
|
|
|
|
endp--;
|
2006-03-26 05:02:35 +02:00
|
|
|
break;
|
2001-06-05 21:59:08 +02:00
|
|
|
case 's':
|
|
|
|
case 'S':
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
case 'M':
|
2017-03-14 01:25:03 +01:00
|
|
|
multiplier = MINUTES;
|
2001-06-05 21:59:08 +02:00
|
|
|
break;
|
|
|
|
case 'h':
|
|
|
|
case 'H':
|
2017-03-14 01:25:03 +01:00
|
|
|
multiplier = HOURS;
|
2001-06-05 21:59:08 +02:00
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
case 'D':
|
2017-03-14 01:25:03 +01:00
|
|
|
multiplier = DAYS;
|
2001-06-05 21:59:08 +02:00
|
|
|
break;
|
|
|
|
case 'w':
|
|
|
|
case 'W':
|
2017-03-14 01:25:03 +01:00
|
|
|
multiplier = WEEKS;
|
2001-06-05 21:59:08 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
2021-01-15 03:58:11 +01:00
|
|
|
if (secs > INT_MAX / multiplier)
|
2017-03-14 01:25:03 +01:00
|
|
|
return -1;
|
|
|
|
secs *= multiplier;
|
2021-01-15 03:58:11 +01:00
|
|
|
if (total > INT_MAX - secs)
|
2017-03-14 01:25:03 +01:00
|
|
|
return -1;
|
2001-06-05 21:59:08 +02:00
|
|
|
total += secs;
|
|
|
|
if (total < 0)
|
|
|
|
return -1;
|
|
|
|
p = endp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2020-05-26 03:06:52 +02:00
|
|
|
#define TF_BUFS 8
|
|
|
|
#define TF_LEN 9
|
|
|
|
|
|
|
|
const char *
|
|
|
|
fmt_timeframe(time_t t)
|
|
|
|
{
|
|
|
|
char *buf;
|
|
|
|
static char tfbuf[TF_BUFS][TF_LEN]; /* ring buffer */
|
|
|
|
static int idx = 0;
|
|
|
|
unsigned int sec, min, hrs, day;
|
|
|
|
unsigned long long week;
|
|
|
|
|
|
|
|
buf = tfbuf[idx++];
|
|
|
|
if (idx == TF_BUFS)
|
|
|
|
idx = 0;
|
|
|
|
|
|
|
|
week = t;
|
|
|
|
|
|
|
|
sec = week % 60;
|
|
|
|
week /= 60;
|
|
|
|
min = week % 60;
|
|
|
|
week /= 60;
|
|
|
|
hrs = week % 24;
|
|
|
|
week /= 24;
|
|
|
|
day = week % 7;
|
|
|
|
week /= 7;
|
|
|
|
|
|
|
|
if (week > 0)
|
|
|
|
snprintf(buf, TF_LEN, "%02lluw%01ud%02uh", week, day, hrs);
|
|
|
|
else if (day > 0)
|
|
|
|
snprintf(buf, TF_LEN, "%01ud%02uh%02um", day, hrs, min);
|
|
|
|
else
|
|
|
|
snprintf(buf, TF_LEN, "%02u:%02u:%02u", hrs, min, sec);
|
|
|
|
|
|
|
|
return (buf);
|
|
|
|
}
|
|
|
|
|
2006-07-10 15:04:19 +02:00
|
|
|
/*
|
|
|
|
* Returns a standardized host+port identifier string.
|
|
|
|
* Caller must free returned string.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
put_host_port(const char *host, u_short port)
|
|
|
|
{
|
|
|
|
char *hoststr;
|
|
|
|
|
|
|
|
if (port == 0 || port == SSH_DEFAULT_PORT)
|
|
|
|
return(xstrdup(host));
|
2019-06-27 20:03:37 +02:00
|
|
|
if (asprintf(&hoststr, "[%s]:%d", host, (int)port) == -1)
|
2006-07-10 15:04:19 +02:00
|
|
|
fatal("put_host_port: asprintf: %s", strerror(errno));
|
|
|
|
debug3("put_host_port: %s", hoststr);
|
|
|
|
return hoststr;
|
|
|
|
}
|
|
|
|
|
2005-03-01 11:24:33 +01:00
|
|
|
/*
|
|
|
|
* Search for next delimiter between hostnames/addresses and ports.
|
|
|
|
* Argument may be modified (for termination).
|
|
|
|
* Returns *cp if parsing succeeds.
|
2017-10-22 01:06:24 +02:00
|
|
|
* *cp is set to the start of the next field, if one was found.
|
|
|
|
* The delimiter char, if present, is stored in delim.
|
2005-03-01 11:24:33 +01:00
|
|
|
* If this is the last field, *cp is set to NULL.
|
|
|
|
*/
|
2019-01-23 22:50:56 +01:00
|
|
|
char *
|
2017-10-22 01:06:24 +02:00
|
|
|
hpdelim2(char **cp, char *delim)
|
2005-03-01 11:24:33 +01:00
|
|
|
{
|
|
|
|
char *s, *old;
|
|
|
|
|
|
|
|
if (cp == NULL || *cp == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
old = s = *cp;
|
|
|
|
if (*s == '[') {
|
|
|
|
if ((s = strchr(s, ']')) == NULL)
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
s++;
|
|
|
|
} else if ((s = strpbrk(s, ":/")) == NULL)
|
|
|
|
s = *cp + strlen(*cp); /* skip to end (see first case below) */
|
|
|
|
|
|
|
|
switch (*s) {
|
|
|
|
case '\0':
|
|
|
|
*cp = NULL; /* no more fields*/
|
|
|
|
break;
|
2005-03-14 13:08:12 +01:00
|
|
|
|
2005-03-01 11:24:33 +01:00
|
|
|
case ':':
|
|
|
|
case '/':
|
2017-10-22 01:06:24 +02:00
|
|
|
if (delim != NULL)
|
|
|
|
*delim = *s;
|
2005-03-01 11:24:33 +01:00
|
|
|
*s = '\0'; /* terminate */
|
|
|
|
*cp = s + 1;
|
|
|
|
break;
|
2005-03-14 13:08:12 +01:00
|
|
|
|
2005-03-01 11:24:33 +01:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return old;
|
|
|
|
}
|
|
|
|
|
2022-02-08 09:59:12 +01:00
|
|
|
/* The common case: only accept colon as delimiter. */
|
2017-10-22 01:06:24 +02:00
|
|
|
char *
|
|
|
|
hpdelim(char **cp)
|
|
|
|
{
|
2022-02-11 01:43:56 +01:00
|
|
|
char *r, delim = '\0';
|
2022-02-08 09:59:12 +01:00
|
|
|
|
|
|
|
r = hpdelim2(cp, &delim);
|
|
|
|
if (delim == '/')
|
|
|
|
return NULL;
|
|
|
|
return r;
|
2017-10-22 01:06:24 +02:00
|
|
|
}
|
|
|
|
|
2001-05-04 01:39:53 +02:00
|
|
|
char *
|
|
|
|
cleanhostname(char *host)
|
|
|
|
{
|
|
|
|
if (*host == '[' && host[strlen(host) - 1] == ']') {
|
|
|
|
host[strlen(host) - 1] = '\0';
|
|
|
|
return (host + 1);
|
|
|
|
} else
|
|
|
|
return host;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
colon(char *cp)
|
|
|
|
{
|
|
|
|
int flag = 0;
|
|
|
|
|
|
|
|
if (*cp == ':') /* Leading colon is part of file name. */
|
2010-06-26 01:30:47 +02:00
|
|
|
return NULL;
|
2016-12-19 23:46:28 +01:00
|
|
|
|
|
|
|
#ifdef WINDOWS
|
|
|
|
/*
|
|
|
|
* Account for Windows file names in the form x: or /x:
|
2017-02-10 23:02:02 +01:00
|
|
|
* Note: This may conflict with potential single character targets
|
2016-12-19 23:46:28 +01:00
|
|
|
*/
|
|
|
|
if ((*cp != '\0' && cp[1] == ':') ||
|
|
|
|
(cp[0] == '/' && cp[1] != '\0' && cp[2] == ':'))
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
|
2001-05-04 01:39:53 +02:00
|
|
|
if (*cp == '[')
|
|
|
|
flag = 1;
|
|
|
|
|
|
|
|
for (; *cp; ++cp) {
|
|
|
|
if (*cp == '@' && *(cp+1) == '[')
|
|
|
|
flag = 1;
|
|
|
|
if (*cp == ']' && *(cp+1) == ':' && flag)
|
|
|
|
return (cp+1);
|
|
|
|
if (*cp == ':' && !flag)
|
|
|
|
return (cp);
|
|
|
|
if (*cp == '/')
|
2010-06-26 01:30:47 +02:00
|
|
|
return NULL;
|
2001-05-04 01:39:53 +02:00
|
|
|
}
|
2010-06-26 01:30:47 +02:00
|
|
|
return NULL;
|
2001-05-04 01:39:53 +02:00
|
|
|
}
|
|
|
|
|
2017-10-22 01:06:24 +02:00
|
|
|
/*
|
|
|
|
* Parse a [user@]host:[path] string.
|
|
|
|
* Caller must free returned user, host and path.
|
|
|
|
* Any of the pointer return arguments may be NULL (useful for syntax checking).
|
|
|
|
* If user was not specified then *userp will be set to NULL.
|
|
|
|
* If host was not specified then *hostp will be set to NULL.
|
|
|
|
* If path was not specified then *pathp will be set to ".".
|
|
|
|
* Returns 0 on success, -1 on failure.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
parse_user_host_path(const char *s, char **userp, char **hostp, char **pathp)
|
|
|
|
{
|
|
|
|
char *user = NULL, *host = NULL, *path = NULL;
|
|
|
|
char *sdup, *tmp;
|
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
if (userp != NULL)
|
|
|
|
*userp = NULL;
|
|
|
|
if (hostp != NULL)
|
|
|
|
*hostp = NULL;
|
|
|
|
if (pathp != NULL)
|
|
|
|
*pathp = NULL;
|
|
|
|
|
2017-10-24 21:41:45 +02:00
|
|
|
sdup = xstrdup(s);
|
2017-10-22 01:06:24 +02:00
|
|
|
|
|
|
|
/* Check for remote syntax: [user@]host:[path] */
|
|
|
|
if ((tmp = colon(sdup)) == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/* Extract optional path */
|
|
|
|
*tmp++ = '\0';
|
|
|
|
if (*tmp == '\0')
|
|
|
|
tmp = ".";
|
|
|
|
path = xstrdup(tmp);
|
|
|
|
|
|
|
|
/* Extract optional user and mandatory host */
|
|
|
|
tmp = strrchr(sdup, '@');
|
|
|
|
if (tmp != NULL) {
|
|
|
|
*tmp++ = '\0';
|
|
|
|
host = xstrdup(cleanhostname(tmp));
|
|
|
|
if (*sdup != '\0')
|
|
|
|
user = xstrdup(sdup);
|
|
|
|
} else {
|
|
|
|
host = xstrdup(cleanhostname(sdup));
|
|
|
|
user = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Success */
|
|
|
|
if (userp != NULL) {
|
|
|
|
*userp = user;
|
|
|
|
user = NULL;
|
|
|
|
}
|
|
|
|
if (hostp != NULL) {
|
|
|
|
*hostp = host;
|
|
|
|
host = NULL;
|
2017-10-24 21:41:45 +02:00
|
|
|
}
|
2017-10-22 01:06:24 +02:00
|
|
|
if (pathp != NULL) {
|
|
|
|
*pathp = path;
|
|
|
|
path = NULL;
|
2017-10-24 21:41:45 +02:00
|
|
|
}
|
2017-10-22 01:06:24 +02:00
|
|
|
ret = 0;
|
|
|
|
out:
|
|
|
|
free(sdup);
|
|
|
|
free(user);
|
|
|
|
free(host);
|
|
|
|
free(path);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-07-15 02:24:30 +02:00
|
|
|
/*
|
|
|
|
* Parse a [user@]host[:port] string.
|
|
|
|
* Caller must free returned user and host.
|
|
|
|
* Any of the pointer return arguments may be NULL (useful for syntax checking).
|
|
|
|
* If user was not specified then *userp will be set to NULL.
|
|
|
|
* If port was not specified then *portp will be -1.
|
|
|
|
* Returns 0 on success, -1 on failure.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
parse_user_host_port(const char *s, char **userp, char **hostp, int *portp)
|
|
|
|
{
|
|
|
|
char *sdup, *cp, *tmp;
|
|
|
|
char *user = NULL, *host = NULL;
|
|
|
|
int port = -1, ret = -1;
|
|
|
|
|
|
|
|
if (userp != NULL)
|
|
|
|
*userp = NULL;
|
|
|
|
if (hostp != NULL)
|
|
|
|
*hostp = NULL;
|
|
|
|
if (portp != NULL)
|
|
|
|
*portp = -1;
|
|
|
|
|
|
|
|
if ((sdup = tmp = strdup(s)) == NULL)
|
|
|
|
return -1;
|
|
|
|
/* Extract optional username */
|
2017-10-22 01:06:24 +02:00
|
|
|
if ((cp = strrchr(tmp, '@')) != NULL) {
|
2016-07-15 02:24:30 +02:00
|
|
|
*cp = '\0';
|
|
|
|
if (*tmp == '\0')
|
|
|
|
goto out;
|
|
|
|
if ((user = strdup(tmp)) == NULL)
|
|
|
|
goto out;
|
|
|
|
tmp = cp + 1;
|
|
|
|
}
|
|
|
|
/* Extract mandatory hostname */
|
|
|
|
if ((cp = hpdelim(&tmp)) == NULL || *cp == '\0')
|
|
|
|
goto out;
|
|
|
|
host = xstrdup(cleanhostname(cp));
|
|
|
|
/* Convert and verify optional port */
|
|
|
|
if (tmp != NULL && *tmp != '\0') {
|
|
|
|
if ((port = a2port(tmp)) <= 0)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
/* Success */
|
|
|
|
if (userp != NULL) {
|
|
|
|
*userp = user;
|
|
|
|
user = NULL;
|
|
|
|
}
|
|
|
|
if (hostp != NULL) {
|
|
|
|
*hostp = host;
|
|
|
|
host = NULL;
|
|
|
|
}
|
|
|
|
if (portp != NULL)
|
|
|
|
*portp = port;
|
|
|
|
ret = 0;
|
|
|
|
out:
|
|
|
|
free(sdup);
|
|
|
|
free(user);
|
|
|
|
free(host);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:06:24 +02:00
|
|
|
/*
|
|
|
|
* Converts a two-byte hex string to decimal.
|
|
|
|
* Returns the decimal value or -1 for invalid input.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
hexchar(const char *s)
|
|
|
|
{
|
|
|
|
unsigned char result[2];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
if (s[i] >= '0' && s[i] <= '9')
|
|
|
|
result[i] = (unsigned char)(s[i] - '0');
|
|
|
|
else if (s[i] >= 'a' && s[i] <= 'f')
|
|
|
|
result[i] = (unsigned char)(s[i] - 'a') + 10;
|
|
|
|
else if (s[i] >= 'A' && s[i] <= 'F')
|
|
|
|
result[i] = (unsigned char)(s[i] - 'A') + 10;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return (result[0] << 4) | result[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Decode an url-encoded string.
|
|
|
|
* Returns a newly allocated string on success or NULL on failure.
|
|
|
|
*/
|
|
|
|
static char *
|
|
|
|
urldecode(const char *src)
|
|
|
|
{
|
|
|
|
char *ret, *dst;
|
|
|
|
int ch;
|
|
|
|
|
|
|
|
ret = xmalloc(strlen(src) + 1);
|
|
|
|
for (dst = ret; *src != '\0'; src++) {
|
|
|
|
switch (*src) {
|
|
|
|
case '+':
|
|
|
|
*dst++ = ' ';
|
|
|
|
break;
|
|
|
|
case '%':
|
|
|
|
if (!isxdigit((unsigned char)src[1]) ||
|
|
|
|
!isxdigit((unsigned char)src[2]) ||
|
|
|
|
(ch = hexchar(src + 1)) == -1) {
|
|
|
|
free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
*dst++ = ch;
|
|
|
|
src += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*dst++ = *src;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*dst = '\0';
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse an (scp|ssh|sftp)://[user@]host[:port][/path] URI.
|
|
|
|
* See https://tools.ietf.org/html/draft-ietf-secsh-scp-sftp-ssh-uri-04
|
|
|
|
* Either user or path may be url-encoded (but not host or port).
|
|
|
|
* Caller must free returned user, host and path.
|
|
|
|
* Any of the pointer return arguments may be NULL (useful for syntax checking)
|
|
|
|
* but the scheme must always be specified.
|
|
|
|
* If user was not specified then *userp will be set to NULL.
|
|
|
|
* If port was not specified then *portp will be -1.
|
|
|
|
* If path was not specified then *pathp will be set to NULL.
|
|
|
|
* Returns 0 on success, 1 if non-uri/wrong scheme, -1 on error/invalid uri.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
parse_uri(const char *scheme, const char *uri, char **userp, char **hostp,
|
|
|
|
int *portp, char **pathp)
|
|
|
|
{
|
|
|
|
char *uridup, *cp, *tmp, ch;
|
|
|
|
char *user = NULL, *host = NULL, *path = NULL;
|
|
|
|
int port = -1, ret = -1;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
len = strlen(scheme);
|
|
|
|
if (strncmp(uri, scheme, len) != 0 || strncmp(uri + len, "://", 3) != 0)
|
|
|
|
return 1;
|
|
|
|
uri += len + 3;
|
|
|
|
|
|
|
|
if (userp != NULL)
|
|
|
|
*userp = NULL;
|
|
|
|
if (hostp != NULL)
|
|
|
|
*hostp = NULL;
|
|
|
|
if (portp != NULL)
|
|
|
|
*portp = -1;
|
|
|
|
if (pathp != NULL)
|
|
|
|
*pathp = NULL;
|
|
|
|
|
|
|
|
uridup = tmp = xstrdup(uri);
|
|
|
|
|
|
|
|
/* Extract optional ssh-info (username + connection params) */
|
|
|
|
if ((cp = strchr(tmp, '@')) != NULL) {
|
|
|
|
char *delim;
|
|
|
|
|
2018-10-04 23:16:02 +02:00
|
|
|
#ifdef WINDOWS
|
|
|
|
/* TODO - This looks to be a core bug in unix code as user can be in UPN format
|
|
|
|
* The above line should be strrchr() instead of strchr.
|
|
|
|
* For time being, special handling when username is in User@domain format
|
|
|
|
*/
|
|
|
|
|
|
|
|
char *cp_1 = cp;
|
|
|
|
if ((cp_1 = strchr(cp + 1, '@')) != NULL)
|
|
|
|
cp = cp_1;
|
|
|
|
#endif
|
2017-10-22 01:06:24 +02:00
|
|
|
*cp = '\0';
|
|
|
|
/* Extract username and connection params */
|
|
|
|
if ((delim = strchr(tmp, ';')) != NULL) {
|
|
|
|
/* Just ignore connection params for now */
|
|
|
|
*delim = '\0';
|
|
|
|
}
|
|
|
|
if (*tmp == '\0') {
|
|
|
|
/* Empty username */
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if ((user = urldecode(tmp)) == NULL)
|
|
|
|
goto out;
|
|
|
|
tmp = cp + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract mandatory hostname */
|
|
|
|
if ((cp = hpdelim2(&tmp, &ch)) == NULL || *cp == '\0')
|
|
|
|
goto out;
|
|
|
|
host = xstrdup(cleanhostname(cp));
|
|
|
|
if (!valid_domain(host, 0, NULL))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (tmp != NULL && *tmp != '\0') {
|
|
|
|
if (ch == ':') {
|
|
|
|
/* Convert and verify port. */
|
|
|
|
if ((cp = strchr(tmp, '/')) != NULL)
|
|
|
|
*cp = '\0';
|
|
|
|
if ((port = a2port(tmp)) <= 0)
|
|
|
|
goto out;
|
|
|
|
tmp = cp ? cp + 1 : NULL;
|
|
|
|
}
|
|
|
|
if (tmp != NULL && *tmp != '\0') {
|
|
|
|
/* Extract optional path */
|
|
|
|
if ((path = urldecode(tmp)) == NULL)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Success */
|
|
|
|
if (userp != NULL) {
|
|
|
|
*userp = user;
|
|
|
|
user = NULL;
|
|
|
|
}
|
|
|
|
if (hostp != NULL) {
|
|
|
|
*hostp = host;
|
|
|
|
host = NULL;
|
|
|
|
}
|
|
|
|
if (portp != NULL)
|
|
|
|
*portp = port;
|
|
|
|
if (pathp != NULL) {
|
|
|
|
*pathp = path;
|
|
|
|
path = NULL;
|
|
|
|
}
|
|
|
|
ret = 0;
|
|
|
|
out:
|
|
|
|
free(uridup);
|
|
|
|
free(user);
|
|
|
|
free(host);
|
|
|
|
free(path);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
/* function to assist building execv() arguments */
|
2001-05-08 22:27:25 +02:00
|
|
|
void
|
|
|
|
addargs(arglist *args, char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
2006-01-31 11:49:27 +01:00
|
|
|
char *cp;
|
2004-08-13 13:18:00 +02:00
|
|
|
u_int nalloc;
|
2006-01-31 11:49:27 +01:00
|
|
|
int r;
|
2001-05-08 22:27:25 +02:00
|
|
|
|
|
|
|
va_start(ap, fmt);
|
2006-01-31 11:49:27 +01:00
|
|
|
r = vasprintf(&cp, fmt, ap);
|
2001-05-08 22:27:25 +02:00
|
|
|
va_end(ap);
|
2006-01-31 11:49:27 +01:00
|
|
|
if (r == -1)
|
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
|
|
|
fatal_f("argument too long");
|
2001-05-08 22:27:25 +02:00
|
|
|
|
2003-09-22 13:04:23 +02:00
|
|
|
nalloc = args->nalloc;
|
2001-05-08 22:27:25 +02:00
|
|
|
if (args->list == NULL) {
|
2003-09-22 13:04:23 +02:00
|
|
|
nalloc = 32;
|
2001-05-08 22:27:25 +02:00
|
|
|
args->num = 0;
|
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
|
|
|
} else if (args->num > (256 * 1024))
|
|
|
|
fatal_f("too many arguments");
|
|
|
|
else if (args->num >= args->nalloc)
|
|
|
|
fatal_f("arglist corrupt");
|
|
|
|
else if (args->num+2 >= nalloc)
|
2003-09-22 13:04:23 +02:00
|
|
|
nalloc *= 2;
|
2001-05-08 22:27:25 +02:00
|
|
|
|
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
|
|
|
args->list = xrecallocarray(args->list, args->nalloc,
|
|
|
|
nalloc, sizeof(char *));
|
2003-09-22 13:04:23 +02:00
|
|
|
args->nalloc = nalloc;
|
2006-01-31 11:49:27 +01:00
|
|
|
args->list[args->num++] = cp;
|
2001-05-08 22:27:25 +02:00
|
|
|
args->list[args->num] = NULL;
|
|
|
|
}
|
2004-12-06 12:47:41 +01:00
|
|
|
|
2006-01-31 11:49:27 +01:00
|
|
|
void
|
|
|
|
replacearg(arglist *args, u_int which, char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
char *cp;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
r = vasprintf(&cp, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
if (r == -1)
|
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
|
|
|
fatal_f("argument too long");
|
|
|
|
if (args->list == NULL || args->num >= args->nalloc)
|
|
|
|
fatal_f("arglist corrupt");
|
2006-01-31 11:49:27 +01:00
|
|
|
|
|
|
|
if (which >= args->num)
|
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
|
|
|
fatal_f("tried to replace invalid arg %d >= %d",
|
2006-01-31 11:49:27 +01:00
|
|
|
which, args->num);
|
2013-06-01 23:31:17 +02:00
|
|
|
free(args->list[which]);
|
2006-01-31 11:49:27 +01:00
|
|
|
args->list[which] = cp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
freeargs(arglist *args)
|
|
|
|
{
|
|
|
|
u_int i;
|
|
|
|
|
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 (args == NULL)
|
|
|
|
return;
|
|
|
|
if (args->list != NULL && args->num < args->nalloc) {
|
2006-01-31 11:49:27 +01:00
|
|
|
for (i = 0; i < args->num; i++)
|
2013-06-01 23:31:17 +02:00
|
|
|
free(args->list[i]);
|
|
|
|
free(args->list);
|
2006-01-31 11:49:27 +01:00
|
|
|
}
|
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
|
|
|
args->nalloc = args->num = 0;
|
|
|
|
args->list = NULL;
|
2006-01-31 11:49:27 +01:00
|
|
|
}
|
|
|
|
|
2022-03-11 22:53:27 +01:00
|
|
|
#ifdef WINDOWS
|
|
|
|
void
|
2022-11-30 17:57:01 +01:00
|
|
|
duplicateargs(arglist *dest, const arglist *source)
|
2022-03-11 22:53:27 +01:00
|
|
|
{
|
|
|
|
if (!source || !dest)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (source->list != NULL) {
|
|
|
|
for (int i = 0; i < source->num; i++) {
|
2022-11-01 20:02:08 +01:00
|
|
|
addargs(dest, "%s", source->list[i]);
|
2022-03-11 22:53:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-05-26 04:02:14 +02:00
|
|
|
/*
|
|
|
|
* Expands tildes in the file name. Returns data allocated by xmalloc.
|
|
|
|
* Warning: this calls getpw*.
|
|
|
|
*/
|
2021-08-10 01:47:44 +02:00
|
|
|
int
|
|
|
|
tilde_expand(const char *filename, uid_t uid, char **retp)
|
2005-05-26 04:02:14 +02:00
|
|
|
{
|
2022-01-08 08:32:45 +01:00
|
|
|
char *ocopy = NULL, *copy, *s = NULL;
|
|
|
|
const char *path = NULL, *user = NULL;
|
2005-05-26 04:02:14 +02:00
|
|
|
struct passwd *pw;
|
2022-01-08 08:32:45 +01:00
|
|
|
size_t len;
|
|
|
|
int ret = -1, r, slash;
|
2005-05-26 04:02:14 +02:00
|
|
|
|
2022-01-08 08:32:45 +01:00
|
|
|
*retp = NULL;
|
2021-08-10 01:47:44 +02:00
|
|
|
if (*filename != '~') {
|
|
|
|
*retp = xstrdup(filename);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-01-08 08:32:45 +01:00
|
|
|
ocopy = copy = xstrdup(filename + 1);
|
2005-05-26 04:02:14 +02:00
|
|
|
|
2022-01-08 08:32:45 +01:00
|
|
|
if (*copy == '\0') /* ~ */
|
|
|
|
path = NULL;
|
|
|
|
else if (*copy == '/') {
|
|
|
|
copy += strspn(copy, "/");
|
|
|
|
if (*copy == '\0')
|
|
|
|
path = NULL; /* ~/ */
|
|
|
|
else
|
|
|
|
path = copy; /* ~/path */
|
|
|
|
} else {
|
|
|
|
user = copy;
|
|
|
|
if ((path = strchr(copy, '/')) != NULL) {
|
|
|
|
copy[path - copy] = '\0';
|
|
|
|
path++;
|
|
|
|
path += strspn(path, "/");
|
|
|
|
if (*path == '\0') /* ~user/ */
|
|
|
|
path = NULL;
|
|
|
|
/* else ~user/path */
|
2021-08-10 01:47:44 +02:00
|
|
|
}
|
2022-01-08 08:32:45 +01:00
|
|
|
/* else ~user */
|
|
|
|
}
|
|
|
|
if (user != NULL) {
|
2021-08-10 01:47:44 +02:00
|
|
|
if ((pw = getpwnam(user)) == NULL) {
|
|
|
|
error_f("No such user %s", user);
|
2022-01-08 08:32:45 +01:00
|
|
|
goto out;
|
2021-08-10 01:47:44 +02:00
|
|
|
}
|
2022-01-08 08:32:45 +01:00
|
|
|
} else if ((pw = getpwuid(uid)) == NULL) {
|
2021-08-10 01:47:44 +02:00
|
|
|
error_f("No such uid %ld", (long)uid);
|
2022-01-08 08:32:45 +01:00
|
|
|
goto out;
|
2021-08-10 01:47:44 +02:00
|
|
|
}
|
2005-05-26 04:02:14 +02:00
|
|
|
|
|
|
|
/* Make sure directory has a trailing '/' */
|
2022-01-08 08:32:45 +01:00
|
|
|
slash = (len = strlen(pw->pw_dir)) == 0 || pw->pw_dir[len - 1] != '/';
|
2005-05-26 04:02:14 +02:00
|
|
|
|
2022-01-08 08:32:45 +01:00
|
|
|
if ((r = xasprintf(&s, "%s%s%s", pw->pw_dir,
|
|
|
|
slash ? "/" : "", path != NULL ? path : "")) <= 0) {
|
|
|
|
error_f("xasprintf failed");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (r >= PATH_MAX) {
|
2021-08-10 01:47:44 +02:00
|
|
|
error_f("Path too long");
|
2022-01-08 08:32:45 +01:00
|
|
|
goto out;
|
2021-08-10 01:47:44 +02:00
|
|
|
}
|
2022-01-08 08:32:45 +01:00
|
|
|
/* success */
|
|
|
|
ret = 0;
|
|
|
|
*retp = s;
|
|
|
|
s = NULL;
|
|
|
|
out:
|
|
|
|
free(s);
|
|
|
|
free(ocopy);
|
|
|
|
return ret;
|
2021-08-10 01:47:44 +02:00
|
|
|
}
|
2013-05-16 12:22:46 +02:00
|
|
|
|
2021-08-10 01:47:44 +02:00
|
|
|
char *
|
|
|
|
tilde_expand_filename(const char *filename, uid_t uid)
|
|
|
|
{
|
|
|
|
char *ret;
|
2005-05-26 04:02:14 +02:00
|
|
|
|
2021-08-10 01:47:44 +02:00
|
|
|
if (tilde_expand(filename, uid, &ret) != 0)
|
|
|
|
cleanup_exit(255);
|
|
|
|
return ret;
|
2005-05-26 04:02:14 +02:00
|
|
|
}
|
|
|
|
|
2005-06-16 05:18:34 +02:00
|
|
|
/*
|
2020-05-29 06:25:40 +02:00
|
|
|
* Expand a string with a set of %[char] escapes and/or ${ENVIRONMENT}
|
|
|
|
* substitutions. A number of escapes may be specified as
|
|
|
|
* (char *escape_chars, char *replacement) pairs. The list must be terminated
|
|
|
|
* by a NULL escape_char. Returns replaced string in memory allocated by
|
|
|
|
* xmalloc which the caller must free.
|
2005-06-16 05:18:34 +02:00
|
|
|
*/
|
2020-05-29 06:25:40 +02:00
|
|
|
static char *
|
|
|
|
vdollar_percent_expand(int *parseerror, int dollar, int percent,
|
|
|
|
const char *string, va_list ap)
|
2005-06-16 05:18:34 +02:00
|
|
|
{
|
|
|
|
#define EXPAND_MAX_KEYS 16
|
2020-05-29 06:25:40 +02:00
|
|
|
u_int num_keys = 0, i;
|
2005-06-16 05:18:34 +02:00
|
|
|
struct {
|
|
|
|
const char *key;
|
|
|
|
const char *repl;
|
|
|
|
} keys[EXPAND_MAX_KEYS];
|
2019-08-16 08:13:15 +02:00
|
|
|
struct sshbuf *buf;
|
2020-05-29 06:25:40 +02:00
|
|
|
int r, missingvar = 0;
|
|
|
|
char *ret = NULL, *var, *varend, *val;
|
|
|
|
size_t len;
|
2019-08-16 08:13:15 +02:00
|
|
|
|
|
|
|
if ((buf = sshbuf_new()) == NULL)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("sshbuf_new failed");
|
2020-05-29 06:25:40 +02:00
|
|
|
if (parseerror == NULL)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("null parseerror arg");
|
2020-05-29 06:25:40 +02:00
|
|
|
*parseerror = 1;
|
|
|
|
|
|
|
|
/* Gather keys if we're doing percent expansion. */
|
|
|
|
if (percent) {
|
|
|
|
for (num_keys = 0; num_keys < EXPAND_MAX_KEYS; num_keys++) {
|
|
|
|
keys[num_keys].key = va_arg(ap, char *);
|
|
|
|
if (keys[num_keys].key == NULL)
|
|
|
|
break;
|
|
|
|
keys[num_keys].repl = va_arg(ap, char *);
|
2020-10-18 13:32:01 +02:00
|
|
|
if (keys[num_keys].repl == NULL) {
|
|
|
|
fatal_f("NULL replacement for token %s",
|
|
|
|
keys[num_keys].key);
|
|
|
|
}
|
2020-05-29 06:25:40 +02:00
|
|
|
}
|
|
|
|
if (num_keys == EXPAND_MAX_KEYS && va_arg(ap, char *) != NULL)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("too many keys");
|
2020-05-29 06:25:40 +02:00
|
|
|
if (num_keys == 0)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("percent expansion without token list");
|
2005-06-16 05:18:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Expand string */
|
|
|
|
for (i = 0; *string != '\0'; string++) {
|
2020-05-29 06:25:40 +02:00
|
|
|
/* Optionally process ${ENVIRONMENT} expansions. */
|
|
|
|
if (dollar && string[0] == '$' && string[1] == '{') {
|
|
|
|
string += 2; /* skip over '${' */
|
|
|
|
if ((varend = strchr(string, '}')) == NULL) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("environment variable '%s' missing "
|
2021-04-03 08:18:40 +02:00
|
|
|
"closing '}'", string);
|
2020-05-29 06:25:40 +02:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
len = varend - string;
|
|
|
|
if (len == 0) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("zero-length environment variable");
|
2020-05-29 06:25:40 +02:00
|
|
|
goto out;
|
2019-08-16 08:13:15 +02:00
|
|
|
}
|
2020-05-29 06:25:40 +02:00
|
|
|
var = xmalloc(len + 1);
|
|
|
|
(void)strlcpy(var, string, len + 1);
|
|
|
|
if ((val = getenv(var)) == NULL) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("env var ${%s} has no value", var);
|
2020-05-29 06:25:40 +02:00
|
|
|
missingvar = 1;
|
|
|
|
} else {
|
2020-10-18 13:32:01 +02:00
|
|
|
debug3_f("expand ${%s} -> '%s'", var, val);
|
2020-05-29 06:25:40 +02:00
|
|
|
if ((r = sshbuf_put(buf, val, strlen(val))) !=0)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_fr(r, "sshbuf_put ${}");
|
2020-05-29 06:25:40 +02:00
|
|
|
}
|
|
|
|
free(var);
|
|
|
|
string += len;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process percent expansions if we have a list of TOKENs.
|
|
|
|
* If we're not doing percent expansion everything just gets
|
|
|
|
* appended here.
|
|
|
|
*/
|
|
|
|
if (*string != '%' || !percent) {
|
2005-06-16 05:18:34 +02:00
|
|
|
append:
|
2020-10-18 13:32:01 +02:00
|
|
|
if ((r = sshbuf_put_u8(buf, *string)) != 0)
|
|
|
|
fatal_fr(r, "sshbuf_put_u8 %%");
|
2005-06-16 05:18:34 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
string++;
|
2010-01-08 08:49:16 +01:00
|
|
|
/* %% case */
|
2005-06-16 05:18:34 +02:00
|
|
|
if (*string == '%')
|
|
|
|
goto append;
|
2020-05-29 06:25:40 +02:00
|
|
|
if (*string == '\0') {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("invalid format");
|
2020-05-29 06:25:40 +02:00
|
|
|
goto out;
|
|
|
|
}
|
2019-08-16 08:13:15 +02:00
|
|
|
for (i = 0; i < num_keys; i++) {
|
|
|
|
if (strchr(keys[i].key, *string) != NULL) {
|
|
|
|
if ((r = sshbuf_put(buf, keys[i].repl,
|
2020-10-18 13:32:01 +02:00
|
|
|
strlen(keys[i].repl))) != 0)
|
|
|
|
fatal_fr(r, "sshbuf_put %%-repl");
|
2005-06-16 05:18:34 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-05-29 06:25:40 +02:00
|
|
|
if (i >= num_keys) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("unknown key %%%c", *string);
|
2020-05-29 06:25:40 +02:00
|
|
|
goto out;
|
|
|
|
}
|
2005-06-16 05:18:34 +02:00
|
|
|
}
|
2020-05-29 06:25:40 +02:00
|
|
|
if (!missingvar && (ret = sshbuf_dup_string(buf)) == NULL)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("sshbuf_dup_string failed");
|
2020-05-29 06:25:40 +02:00
|
|
|
*parseerror = 0;
|
|
|
|
out:
|
2019-08-16 08:13:15 +02:00
|
|
|
sshbuf_free(buf);
|
2020-05-29 06:25:40 +02:00
|
|
|
return *parseerror ? NULL : ret;
|
2005-06-16 05:18:34 +02:00
|
|
|
#undef EXPAND_MAX_KEYS
|
|
|
|
}
|
|
|
|
|
2020-05-29 13:17:56 +02:00
|
|
|
/*
|
|
|
|
* Expand only environment variables.
|
|
|
|
* Note that although this function is variadic like the other similar
|
|
|
|
* functions, any such arguments will be unused.
|
|
|
|
*/
|
|
|
|
|
2020-05-29 06:25:40 +02:00
|
|
|
char *
|
2020-05-29 13:17:56 +02:00
|
|
|
dollar_expand(int *parseerr, const char *string, ...)
|
2020-05-29 06:25:40 +02:00
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
int err;
|
2020-05-29 13:17:56 +02:00
|
|
|
va_list ap;
|
2020-05-29 06:25:40 +02:00
|
|
|
|
2020-05-29 13:17:56 +02:00
|
|
|
va_start(ap, string);
|
|
|
|
ret = vdollar_percent_expand(&err, 1, 0, string, ap);
|
|
|
|
va_end(ap);
|
2020-05-29 06:25:40 +02:00
|
|
|
if (parseerr != NULL)
|
|
|
|
*parseerr = err;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns expanded string or NULL if a specified environment variable is
|
|
|
|
* not defined, or calls fatal if the string is invalid.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
percent_expand(const char *string, ...)
|
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
int err;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, string);
|
|
|
|
ret = vdollar_percent_expand(&err, 0, 1, string, ap);
|
|
|
|
va_end(ap);
|
|
|
|
if (err)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("failed");
|
2020-05-29 06:25:40 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns expanded string or NULL if a specified environment variable is
|
|
|
|
* not defined, or calls fatal if the string is invalid.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
percent_dollar_expand(const char *string, ...)
|
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
int err;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, string);
|
|
|
|
ret = vdollar_percent_expand(&err, 1, 1, string, ap);
|
|
|
|
va_end(ap);
|
|
|
|
if (err)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("failed");
|
2020-05-29 06:25:40 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-12-13 09:29:02 +01:00
|
|
|
int
|
2017-10-23 07:08:00 +02:00
|
|
|
tun_open(int tun, int mode, char **ifname)
|
2005-12-13 09:29:02 +01:00
|
|
|
{
|
2005-12-13 10:44:13 +01:00
|
|
|
#if defined(CUSTOM_SYS_TUN_OPEN)
|
2017-10-23 07:08:00 +02:00
|
|
|
return (sys_tun_open(tun, mode, ifname));
|
2006-01-01 09:47:05 +01:00
|
|
|
#elif defined(SSH_TUN_OPENBSD)
|
2005-12-13 09:33:19 +01:00
|
|
|
struct ifreq ifr;
|
2005-12-13 09:29:02 +01:00
|
|
|
char name[100];
|
2005-12-13 09:33:19 +01:00
|
|
|
int fd = -1, sock;
|
2015-10-24 10:34:09 +02:00
|
|
|
const char *tunbase = "tun";
|
|
|
|
|
2017-10-23 07:08:00 +02:00
|
|
|
if (ifname != NULL)
|
|
|
|
*ifname = NULL;
|
|
|
|
|
2015-10-24 10:34:09 +02:00
|
|
|
if (mode == SSH_TUNMODE_ETHERNET)
|
|
|
|
tunbase = "tap";
|
2005-12-13 09:29:02 +01:00
|
|
|
|
2005-12-13 09:33:19 +01:00
|
|
|
/* Open the tunnel device */
|
|
|
|
if (tun <= SSH_TUNID_MAX) {
|
2015-10-24 10:34:09 +02:00
|
|
|
snprintf(name, sizeof(name), "/dev/%s%d", tunbase, tun);
|
2005-12-13 09:33:19 +01:00
|
|
|
fd = open(name, O_RDWR);
|
|
|
|
} else if (tun == SSH_TUNID_ANY) {
|
|
|
|
for (tun = 100; tun >= 0; tun--) {
|
2015-10-24 10:34:09 +02:00
|
|
|
snprintf(name, sizeof(name), "/dev/%s%d",
|
|
|
|
tunbase, tun);
|
2005-12-13 09:33:19 +01:00
|
|
|
if ((fd = open(name, O_RDWR)) >= 0)
|
|
|
|
break;
|
2005-12-13 09:29:02 +01:00
|
|
|
}
|
|
|
|
} else {
|
2020-10-18 13:32:01 +02:00
|
|
|
debug_f("invalid tunnel %u", tun);
|
2015-10-07 02:54:06 +02:00
|
|
|
return -1;
|
2005-12-13 09:33:19 +01:00
|
|
|
}
|
|
|
|
|
2019-06-28 15:35:04 +02:00
|
|
|
if (fd == -1) {
|
2020-10-18 13:32:01 +02:00
|
|
|
debug_f("%s open: %s", name, strerror(errno));
|
2015-10-07 02:54:06 +02:00
|
|
|
return -1;
|
2005-12-13 09:33:19 +01:00
|
|
|
}
|
|
|
|
|
2020-10-18 13:32:01 +02:00
|
|
|
debug_f("%s mode %d fd %d", name, mode, fd);
|
2005-12-13 09:33:19 +01:00
|
|
|
|
2015-10-24 10:34:09 +02:00
|
|
|
/* Bring interface up if it is not already */
|
|
|
|
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", tunbase, tun);
|
|
|
|
if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
|
2005-12-13 09:33:19 +01:00
|
|
|
goto failed;
|
|
|
|
|
2015-10-07 02:54:06 +02:00
|
|
|
if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) {
|
2020-10-18 13:32:01 +02:00
|
|
|
debug_f("get interface %s flags: %s", ifr.ifr_name,
|
|
|
|
strerror(errno));
|
2005-12-13 09:33:19 +01:00
|
|
|
goto failed;
|
2015-10-07 02:54:06 +02:00
|
|
|
}
|
2006-01-02 13:41:21 +01:00
|
|
|
|
2015-10-07 02:54:06 +02:00
|
|
|
if (!(ifr.ifr_flags & IFF_UP)) {
|
|
|
|
ifr.ifr_flags |= IFF_UP;
|
|
|
|
if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) {
|
2020-10-18 13:32:01 +02:00
|
|
|
debug_f("activate interface %s: %s", ifr.ifr_name,
|
|
|
|
strerror(errno));
|
2015-10-07 02:54:06 +02:00
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
}
|
2005-12-13 09:33:19 +01:00
|
|
|
|
2017-10-23 07:08:00 +02:00
|
|
|
if (ifname != NULL)
|
|
|
|
*ifname = xstrdup(ifr.ifr_name);
|
|
|
|
|
2005-12-13 09:33:19 +01:00
|
|
|
close(sock);
|
2015-10-07 02:54:06 +02:00
|
|
|
return fd;
|
2005-12-13 09:33:19 +01:00
|
|
|
|
|
|
|
failed:
|
|
|
|
if (fd >= 0)
|
|
|
|
close(fd);
|
|
|
|
if (sock >= 0)
|
|
|
|
close(sock);
|
2015-10-07 02:54:06 +02:00
|
|
|
return -1;
|
2005-12-13 10:44:13 +01:00
|
|
|
#else
|
|
|
|
error("Tunnel interfaces are not supported on this platform");
|
|
|
|
return (-1);
|
|
|
|
#endif
|
2005-12-13 09:29:02 +01:00
|
|
|
}
|
|
|
|
|
2005-10-03 10:11:24 +02:00
|
|
|
void
|
|
|
|
sanitise_stdfd(void)
|
|
|
|
{
|
2006-01-06 04:50:44 +01:00
|
|
|
int nullfd, dupfd;
|
2005-10-03 10:11:24 +02:00
|
|
|
|
2006-01-06 04:50:44 +01:00
|
|
|
if ((nullfd = dupfd = open(_PATH_DEVNULL, O_RDWR)) == -1) {
|
2009-02-21 22:47:02 +01:00
|
|
|
fprintf(stderr, "Couldn't open /dev/null: %s\n",
|
|
|
|
strerror(errno));
|
2005-10-03 10:11:24 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
2016-04-02 16:37:42 +02:00
|
|
|
while (++dupfd <= STDERR_FILENO) {
|
|
|
|
/* Only populate closed fds. */
|
|
|
|
if (fcntl(dupfd, F_GETFL) == -1 && errno == EBADF) {
|
|
|
|
if (dup2(nullfd, dupfd) == -1) {
|
|
|
|
fprintf(stderr, "dup2: %s\n", strerror(errno));
|
|
|
|
exit(1);
|
|
|
|
}
|
2005-10-03 10:11:24 +02:00
|
|
|
}
|
|
|
|
}
|
2016-04-02 16:37:42 +02:00
|
|
|
if (nullfd > STDERR_FILENO)
|
2005-10-03 10:11:24 +02:00
|
|
|
close(nullfd);
|
|
|
|
}
|
|
|
|
|
2005-07-06 01:44:19 +02:00
|
|
|
char *
|
2006-03-31 14:13:02 +02:00
|
|
|
tohex(const void *vp, size_t l)
|
2005-07-06 01:44:19 +02:00
|
|
|
{
|
2006-03-31 14:13:02 +02:00
|
|
|
const u_char *p = (const u_char *)vp;
|
2005-07-06 01:44:19 +02:00
|
|
|
char b[3], *r;
|
2006-03-31 14:13:02 +02:00
|
|
|
size_t i, hl;
|
|
|
|
|
|
|
|
if (l > 65536)
|
|
|
|
return xstrdup("tohex: length > 65536");
|
2005-07-06 01:44:19 +02:00
|
|
|
|
|
|
|
hl = l * 2 + 1;
|
2006-03-26 05:19:21 +02:00
|
|
|
r = xcalloc(1, hl);
|
2005-07-06 01:44:19 +02:00
|
|
|
for (i = 0; i < l; i++) {
|
2006-03-31 14:13:02 +02:00
|
|
|
snprintf(b, sizeof(b), "%02x", p[i]);
|
2005-07-06 01:44:19 +02:00
|
|
|
strlcat(r, b, hl);
|
|
|
|
}
|
|
|
|
return (r);
|
|
|
|
}
|
|
|
|
|
2020-01-25 00:54:40 +01:00
|
|
|
/*
|
|
|
|
* Extend string *sp by the specified format. If *sp is not NULL (or empty),
|
|
|
|
* then the separator 'sep' will be prepended before the formatted arguments.
|
|
|
|
* Extended strings are heap allocated.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
xextendf(char **sp, const char *sep, const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
char *tmp1, *tmp2;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
xvasprintf(&tmp1, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
if (*sp == NULL || **sp == '\0') {
|
|
|
|
free(*sp);
|
|
|
|
*sp = tmp1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
xasprintf(&tmp2, "%s%s%s", *sp, sep == NULL ? "" : sep, tmp1);
|
|
|
|
free(tmp1);
|
|
|
|
free(*sp);
|
|
|
|
*sp = tmp2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-31 14:13:02 +02:00
|
|
|
u_int64_t
|
|
|
|
get_u64(const void *vp)
|
|
|
|
{
|
|
|
|
const u_char *p = (const u_char *)vp;
|
|
|
|
u_int64_t v;
|
|
|
|
|
|
|
|
v = (u_int64_t)p[0] << 56;
|
|
|
|
v |= (u_int64_t)p[1] << 48;
|
|
|
|
v |= (u_int64_t)p[2] << 40;
|
|
|
|
v |= (u_int64_t)p[3] << 32;
|
|
|
|
v |= (u_int64_t)p[4] << 24;
|
|
|
|
v |= (u_int64_t)p[5] << 16;
|
|
|
|
v |= (u_int64_t)p[6] << 8;
|
|
|
|
v |= (u_int64_t)p[7];
|
|
|
|
|
|
|
|
return (v);
|
|
|
|
}
|
|
|
|
|
|
|
|
u_int32_t
|
|
|
|
get_u32(const void *vp)
|
|
|
|
{
|
|
|
|
const u_char *p = (const u_char *)vp;
|
|
|
|
u_int32_t v;
|
|
|
|
|
|
|
|
v = (u_int32_t)p[0] << 24;
|
|
|
|
v |= (u_int32_t)p[1] << 16;
|
|
|
|
v |= (u_int32_t)p[2] << 8;
|
|
|
|
v |= (u_int32_t)p[3];
|
|
|
|
|
|
|
|
return (v);
|
|
|
|
}
|
|
|
|
|
2014-04-20 05:33:19 +02:00
|
|
|
u_int32_t
|
|
|
|
get_u32_le(const void *vp)
|
|
|
|
{
|
|
|
|
const u_char *p = (const u_char *)vp;
|
|
|
|
u_int32_t v;
|
|
|
|
|
|
|
|
v = (u_int32_t)p[0];
|
|
|
|
v |= (u_int32_t)p[1] << 8;
|
|
|
|
v |= (u_int32_t)p[2] << 16;
|
|
|
|
v |= (u_int32_t)p[3] << 24;
|
|
|
|
|
|
|
|
return (v);
|
|
|
|
}
|
|
|
|
|
2006-03-31 14:13:02 +02:00
|
|
|
u_int16_t
|
|
|
|
get_u16(const void *vp)
|
|
|
|
{
|
|
|
|
const u_char *p = (const u_char *)vp;
|
|
|
|
u_int16_t v;
|
|
|
|
|
|
|
|
v = (u_int16_t)p[0] << 8;
|
|
|
|
v |= (u_int16_t)p[1];
|
|
|
|
|
|
|
|
return (v);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
put_u64(void *vp, u_int64_t v)
|
|
|
|
{
|
|
|
|
u_char *p = (u_char *)vp;
|
|
|
|
|
|
|
|
p[0] = (u_char)(v >> 56) & 0xff;
|
|
|
|
p[1] = (u_char)(v >> 48) & 0xff;
|
|
|
|
p[2] = (u_char)(v >> 40) & 0xff;
|
|
|
|
p[3] = (u_char)(v >> 32) & 0xff;
|
|
|
|
p[4] = (u_char)(v >> 24) & 0xff;
|
|
|
|
p[5] = (u_char)(v >> 16) & 0xff;
|
|
|
|
p[6] = (u_char)(v >> 8) & 0xff;
|
|
|
|
p[7] = (u_char)v & 0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
put_u32(void *vp, u_int32_t v)
|
|
|
|
{
|
|
|
|
u_char *p = (u_char *)vp;
|
|
|
|
|
|
|
|
p[0] = (u_char)(v >> 24) & 0xff;
|
|
|
|
p[1] = (u_char)(v >> 16) & 0xff;
|
|
|
|
p[2] = (u_char)(v >> 8) & 0xff;
|
|
|
|
p[3] = (u_char)v & 0xff;
|
|
|
|
}
|
|
|
|
|
2014-04-20 05:33:19 +02:00
|
|
|
void
|
|
|
|
put_u32_le(void *vp, u_int32_t v)
|
|
|
|
{
|
|
|
|
u_char *p = (u_char *)vp;
|
|
|
|
|
|
|
|
p[0] = (u_char)v & 0xff;
|
|
|
|
p[1] = (u_char)(v >> 8) & 0xff;
|
|
|
|
p[2] = (u_char)(v >> 16) & 0xff;
|
|
|
|
p[3] = (u_char)(v >> 24) & 0xff;
|
|
|
|
}
|
2006-03-31 14:13:02 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
put_u16(void *vp, u_int16_t v)
|
|
|
|
{
|
|
|
|
u_char *p = (u_char *)vp;
|
|
|
|
|
|
|
|
p[0] = (u_char)(v >> 8) & 0xff;
|
|
|
|
p[1] = (u_char)v & 0xff;
|
|
|
|
}
|
2008-06-12 22:42:45 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
ms_subtract_diff(struct timeval *start, int *ms)
|
|
|
|
{
|
|
|
|
struct timeval diff, finish;
|
|
|
|
|
2017-11-25 07:46:22 +01:00
|
|
|
monotime_tv(&finish);
|
|
|
|
timersub(&finish, start, &diff);
|
2008-06-12 22:42:45 +02:00
|
|
|
*ms -= (diff.tv_sec * 1000) + (diff.tv_usec / 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-11-13 22:14:13 +01:00
|
|
|
ms_to_timespec(struct timespec *ts, int ms)
|
2008-06-12 22:42:45 +02:00
|
|
|
{
|
|
|
|
if (ms < 0)
|
|
|
|
ms = 0;
|
2021-11-13 22:14:13 +01:00
|
|
|
ts->tv_sec = ms / 1000;
|
|
|
|
ts->tv_nsec = (ms % 1000) * 1000 * 1000;
|
2008-06-12 22:42:45 +02:00
|
|
|
}
|
|
|
|
|
2017-11-25 07:46:22 +01:00
|
|
|
void
|
|
|
|
monotime_ts(struct timespec *ts)
|
2013-06-01 23:46:16 +02:00
|
|
|
{
|
2017-11-25 07:46:22 +01:00
|
|
|
struct timeval tv;
|
|
|
|
#if defined(HAVE_CLOCK_GETTIME) && (defined(CLOCK_BOOTTIME) || \
|
|
|
|
defined(CLOCK_MONOTONIC) || defined(CLOCK_REALTIME))
|
2013-08-08 03:52:37 +02:00
|
|
|
static int gettime_failed = 0;
|
2013-06-01 23:46:16 +02:00
|
|
|
|
2013-08-08 03:52:37 +02:00
|
|
|
if (!gettime_failed) {
|
2017-11-25 07:46:22 +01:00
|
|
|
# ifdef CLOCK_BOOTTIME
|
|
|
|
if (clock_gettime(CLOCK_BOOTTIME, ts) == 0)
|
|
|
|
return;
|
|
|
|
# endif /* CLOCK_BOOTTIME */
|
|
|
|
# ifdef CLOCK_MONOTONIC
|
|
|
|
if (clock_gettime(CLOCK_MONOTONIC, ts) == 0)
|
|
|
|
return;
|
|
|
|
# endif /* CLOCK_MONOTONIC */
|
|
|
|
# ifdef CLOCK_REALTIME
|
|
|
|
/* Not monotonic, but we're almost out of options here. */
|
|
|
|
if (clock_gettime(CLOCK_REALTIME, ts) == 0)
|
|
|
|
return;
|
|
|
|
# endif /* CLOCK_REALTIME */
|
2013-08-08 03:52:37 +02:00
|
|
|
debug3("clock_gettime: %s", strerror(errno));
|
|
|
|
gettime_failed = 1;
|
|
|
|
}
|
2017-11-25 07:46:22 +01:00
|
|
|
#endif /* HAVE_CLOCK_GETTIME && (BOOTTIME || MONOTONIC || REALTIME) */
|
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
ts->tv_sec = tv.tv_sec;
|
|
|
|
ts->tv_nsec = (long)tv.tv_usec * 1000;
|
|
|
|
}
|
2013-06-01 23:46:16 +02:00
|
|
|
|
2017-11-25 07:46:22 +01:00
|
|
|
void
|
|
|
|
monotime_tv(struct timeval *tv)
|
|
|
|
{
|
|
|
|
struct timespec ts;
|
2013-06-01 23:46:16 +02:00
|
|
|
|
2017-11-25 07:46:22 +01:00
|
|
|
monotime_ts(&ts);
|
|
|
|
tv->tv_sec = ts.tv_sec;
|
|
|
|
tv->tv_usec = ts.tv_nsec / 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t
|
|
|
|
monotime(void)
|
|
|
|
{
|
|
|
|
struct timespec ts;
|
|
|
|
|
|
|
|
monotime_ts(&ts);
|
|
|
|
return ts.tv_sec;
|
2013-06-01 23:46:16 +02:00
|
|
|
}
|
|
|
|
|
2016-03-02 23:42:40 +01:00
|
|
|
double
|
|
|
|
monotime_double(void)
|
|
|
|
{
|
|
|
|
struct timespec ts;
|
|
|
|
|
2017-11-25 07:46:22 +01:00
|
|
|
monotime_ts(&ts);
|
|
|
|
return ts.tv_sec + ((double)ts.tv_nsec / 1000000000);
|
2016-03-02 23:42:40 +01:00
|
|
|
}
|
|
|
|
|
2010-09-24 14:15:11 +02:00
|
|
|
void
|
|
|
|
bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen)
|
|
|
|
{
|
|
|
|
bw->buflen = buflen;
|
|
|
|
bw->rate = kbps;
|
2018-12-07 05:36:09 +01:00
|
|
|
bw->thresh = buflen;
|
2010-09-24 14:15:11 +02:00
|
|
|
bw->lamt = 0;
|
|
|
|
timerclear(&bw->bwstart);
|
|
|
|
timerclear(&bw->bwend);
|
2018-12-07 05:36:09 +01:00
|
|
|
}
|
2010-09-24 14:15:11 +02:00
|
|
|
|
|
|
|
/* Callback from read/write loop to insert bandwidth-limiting delays */
|
|
|
|
void
|
|
|
|
bandwidth_limit(struct bwlimit *bw, size_t read_len)
|
|
|
|
{
|
|
|
|
u_int64_t waitlen;
|
|
|
|
struct timespec ts, rm;
|
|
|
|
|
2018-12-07 05:36:09 +01:00
|
|
|
bw->lamt += read_len;
|
2010-09-24 14:15:11 +02:00
|
|
|
if (!timerisset(&bw->bwstart)) {
|
2017-11-25 07:46:22 +01:00
|
|
|
monotime_tv(&bw->bwstart);
|
2010-09-24 14:15:11 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (bw->lamt < bw->thresh)
|
|
|
|
return;
|
|
|
|
|
2017-11-25 07:46:22 +01:00
|
|
|
monotime_tv(&bw->bwend);
|
2010-09-24 14:15:11 +02:00
|
|
|
timersub(&bw->bwend, &bw->bwstart, &bw->bwend);
|
|
|
|
if (!timerisset(&bw->bwend))
|
|
|
|
return;
|
|
|
|
|
|
|
|
bw->lamt *= 8;
|
|
|
|
waitlen = (double)1000000L * bw->lamt / bw->rate;
|
|
|
|
|
|
|
|
bw->bwstart.tv_sec = waitlen / 1000000L;
|
|
|
|
bw->bwstart.tv_usec = waitlen % 1000000L;
|
|
|
|
|
|
|
|
if (timercmp(&bw->bwstart, &bw->bwend, >)) {
|
|
|
|
timersub(&bw->bwstart, &bw->bwend, &bw->bwend);
|
|
|
|
|
|
|
|
/* Adjust the wait time */
|
|
|
|
if (bw->bwend.tv_sec) {
|
|
|
|
bw->thresh /= 2;
|
|
|
|
if (bw->thresh < bw->buflen / 4)
|
|
|
|
bw->thresh = bw->buflen / 4;
|
|
|
|
} else if (bw->bwend.tv_usec < 10000) {
|
|
|
|
bw->thresh *= 2;
|
|
|
|
if (bw->thresh > bw->buflen * 8)
|
|
|
|
bw->thresh = bw->buflen * 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
TIMEVAL_TO_TIMESPEC(&bw->bwend, &ts);
|
|
|
|
while (nanosleep(&ts, &rm) == -1) {
|
|
|
|
if (errno != EINTR)
|
|
|
|
break;
|
|
|
|
ts = rm;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bw->lamt = 0;
|
2017-11-25 07:46:22 +01:00
|
|
|
monotime_tv(&bw->bwstart);
|
2010-09-24 14:15:11 +02:00
|
|
|
}
|
2010-11-20 05:19:38 +01:00
|
|
|
|
2010-12-01 01:50:35 +01:00
|
|
|
/* Make a template filename for mk[sd]temp() */
|
|
|
|
void
|
|
|
|
mktemp_proto(char *s, size_t len)
|
|
|
|
{
|
|
|
|
const char *tmpdir;
|
|
|
|
int r;
|
|
|
|
|
2021-05-03 21:31:52 +02:00
|
|
|
tmpdir = getenv("TMPDIR");
|
|
|
|
|
|
|
|
#ifdef WINDOWS
|
|
|
|
if (tmpdir == NULL) {
|
|
|
|
tmpdir = getenv("TEMP");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (tmpdir != NULL) {
|
2010-12-01 01:50:35 +01:00
|
|
|
r = snprintf(s, len, "%s/ssh-XXXXXXXXXXXX", tmpdir);
|
|
|
|
if (r > 0 && (size_t)r < len)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXXXX");
|
|
|
|
if (r < 0 || (size_t)r >= len)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("template string too short");
|
2010-12-01 01:50:35 +01:00
|
|
|
}
|
|
|
|
|
2010-11-20 05:19:38 +01:00
|
|
|
static const struct {
|
|
|
|
const char *name;
|
|
|
|
int value;
|
|
|
|
} ipqos[] = {
|
2017-07-24 01:37:02 +02:00
|
|
|
{ "none", INT_MAX }, /* can't use 0 here; that's CS0 */
|
2010-11-20 05:19:38 +01:00
|
|
|
{ "af11", IPTOS_DSCP_AF11 },
|
|
|
|
{ "af12", IPTOS_DSCP_AF12 },
|
|
|
|
{ "af13", IPTOS_DSCP_AF13 },
|
2011-09-22 13:34:35 +02:00
|
|
|
{ "af21", IPTOS_DSCP_AF21 },
|
2010-11-20 05:19:38 +01:00
|
|
|
{ "af22", IPTOS_DSCP_AF22 },
|
|
|
|
{ "af23", IPTOS_DSCP_AF23 },
|
|
|
|
{ "af31", IPTOS_DSCP_AF31 },
|
|
|
|
{ "af32", IPTOS_DSCP_AF32 },
|
|
|
|
{ "af33", IPTOS_DSCP_AF33 },
|
|
|
|
{ "af41", IPTOS_DSCP_AF41 },
|
|
|
|
{ "af42", IPTOS_DSCP_AF42 },
|
|
|
|
{ "af43", IPTOS_DSCP_AF43 },
|
|
|
|
{ "cs0", IPTOS_DSCP_CS0 },
|
|
|
|
{ "cs1", IPTOS_DSCP_CS1 },
|
|
|
|
{ "cs2", IPTOS_DSCP_CS2 },
|
|
|
|
{ "cs3", IPTOS_DSCP_CS3 },
|
|
|
|
{ "cs4", IPTOS_DSCP_CS4 },
|
|
|
|
{ "cs5", IPTOS_DSCP_CS5 },
|
|
|
|
{ "cs6", IPTOS_DSCP_CS6 },
|
|
|
|
{ "cs7", IPTOS_DSCP_CS7 },
|
|
|
|
{ "ef", IPTOS_DSCP_EF },
|
2020-01-28 02:49:36 +01:00
|
|
|
{ "le", IPTOS_DSCP_LE },
|
2010-11-20 05:19:38 +01:00
|
|
|
{ "lowdelay", IPTOS_LOWDELAY },
|
|
|
|
{ "throughput", IPTOS_THROUGHPUT },
|
|
|
|
{ "reliability", IPTOS_RELIABILITY },
|
|
|
|
{ NULL, -1 }
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
parse_ipqos(const char *cp)
|
|
|
|
{
|
|
|
|
u_int i;
|
|
|
|
char *ep;
|
|
|
|
long val;
|
|
|
|
|
|
|
|
if (cp == NULL)
|
|
|
|
return -1;
|
|
|
|
for (i = 0; ipqos[i].name != NULL; i++) {
|
|
|
|
if (strcasecmp(cp, ipqos[i].name) == 0)
|
|
|
|
return ipqos[i].value;
|
|
|
|
}
|
|
|
|
/* Try parsing as an integer */
|
2022-11-30 17:57:01 +01:00
|
|
|
val = strtol(cp, &ep, 0); // CodeQL [SM02313]: strtoul will initialize ep
|
2010-11-20 05:19:38 +01:00
|
|
|
if (*cp == '\0' || *ep != '\0' || val < 0 || val > 255)
|
|
|
|
return -1;
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2011-05-05 06:14:34 +02:00
|
|
|
const char *
|
|
|
|
iptos2str(int iptos)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
static char iptos_str[sizeof "0xff"];
|
|
|
|
|
|
|
|
for (i = 0; ipqos[i].name != NULL; i++) {
|
|
|
|
if (ipqos[i].value == iptos)
|
|
|
|
return ipqos[i].name;
|
|
|
|
}
|
|
|
|
snprintf(iptos_str, sizeof iptos_str, "0x%02x", iptos);
|
|
|
|
return iptos_str;
|
|
|
|
}
|
2013-10-15 03:14:12 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
lowercase(char *s)
|
|
|
|
{
|
|
|
|
for (; *s; s++)
|
|
|
|
*s = tolower((u_char)*s);
|
|
|
|
}
|
2014-07-18 06:11:24 +02:00
|
|
|
|
|
|
|
int
|
|
|
|
unix_listener(const char *path, int backlog, int unlink_first)
|
|
|
|
{
|
|
|
|
struct sockaddr_un sunaddr;
|
|
|
|
int saved_errno, sock;
|
|
|
|
|
|
|
|
memset(&sunaddr, 0, sizeof(sunaddr));
|
|
|
|
sunaddr.sun_family = AF_UNIX;
|
2017-12-08 03:13:02 +01:00
|
|
|
if (strlcpy(sunaddr.sun_path, path,
|
|
|
|
sizeof(sunaddr.sun_path)) >= sizeof(sunaddr.sun_path)) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("path \"%s\" too long for Unix domain socket", path);
|
2014-07-18 06:11:24 +02:00
|
|
|
errno = ENAMETOOLONG;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sock = socket(PF_UNIX, SOCK_STREAM, 0);
|
2019-06-28 15:35:04 +02:00
|
|
|
if (sock == -1) {
|
2014-07-18 06:11:24 +02:00
|
|
|
saved_errno = errno;
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("socket: %.100s", strerror(errno));
|
2014-07-18 06:11:24 +02:00
|
|
|
errno = saved_errno;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (unlink_first == 1) {
|
|
|
|
if (unlink(path) != 0 && errno != ENOENT)
|
|
|
|
error("unlink(%s): %.100s", path, strerror(errno));
|
|
|
|
}
|
2019-06-28 15:35:04 +02:00
|
|
|
if (bind(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) == -1) {
|
2014-07-18 06:11:24 +02:00
|
|
|
saved_errno = errno;
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("cannot bind to path %s: %s", path, strerror(errno));
|
2014-07-18 06:11:24 +02:00
|
|
|
close(sock);
|
|
|
|
errno = saved_errno;
|
|
|
|
return -1;
|
|
|
|
}
|
2019-06-28 15:35:04 +02:00
|
|
|
if (listen(sock, backlog) == -1) {
|
2014-07-18 06:11:24 +02:00
|
|
|
saved_errno = errno;
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("cannot listen on path %s: %s", path, strerror(errno));
|
2014-07-18 06:11:24 +02:00
|
|
|
close(sock);
|
|
|
|
unlink(path);
|
|
|
|
errno = saved_errno;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return sock;
|
|
|
|
}
|
2014-08-29 19:29:19 +02:00
|
|
|
|
2009-11-18 07:48:30 +01:00
|
|
|
void
|
|
|
|
sock_set_v6only(int s)
|
|
|
|
{
|
2015-12-08 23:18:45 +01:00
|
|
|
#if defined(IPV6_V6ONLY) && !defined(__OpenBSD__)
|
2009-11-18 07:48:30 +01:00
|
|
|
int on = 1;
|
|
|
|
|
|
|
|
debug3("%s: set socket %d IPV6_V6ONLY", __func__, s);
|
|
|
|
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1)
|
|
|
|
error("setsockopt IPV6_V6ONLY: %s", strerror(errno));
|
|
|
|
#endif
|
|
|
|
}
|
2016-04-06 08:42:17 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Compares two strings that maybe be NULL. Returns non-zero if strings
|
|
|
|
* are both NULL or are identical, returns zero otherwise.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
strcmp_maybe_null(const char *a, const char *b)
|
|
|
|
{
|
|
|
|
if ((a == NULL && b != NULL) || (a != NULL && b == NULL))
|
|
|
|
return 0;
|
|
|
|
if (a != NULL && strcmp(a, b) != 0)
|
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compare two forwards, returning non-zero if they are identical or
|
|
|
|
* zero otherwise.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
forward_equals(const struct Forward *a, const struct Forward *b)
|
|
|
|
{
|
|
|
|
if (strcmp_maybe_null(a->listen_host, b->listen_host) == 0)
|
|
|
|
return 0;
|
|
|
|
if (a->listen_port != b->listen_port)
|
|
|
|
return 0;
|
|
|
|
if (strcmp_maybe_null(a->listen_path, b->listen_path) == 0)
|
|
|
|
return 0;
|
|
|
|
if (strcmp_maybe_null(a->connect_host, b->connect_host) == 0)
|
|
|
|
return 0;
|
|
|
|
if (a->connect_port != b->connect_port)
|
|
|
|
return 0;
|
|
|
|
if (strcmp_maybe_null(a->connect_path, b->connect_path) == 0)
|
|
|
|
return 0;
|
|
|
|
/* allocated_port and handle are not checked */
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-11-30 01:28:31 +01:00
|
|
|
/* returns 1 if process is already daemonized, 0 otherwise */
|
2016-12-19 23:46:28 +01:00
|
|
|
#ifdef WINDOWS
|
|
|
|
/* This should go away once sshd platform specific startup code is refactored */
|
|
|
|
int
|
|
|
|
daemonized(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#else /* !WINDOWS */
|
2016-11-30 01:28:31 +01:00
|
|
|
int
|
|
|
|
daemonized(void)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if ((fd = open(_PATH_TTY, O_RDONLY | O_NOCTTY)) >= 0) {
|
|
|
|
close(fd);
|
|
|
|
return 0; /* have controlling terminal */
|
|
|
|
}
|
|
|
|
if (getppid() != 1)
|
|
|
|
return 0; /* parent is not init */
|
|
|
|
if (getsid(0) != getpid())
|
|
|
|
return 0; /* not session leader */
|
|
|
|
debug3("already daemonized");
|
|
|
|
return 1;
|
|
|
|
}
|
2016-12-19 23:46:28 +01:00
|
|
|
#endif /* !WINDOWS */
|
2017-08-18 07:36:45 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Splits 's' into an argument vector. Handles quoted string and basic
|
|
|
|
* escape characters (\\, \", \'). Caller must free the argument vector
|
|
|
|
* and its members.
|
|
|
|
*/
|
|
|
|
int
|
2021-06-08 08:54:40 +02:00
|
|
|
argv_split(const char *s, int *argcp, char ***argvp, int terminate_on_comment)
|
2017-08-18 07:36:45 +02:00
|
|
|
{
|
|
|
|
int r = SSH_ERR_INTERNAL_ERROR;
|
|
|
|
int argc = 0, quote, i, j;
|
|
|
|
char *arg, **argv = xcalloc(1, sizeof(*argv));
|
|
|
|
|
|
|
|
*argvp = NULL;
|
|
|
|
*argcp = 0;
|
|
|
|
|
|
|
|
for (i = 0; s[i] != '\0'; i++) {
|
|
|
|
/* Skip leading whitespace */
|
|
|
|
if (s[i] == ' ' || s[i] == '\t')
|
|
|
|
continue;
|
2021-06-08 08:54:40 +02:00
|
|
|
if (terminate_on_comment && s[i] == '#')
|
|
|
|
break;
|
2017-08-18 07:36:45 +02:00
|
|
|
/* Start of a token */
|
|
|
|
quote = 0;
|
|
|
|
|
|
|
|
argv = xreallocarray(argv, (argc + 2), sizeof(*argv));
|
|
|
|
arg = argv[argc++] = xcalloc(1, strlen(s + i) + 1);
|
|
|
|
argv[argc] = NULL;
|
|
|
|
|
|
|
|
/* Copy the token in, removing escapes */
|
|
|
|
for (j = 0; s[i] != '\0'; i++) {
|
|
|
|
if (s[i] == '\\') {
|
|
|
|
if (s[i + 1] == '\'' ||
|
|
|
|
s[i + 1] == '\"' ||
|
2021-06-08 08:54:40 +02:00
|
|
|
s[i + 1] == '\\' ||
|
|
|
|
(quote == 0 && s[i + 1] == ' ')) {
|
2017-08-18 07:36:45 +02:00
|
|
|
i++; /* Skip '\' */
|
|
|
|
arg[j++] = s[i];
|
|
|
|
} else {
|
|
|
|
/* Unrecognised escape */
|
|
|
|
arg[j++] = s[i];
|
|
|
|
}
|
|
|
|
} else if (quote == 0 && (s[i] == ' ' || s[i] == '\t'))
|
|
|
|
break; /* done */
|
2021-04-03 07:21:46 +02:00
|
|
|
else if (quote == 0 && (s[i] == '\"' || s[i] == '\''))
|
|
|
|
quote = s[i]; /* quote start */
|
2017-08-18 07:36:45 +02:00
|
|
|
else if (quote != 0 && s[i] == quote)
|
2021-04-03 07:21:46 +02:00
|
|
|
quote = 0; /* quote end */
|
2017-08-18 07:36:45 +02:00
|
|
|
else
|
|
|
|
arg[j++] = s[i];
|
|
|
|
}
|
|
|
|
if (s[i] == '\0') {
|
|
|
|
if (quote != 0) {
|
|
|
|
/* Ran out of string looking for close quote */
|
|
|
|
r = SSH_ERR_INVALID_FORMAT;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Success */
|
|
|
|
*argcp = argc;
|
|
|
|
*argvp = argv;
|
|
|
|
argc = 0;
|
|
|
|
argv = NULL;
|
|
|
|
r = 0;
|
|
|
|
out:
|
|
|
|
if (argc != 0 && argv != NULL) {
|
|
|
|
for (i = 0; i < argc; i++)
|
|
|
|
free(argv[i]);
|
|
|
|
free(argv);
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reassemble an argument vector into a string, quoting and escaping as
|
|
|
|
* necessary. Caller must free returned string.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
argv_assemble(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int i, j, ws, r;
|
|
|
|
char c, *ret;
|
|
|
|
struct sshbuf *buf, *arg;
|
|
|
|
|
|
|
|
if ((buf = sshbuf_new()) == NULL || (arg = sshbuf_new()) == NULL)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("sshbuf_new failed");
|
2017-08-18 07:36:45 +02:00
|
|
|
|
|
|
|
for (i = 0; i < argc; i++) {
|
|
|
|
ws = 0;
|
|
|
|
sshbuf_reset(arg);
|
|
|
|
for (j = 0; argv[i][j] != '\0'; j++) {
|
|
|
|
r = 0;
|
|
|
|
c = argv[i][j];
|
|
|
|
switch (c) {
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
ws = 1;
|
|
|
|
r = sshbuf_put_u8(arg, c);
|
|
|
|
break;
|
|
|
|
case '\\':
|
|
|
|
case '\'':
|
|
|
|
case '"':
|
|
|
|
if ((r = sshbuf_put_u8(arg, '\\')) != 0)
|
|
|
|
break;
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
default:
|
|
|
|
r = sshbuf_put_u8(arg, c);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (r != 0)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_fr(r, "sshbuf_put_u8");
|
2017-08-18 07:36:45 +02:00
|
|
|
}
|
|
|
|
if ((i != 0 && (r = sshbuf_put_u8(buf, ' ')) != 0) ||
|
|
|
|
(ws != 0 && (r = sshbuf_put_u8(buf, '"')) != 0) ||
|
|
|
|
(r = sshbuf_putb(buf, arg)) != 0 ||
|
|
|
|
(ws != 0 && (r = sshbuf_put_u8(buf, '"')) != 0))
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_fr(r, "assemble");
|
2017-08-18 07:36:45 +02:00
|
|
|
}
|
|
|
|
if ((ret = malloc(sshbuf_len(buf) + 1)) == NULL)
|
2020-10-18 13:32:01 +02:00
|
|
|
fatal_f("malloc failed");
|
2017-08-18 07:36:45 +02:00
|
|
|
memcpy(ret, sshbuf_ptr(buf), sshbuf_len(buf));
|
|
|
|
ret[sshbuf_len(buf)] = '\0';
|
|
|
|
sshbuf_free(buf);
|
|
|
|
sshbuf_free(arg);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-06-08 08:54:40 +02:00
|
|
|
char *
|
|
|
|
argv_next(int *argcp, char ***argvp)
|
|
|
|
{
|
|
|
|
char *ret = (*argvp)[0];
|
|
|
|
|
|
|
|
if (*argcp > 0 && ret != NULL) {
|
|
|
|
(*argcp)--;
|
|
|
|
(*argvp)++;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
argv_consume(int *argcp)
|
|
|
|
{
|
|
|
|
*argcp = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
argv_free(char **av, int ac)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (av == NULL)
|
|
|
|
return;
|
|
|
|
for (i = 0; i < ac; i++)
|
|
|
|
free(av[i]);
|
|
|
|
free(av);
|
|
|
|
}
|
|
|
|
|
2017-08-18 07:36:45 +02:00
|
|
|
/* Returns 0 if pid exited cleanly, non-zero otherwise */
|
|
|
|
int
|
2017-08-18 07:48:04 +02:00
|
|
|
exited_cleanly(pid_t pid, const char *tag, const char *cmd, int quiet)
|
2017-08-18 07:36:45 +02:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
|
|
|
|
while (waitpid(pid, &status, 0) == -1) {
|
|
|
|
if (errno != EINTR) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error("%s waitpid: %s", tag, strerror(errno));
|
2017-08-18 07:36:45 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (WIFSIGNALED(status)) {
|
|
|
|
error("%s %s exited on signal %d", tag, cmd, WTERMSIG(status));
|
|
|
|
return -1;
|
|
|
|
} else if (WEXITSTATUS(status) != 0) {
|
2017-08-18 07:48:04 +02:00
|
|
|
do_log2(quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_INFO,
|
|
|
|
"%s %s failed, status %d", tag, cmd, WEXITSTATUS(status));
|
2017-08-18 07:36:45 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check a given path for security. This is defined as all components
|
|
|
|
* of the path to the file must be owned by either the owner of
|
|
|
|
* of the file or root and no directories must be group or world writable.
|
|
|
|
*
|
|
|
|
* XXX Should any specific check be done for sym links ?
|
|
|
|
*
|
|
|
|
* Takes a file name, its stat information (preferably from fstat() to
|
|
|
|
* avoid races), the uid of the expected owner, their home directory and an
|
|
|
|
* error buffer plus max size as arguments.
|
|
|
|
*
|
|
|
|
* Returns 0 on success and -1 on failure
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
safe_path(const char *name, struct stat *stp, const char *pw_dir,
|
|
|
|
uid_t uid, char *err, size_t errlen)
|
|
|
|
{
|
|
|
|
char buf[PATH_MAX], homedir[PATH_MAX];
|
|
|
|
char *cp;
|
|
|
|
int comparehome = 0;
|
|
|
|
struct stat st;
|
|
|
|
|
|
|
|
if (realpath(name, buf) == NULL) {
|
|
|
|
snprintf(err, errlen, "realpath %s failed: %s", name,
|
|
|
|
strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (pw_dir != NULL && realpath(pw_dir, homedir) != NULL)
|
|
|
|
comparehome = 1;
|
|
|
|
|
|
|
|
if (!S_ISREG(stp->st_mode)) {
|
|
|
|
snprintf(err, errlen, "%s is not a regular file", buf);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) ||
|
|
|
|
(stp->st_mode & 022) != 0) {
|
|
|
|
snprintf(err, errlen, "bad ownership or modes for file %s",
|
|
|
|
buf);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for each component of the canonical path, walking upwards */
|
|
|
|
for (;;) {
|
|
|
|
if ((cp = dirname(buf)) == NULL) {
|
|
|
|
snprintf(err, errlen, "dirname() failed");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
strlcpy(buf, cp, sizeof(buf));
|
|
|
|
|
2019-06-28 15:35:04 +02:00
|
|
|
if (stat(buf, &st) == -1 ||
|
2017-08-18 07:36:45 +02:00
|
|
|
(!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) ||
|
|
|
|
(st.st_mode & 022) != 0) {
|
|
|
|
snprintf(err, errlen,
|
|
|
|
"bad ownership or modes for directory %s", buf);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If are past the homedir then we can stop */
|
2022-11-30 17:57:01 +01:00
|
|
|
if (comparehome && strcmp(homedir, buf) == 0) // CodeQL [SM01714] false positive: homedir is null terminated
|
2017-08-18 07:36:45 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* dirname should always complete with a "/" path,
|
|
|
|
* but we can be paranoid and check for "." too
|
|
|
|
*/
|
|
|
|
if ((strcmp("/", buf) == 0) || (strcmp(".", buf) == 0))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Version of safe_path() that accepts an open file descriptor to
|
|
|
|
* avoid races.
|
|
|
|
*
|
|
|
|
* Returns 0 on success and -1 on failure
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
safe_path_fd(int fd, const char *file, struct passwd *pw,
|
|
|
|
char *err, size_t errlen)
|
|
|
|
{
|
|
|
|
struct stat st;
|
|
|
|
|
|
|
|
/* check the open file to avoid races */
|
2019-06-28 15:35:04 +02:00
|
|
|
if (fstat(fd, &st) == -1) {
|
2017-08-18 07:36:45 +02:00
|
|
|
snprintf(err, errlen, "cannot stat file %s: %s",
|
|
|
|
file, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return safe_path(file, &st, pw->pw_dir, pw->pw_uid, err, errlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sets the value of the given variable in the environment. If the variable
|
|
|
|
* already exists, its value is overridden.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
child_set_env(char ***envp, u_int *envsizep, const char *name,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
char **env;
|
|
|
|
u_int envsize;
|
|
|
|
u_int i, namelen;
|
|
|
|
|
|
|
|
if (strchr(name, '=') != NULL) {
|
|
|
|
error("Invalid environment variable \"%.100s\"", name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we're passed an uninitialized list, allocate a single null
|
|
|
|
* entry before continuing.
|
|
|
|
*/
|
|
|
|
if (*envp == NULL && *envsizep == 0) {
|
|
|
|
*envp = xmalloc(sizeof(char *));
|
|
|
|
*envp[0] = NULL;
|
|
|
|
*envsizep = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the slot where the value should be stored. If the variable
|
|
|
|
* already exists, we reuse the slot; otherwise we append a new slot
|
|
|
|
* at the end of the array, expanding if necessary.
|
|
|
|
*/
|
|
|
|
env = *envp;
|
|
|
|
namelen = strlen(name);
|
|
|
|
for (i = 0; env[i]; i++)
|
|
|
|
if (strncmp(env[i], name, namelen) == 0 && env[i][namelen] == '=')
|
|
|
|
break;
|
|
|
|
if (env[i]) {
|
|
|
|
/* Reuse the slot. */
|
|
|
|
free(env[i]);
|
|
|
|
} else {
|
|
|
|
/* New variable. Expand if necessary. */
|
|
|
|
envsize = *envsizep;
|
|
|
|
if (i >= envsize - 1) {
|
|
|
|
if (envsize >= 1000)
|
|
|
|
fatal("child_set_env: too many env vars");
|
|
|
|
envsize += 50;
|
|
|
|
env = (*envp) = xreallocarray(env, envsize, sizeof(char *));
|
|
|
|
*envsizep = envsize;
|
|
|
|
}
|
|
|
|
/* Need to set the NULL pointer at end of array beyond the new slot. */
|
|
|
|
env[i + 1] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate space and format the variable in the appropriate slot. */
|
2018-03-03 04:15:51 +01:00
|
|
|
/* XXX xasprintf */
|
2017-08-18 07:36:45 +02:00
|
|
|
env[i] = xmalloc(strlen(name) + 1 + strlen(value) + 1);
|
|
|
|
snprintf(env[i], strlen(name) + 1 + strlen(value) + 1, "%s=%s", name, value);
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:06:24 +02:00
|
|
|
/*
|
|
|
|
* Check and optionally lowercase a domain name, also removes trailing '.'
|
|
|
|
* Returns 1 on success and 0 on failure, storing an error message in errstr.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
valid_domain(char *name, int makelower, const char **errstr)
|
|
|
|
{
|
|
|
|
size_t i, l = strlen(name);
|
|
|
|
u_char c, last = '\0';
|
|
|
|
static char errbuf[256];
|
|
|
|
|
|
|
|
if (l == 0) {
|
|
|
|
strlcpy(errbuf, "empty domain name", sizeof(errbuf));
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
if (!isalpha((u_char)name[0]) && !isdigit((u_char)name[0])) {
|
|
|
|
snprintf(errbuf, sizeof(errbuf), "domain name \"%.100s\" "
|
|
|
|
"starts with invalid character", name);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
for (i = 0; i < l; i++) {
|
|
|
|
c = tolower((u_char)name[i]);
|
|
|
|
if (makelower)
|
|
|
|
name[i] = (char)c;
|
|
|
|
if (last == '.' && c == '.') {
|
|
|
|
snprintf(errbuf, sizeof(errbuf), "domain name "
|
|
|
|
"\"%.100s\" contains consecutive separators", name);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
if (c != '.' && c != '-' && !isalnum(c) &&
|
|
|
|
c != '_') /* technically invalid, but common */ {
|
|
|
|
snprintf(errbuf, sizeof(errbuf), "domain name "
|
|
|
|
"\"%.100s\" contains invalid characters", name);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
last = c;
|
|
|
|
}
|
|
|
|
if (name[l - 1] == '.')
|
|
|
|
name[l - 1] = '\0';
|
|
|
|
if (errstr != NULL)
|
|
|
|
*errstr = NULL;
|
|
|
|
return 1;
|
|
|
|
bad:
|
|
|
|
if (errstr != NULL)
|
|
|
|
*errstr = errbuf;
|
|
|
|
return 0;
|
|
|
|
}
|
2017-12-06 00:59:47 +01:00
|
|
|
|
2018-10-03 08:38:35 +02:00
|
|
|
/*
|
|
|
|
* Verify that a environment variable name (not including initial '$') is
|
|
|
|
* valid; consisting of one or more alphanumeric or underscore characters only.
|
|
|
|
* Returns 1 on valid, 0 otherwise.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
valid_env_name(const char *name)
|
|
|
|
{
|
|
|
|
const char *cp;
|
|
|
|
|
|
|
|
if (name[0] == '\0')
|
|
|
|
return 0;
|
|
|
|
for (cp = name; *cp != '\0'; cp++) {
|
|
|
|
if (!isalnum((u_char)*cp) && *cp != '_')
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-12-06 00:59:47 +01:00
|
|
|
const char *
|
|
|
|
atoi_err(const char *nptr, int *val)
|
|
|
|
{
|
|
|
|
const char *errstr = NULL;
|
|
|
|
long long num;
|
|
|
|
|
|
|
|
if (nptr == NULL || *nptr == '\0')
|
|
|
|
return "missing";
|
|
|
|
num = strtonum(nptr, 0, INT_MAX, &errstr);
|
|
|
|
if (errstr == NULL)
|
|
|
|
*val = (int)num;
|
|
|
|
return errstr;
|
|
|
|
}
|
2018-03-12 01:52:01 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
parse_absolute_time(const char *s, uint64_t *tp)
|
|
|
|
{
|
|
|
|
struct tm tm;
|
|
|
|
time_t tt;
|
|
|
|
char buf[32], *fmt;
|
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
|
|
|
const char *cp;
|
|
|
|
size_t l;
|
|
|
|
int is_utc = 0;
|
2018-03-12 01:52:01 +01:00
|
|
|
|
|
|
|
*tp = 0;
|
|
|
|
|
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
|
|
|
l = strlen(s);
|
|
|
|
if (l > 1 && strcasecmp(s + l - 1, "Z") == 0) {
|
|
|
|
is_utc = 1;
|
|
|
|
l--;
|
|
|
|
} else if (l > 3 && strcasecmp(s + l - 3, "UTC") == 0) {
|
|
|
|
is_utc = 1;
|
|
|
|
l -= 3;
|
|
|
|
}
|
2018-03-12 01:52:01 +01:00
|
|
|
/*
|
|
|
|
* POSIX strptime says "The application shall ensure that there
|
|
|
|
* is white-space or other non-alphanumeric characters between
|
|
|
|
* any two conversion specifications" so arrange things this way.
|
|
|
|
*/
|
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
|
|
|
switch (l) {
|
2018-03-12 01:52:01 +01:00
|
|
|
case 8: /* YYYYMMDD */
|
|
|
|
fmt = "%Y-%m-%d";
|
|
|
|
snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2s", s, s + 4, s + 6);
|
|
|
|
break;
|
|
|
|
case 12: /* YYYYMMDDHHMM */
|
|
|
|
fmt = "%Y-%m-%dT%H:%M";
|
|
|
|
snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2sT%.2s:%.2s",
|
|
|
|
s, s + 4, s + 6, s + 8, s + 10);
|
|
|
|
break;
|
|
|
|
case 14: /* YYYYMMDDHHMMSS */
|
|
|
|
fmt = "%Y-%m-%dT%H:%M:%S";
|
|
|
|
snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2sT%.2s:%.2s:%.2s",
|
|
|
|
s, s + 4, s + 6, s + 8, s + 10, s + 12);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return SSH_ERR_INVALID_FORMAT;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&tm, 0, sizeof(tm));
|
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 ((cp = strptime(buf, fmt, &tm)) == NULL || *cp != '\0')
|
2018-03-12 01:52:01 +01:00
|
|
|
return SSH_ERR_INVALID_FORMAT;
|
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 (is_utc) {
|
|
|
|
if ((tt = timegm(&tm)) < 0)
|
|
|
|
return SSH_ERR_INVALID_FORMAT;
|
|
|
|
} else {
|
|
|
|
if ((tt = mktime(&tm)) < 0)
|
|
|
|
return SSH_ERR_INVALID_FORMAT;
|
|
|
|
}
|
2018-03-12 01:52:01 +01:00
|
|
|
/* success */
|
|
|
|
*tp = (uint64_t)tt;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-07-02 09:20:44 +02:00
|
|
|
/* On OpenBSD time_t is int64_t which is long long. */
|
2021-07-12 10:00:05 +02:00
|
|
|
/* #define SSH_TIME_T_MAX LLONG_MAX */
|
2021-07-02 09:20:44 +02:00
|
|
|
|
2018-03-12 01:52:01 +01:00
|
|
|
void
|
|
|
|
format_absolute_time(uint64_t t, char *buf, size_t len)
|
|
|
|
{
|
2021-07-02 09:20:44 +02:00
|
|
|
time_t tt = t > SSH_TIME_T_MAX ? SSH_TIME_T_MAX : t;
|
2018-03-12 01:52:01 +01:00
|
|
|
struct tm tm;
|
|
|
|
|
|
|
|
localtime_r(&tt, &tm);
|
|
|
|
strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm);
|
|
|
|
}
|
2018-11-16 04:26:01 +01:00
|
|
|
|
|
|
|
/* check if path is absolute */
|
|
|
|
int
|
|
|
|
path_absolute(const char *path)
|
|
|
|
{
|
2019-05-22 23:18:23 +02:00
|
|
|
#ifdef WINDOWS
|
|
|
|
return is_absolute_path(path);
|
|
|
|
#else
|
2018-11-16 04:26:01 +01:00
|
|
|
return (*path == '/') ? 1 : 0;
|
2019-05-22 23:18:23 +02:00
|
|
|
#endif
|
2018-11-16 04:26:01 +01:00
|
|
|
}
|
2019-09-03 10:29:58 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
skip_space(char **cpp)
|
|
|
|
{
|
|
|
|
char *cp;
|
|
|
|
|
|
|
|
for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++)
|
|
|
|
;
|
|
|
|
*cpp = cp;
|
|
|
|
}
|
2019-09-03 10:32:11 +02:00
|
|
|
|
|
|
|
/* authorized_key-style options parsing helpers */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Match flag 'opt' in *optsp, and if allow_negate is set then also match
|
|
|
|
* 'no-opt'. Returns -1 if option not matched, 1 if option matches or 0
|
|
|
|
* if negated option matches.
|
|
|
|
* If the option or negated option matches, then *optsp is updated to
|
|
|
|
* point to the first character after the option.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
opt_flag(const char *opt, int allow_negate, const char **optsp)
|
|
|
|
{
|
|
|
|
size_t opt_len = strlen(opt);
|
|
|
|
const char *opts = *optsp;
|
|
|
|
int negate = 0;
|
|
|
|
|
|
|
|
if (allow_negate && strncasecmp(opts, "no-", 3) == 0) {
|
|
|
|
opts += 3;
|
|
|
|
negate = 1;
|
|
|
|
}
|
|
|
|
if (strncasecmp(opts, opt, opt_len) == 0) {
|
|
|
|
*optsp = opts + opt_len;
|
|
|
|
return negate ? 0 : 1;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
opt_dequote(const char **sp, const char **errstrp)
|
|
|
|
{
|
|
|
|
const char *s = *sp;
|
|
|
|
char *ret;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
*errstrp = NULL;
|
|
|
|
if (*s != '"') {
|
|
|
|
*errstrp = "missing start quote";
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
s++;
|
|
|
|
if ((ret = malloc(strlen((s)) + 1)) == NULL) {
|
|
|
|
*errstrp = "memory allocation failed";
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (i = 0; *s != '\0' && *s != '"';) {
|
|
|
|
if (s[0] == '\\' && s[1] == '"')
|
|
|
|
s++;
|
|
|
|
ret[i++] = *s++;
|
|
|
|
}
|
|
|
|
if (*s == '\0') {
|
|
|
|
*errstrp = "missing end quote";
|
|
|
|
free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
ret[i] = '\0';
|
|
|
|
s++;
|
|
|
|
*sp = s;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
opt_match(const char **opts, const char *term)
|
|
|
|
{
|
|
|
|
if (strncasecmp((*opts), term, strlen(term)) == 0 &&
|
|
|
|
(*opts)[strlen(term)] == '=') {
|
|
|
|
*opts += strlen(term) + 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-02-15 21:36:35 +01:00
|
|
|
void
|
|
|
|
opt_array_append2(const char *file, const int line, const char *directive,
|
|
|
|
char ***array, int **iarray, u_int *lp, const char *s, int i)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (*lp >= INT_MAX)
|
|
|
|
fatal("%s line %d: Too many %s entries", file, line, directive);
|
|
|
|
|
|
|
|
if (iarray != NULL) {
|
|
|
|
*iarray = xrecallocarray(*iarray, *lp, *lp + 1,
|
|
|
|
sizeof(**iarray));
|
|
|
|
(*iarray)[*lp] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
*array = xrecallocarray(*array, *lp, *lp + 1, sizeof(**array));
|
|
|
|
(*array)[*lp] = xstrdup(s);
|
|
|
|
(*lp)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
opt_array_append(const char *file, const int line, const char *directive,
|
|
|
|
char ***array, u_int *lp, const char *s)
|
|
|
|
{
|
|
|
|
opt_array_append2(file, line, directive, array, NULL, lp, s, 0);
|
|
|
|
}
|
|
|
|
|
2020-01-23 08:10:22 +01:00
|
|
|
sshsig_t
|
|
|
|
ssh_signal(int signum, sshsig_t handler)
|
|
|
|
{
|
2021-04-29 21:41:08 +02:00
|
|
|
#ifdef WINDOWS
|
|
|
|
return signal(signum, handler);
|
|
|
|
#else
|
2020-01-23 08:10:22 +01:00
|
|
|
struct sigaction sa, osa;
|
|
|
|
|
|
|
|
/* mask all other signals while in handler */
|
2020-04-25 08:59:36 +02:00
|
|
|
memset(&sa, 0, sizeof(sa));
|
2020-01-23 08:10:22 +01:00
|
|
|
sa.sa_handler = handler;
|
|
|
|
sigfillset(&sa.sa_mask);
|
2020-05-01 07:09:26 +02:00
|
|
|
#if defined(SA_RESTART) && !defined(NO_SA_RESTART)
|
2020-01-23 08:10:22 +01:00
|
|
|
if (signum != SIGALRM)
|
|
|
|
sa.sa_flags = SA_RESTART;
|
2020-05-01 07:09:26 +02:00
|
|
|
#endif
|
2020-01-23 08:10:22 +01:00
|
|
|
if (sigaction(signum, &sa, &osa) == -1) {
|
|
|
|
debug3("sigaction(%s): %s", strsignal(signum), strerror(errno));
|
|
|
|
return SIG_ERR;
|
|
|
|
}
|
|
|
|
return osa.sa_handler;
|
2021-04-29 21:41:08 +02:00
|
|
|
#endif // WINDOWS
|
2020-01-23 08:10:22 +01:00
|
|
|
}
|
2020-10-03 11:22:26 +02:00
|
|
|
|
|
|
|
int
|
|
|
|
stdfd_devnull(int do_stdin, int do_stdout, int do_stderr)
|
|
|
|
{
|
|
|
|
int devnull, ret = 0;
|
|
|
|
|
|
|
|
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("open %s: %s", _PATH_DEVNULL,
|
2020-10-03 11:22:26 +02:00
|
|
|
strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if ((do_stdin && dup2(devnull, STDIN_FILENO) == -1) ||
|
|
|
|
(do_stdout && dup2(devnull, STDOUT_FILENO) == -1) ||
|
|
|
|
(do_stderr && dup2(devnull, STDERR_FILENO) == -1)) {
|
2020-10-18 13:32:01 +02:00
|
|
|
error_f("dup2: %s", strerror(errno));
|
2020-10-03 11:22:26 +02:00
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
if (devnull > STDERR_FILENO)
|
|
|
|
close(devnull);
|
|
|
|
return ret;
|
|
|
|
}
|
2020-12-22 01:12:22 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Runs command in a subprocess with a minimal environment.
|
|
|
|
* Returns pid on success, 0 on failure.
|
|
|
|
* The child stdout and stderr maybe captured, left attached or sent to
|
|
|
|
* /dev/null depending on the contents of flags.
|
|
|
|
* "tag" is prepended to log messages.
|
|
|
|
* NB. "command" is only used for logging; the actual command executed is
|
|
|
|
* av[0].
|
|
|
|
*/
|
|
|
|
pid_t
|
|
|
|
subprocess(const char *tag, const char *command,
|
|
|
|
int ac, char **av, FILE **child, u_int flags,
|
|
|
|
struct passwd *pw, privdrop_fn *drop_privs, privrestore_fn *restore_privs)
|
|
|
|
{
|
|
|
|
FILE *f = NULL;
|
|
|
|
struct stat st;
|
|
|
|
int fd, devnull, p[2], i;
|
|
|
|
pid_t pid;
|
|
|
|
char *cp, errmsg[512];
|
|
|
|
u_int nenv = 0;
|
|
|
|
char **env = NULL;
|
|
|
|
|
|
|
|
/* If dropping privs, then must specify user and restore function */
|
|
|
|
if (drop_privs != NULL && (pw == NULL || restore_privs == NULL)) {
|
|
|
|
error("%s: inconsistent arguments", tag); /* XXX fatal? */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (pw == NULL && (pw = getpwuid(getuid())) == NULL) {
|
|
|
|
error("%s: no user for current uid", tag);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (child != NULL)
|
|
|
|
*child = NULL;
|
|
|
|
|
|
|
|
debug3_f("%s command \"%s\" running as %s (flags 0x%x)",
|
|
|
|
tag, command, pw->pw_name, flags);
|
|
|
|
|
|
|
|
/* Check consistency */
|
|
|
|
if ((flags & SSH_SUBPROCESS_STDOUT_DISCARD) != 0 &&
|
|
|
|
(flags & SSH_SUBPROCESS_STDOUT_CAPTURE) != 0) {
|
|
|
|
error_f("inconsistent flags");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (((flags & SSH_SUBPROCESS_STDOUT_CAPTURE) == 0) != (child == NULL)) {
|
|
|
|
error_f("inconsistent flags/output");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If executing an explicit binary, then verify the it exists
|
|
|
|
* and appears safe-ish to execute
|
|
|
|
*/
|
|
|
|
if (!path_absolute(av[0])) {
|
|
|
|
error("%s path is not absolute", tag);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (drop_privs != NULL)
|
|
|
|
drop_privs(pw);
|
|
|
|
if (stat(av[0], &st) == -1) {
|
|
|
|
error("Could not stat %s \"%s\": %s", tag,
|
|
|
|
av[0], strerror(errno));
|
|
|
|
goto restore_return;
|
|
|
|
}
|
2021-04-02 19:14:32 +02:00
|
|
|
|
2020-12-22 01:12:22 +01:00
|
|
|
if ((flags & SSH_SUBPROCESS_UNSAFE_PATH) == 0 &&
|
2021-04-02 19:14:32 +02:00
|
|
|
#ifdef WINDOWS
|
|
|
|
(check_secure_file_permission(av[0], pw, 1) != 0)) {
|
|
|
|
error("Permissions on %s:\"%s\" are too open", tag, av[0]);
|
|
|
|
#else
|
2020-12-22 01:12:22 +01:00
|
|
|
safe_path(av[0], &st, NULL, 0, errmsg, sizeof(errmsg)) != 0) {
|
|
|
|
error("Unsafe %s \"%s\": %s", tag, av[0], errmsg);
|
2021-04-02 19:14:32 +02:00
|
|
|
#endif
|
2020-12-22 01:12:22 +01:00
|
|
|
goto restore_return;
|
|
|
|
}
|
2021-04-02 19:14:32 +02:00
|
|
|
|
2020-12-22 01:12:22 +01:00
|
|
|
/* Prepare to keep the child's stdout if requested */
|
|
|
|
if (pipe(p) == -1) {
|
|
|
|
error("%s: pipe: %s", tag, strerror(errno));
|
|
|
|
restore_return:
|
|
|
|
if (restore_privs != NULL)
|
|
|
|
restore_privs();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (restore_privs != NULL)
|
|
|
|
restore_privs();
|
|
|
|
|
2021-04-02 19:14:32 +02:00
|
|
|
#ifdef FORK_NOT_SUPPORTED
|
|
|
|
{
|
|
|
|
posix_spawn_file_actions_t actions;
|
|
|
|
pid = -1;
|
|
|
|
|
|
|
|
if (posix_spawn_file_actions_init(&actions) != 0 ||
|
|
|
|
posix_spawn_file_actions_adddup2(&actions, p[1], STDOUT_FILENO) != 0)
|
|
|
|
fatal("posix_spawn initialization failed");
|
|
|
|
else {
|
|
|
|
#ifdef WINDOWS
|
2021-04-29 21:41:08 +02:00
|
|
|
extern PSID get_sid(const char*);
|
2021-04-02 19:14:32 +02:00
|
|
|
/* If the user's SID is the System SID and sshd is running as system,
|
|
|
|
* launch as a child process.
|
|
|
|
*/
|
|
|
|
if (IsWellKnownSid(get_sid(pw->pw_name), WinLocalSystemSid) && am_system()) {
|
|
|
|
debug("starting subprocess using posix_spawnp");
|
|
|
|
if (posix_spawnp((pid_t*)&pid, av[0], &actions, NULL, av, NULL) != 0)
|
|
|
|
fatal("posix_spawnp: %s", strerror(errno));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
debug("starting subprocess as user using __posix_spawn_asuser");
|
|
|
|
if (__posix_spawn_asuser((pid_t*)&pid, av[0], &actions, NULL, av, NULL, pw->pw_name) != 0)
|
|
|
|
fatal("posix_spawn_user: %s", strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
posix_spawn_file_actions_destroy(&actions);
|
|
|
|
}
|
|
|
|
#else
|
2020-12-22 01:12:22 +01:00
|
|
|
switch ((pid = fork())) {
|
|
|
|
case -1: /* error */
|
|
|
|
error("%s: fork: %s", tag, strerror(errno));
|
|
|
|
close(p[0]);
|
|
|
|
close(p[1]);
|
|
|
|
return 0;
|
|
|
|
case 0: /* child */
|
|
|
|
/* Prepare a minimal environment for the child. */
|
|
|
|
if ((flags & SSH_SUBPROCESS_PRESERVE_ENV) == 0) {
|
|
|
|
nenv = 5;
|
|
|
|
env = xcalloc(sizeof(*env), nenv);
|
|
|
|
child_set_env(&env, &nenv, "PATH", _PATH_STDPATH);
|
|
|
|
child_set_env(&env, &nenv, "USER", pw->pw_name);
|
|
|
|
child_set_env(&env, &nenv, "LOGNAME", pw->pw_name);
|
|
|
|
child_set_env(&env, &nenv, "HOME", pw->pw_dir);
|
|
|
|
if ((cp = getenv("LANG")) != NULL)
|
|
|
|
child_set_env(&env, &nenv, "LANG", cp);
|
|
|
|
}
|
|
|
|
|
2021-02-28 02:50:47 +01:00
|
|
|
for (i = 1; i < NSIG; i++)
|
2020-12-22 01:12:22 +01:00
|
|
|
ssh_signal(i, SIG_DFL);
|
|
|
|
|
|
|
|
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) {
|
|
|
|
error("%s: open %s: %s", tag, _PATH_DEVNULL,
|
|
|
|
strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
if (dup2(devnull, STDIN_FILENO) == -1) {
|
|
|
|
error("%s: dup2: %s", tag, strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set up stdout as requested; leave stderr in place for now. */
|
|
|
|
fd = -1;
|
|
|
|
if ((flags & SSH_SUBPROCESS_STDOUT_CAPTURE) != 0)
|
|
|
|
fd = p[1];
|
|
|
|
else if ((flags & SSH_SUBPROCESS_STDOUT_DISCARD) != 0)
|
|
|
|
fd = devnull;
|
|
|
|
if (fd != -1 && dup2(fd, STDOUT_FILENO) == -1) {
|
|
|
|
error("%s: dup2: %s", tag, strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
closefrom(STDERR_FILENO + 1);
|
|
|
|
|
2021-09-26 16:01:03 +02:00
|
|
|
if (geteuid() == 0 &&
|
|
|
|
initgroups(pw->pw_name, pw->pw_gid) == -1) {
|
|
|
|
error("%s: initgroups(%s, %u): %s", tag,
|
|
|
|
pw->pw_name, (u_int)pw->pw_gid, strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
2020-12-22 01:12:22 +01:00
|
|
|
if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) {
|
|
|
|
error("%s: setresgid %u: %s", tag, (u_int)pw->pw_gid,
|
|
|
|
strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) == -1) {
|
|
|
|
error("%s: setresuid %u: %s", tag, (u_int)pw->pw_uid,
|
|
|
|
strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
/* stdin is pointed to /dev/null at this point */
|
|
|
|
if ((flags & SSH_SUBPROCESS_STDOUT_DISCARD) != 0 &&
|
|
|
|
dup2(STDIN_FILENO, STDERR_FILENO) == -1) {
|
|
|
|
error("%s: dup2: %s", tag, strerror(errno));
|
|
|
|
_exit(1);
|
|
|
|
}
|
|
|
|
if (env != NULL)
|
|
|
|
execve(av[0], av, env);
|
|
|
|
else
|
|
|
|
execv(av[0], av);
|
|
|
|
error("%s %s \"%s\": %s", tag, env == NULL ? "execv" : "execve",
|
|
|
|
command, strerror(errno));
|
|
|
|
_exit(127);
|
|
|
|
default: /* parent */
|
|
|
|
break;
|
|
|
|
}
|
2021-04-02 19:14:32 +02:00
|
|
|
#endif
|
2020-12-22 01:12:22 +01:00
|
|
|
close(p[1]);
|
|
|
|
if ((flags & SSH_SUBPROCESS_STDOUT_CAPTURE) == 0)
|
|
|
|
close(p[0]);
|
|
|
|
else if ((f = fdopen(p[0], "r")) == NULL) {
|
|
|
|
error("%s: fdopen: %s", tag, strerror(errno));
|
|
|
|
close(p[0]);
|
|
|
|
/* Don't leave zombie child */
|
|
|
|
kill(pid, SIGTERM);
|
|
|
|
while (waitpid(pid, NULL, 0) == -1 && errno == EINTR)
|
|
|
|
;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* Success */
|
|
|
|
debug3_f("%s pid %ld", tag, (long)pid);
|
|
|
|
if (child != NULL)
|
|
|
|
*child = f;
|
|
|
|
return pid;
|
|
|
|
}
|
2021-06-04 07:02:40 +02:00
|
|
|
|
|
|
|
const char *
|
|
|
|
lookup_env_in_list(const char *env, char * const *envs, size_t nenvs)
|
|
|
|
{
|
|
|
|
size_t i, envlen;
|
|
|
|
|
|
|
|
envlen = strlen(env);
|
|
|
|
for (i = 0; i < nenvs; i++) {
|
|
|
|
if (strncmp(envs[i], env, envlen) == 0 &&
|
|
|
|
envs[i][envlen] == '=') {
|
|
|
|
return envs[i] + envlen + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 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
|
|
|
|
|
|
|
const char *
|
|
|
|
lookup_setenv_in_list(const char *env, char * const *envs, size_t nenvs)
|
|
|
|
{
|
|
|
|
char *name, *cp;
|
|
|
|
const char *ret;
|
|
|
|
|
|
|
|
name = xstrdup(env);
|
|
|
|
if ((cp = strchr(name, '=')) == NULL) {
|
|
|
|
free(name);
|
|
|
|
return NULL; /* not env=val */
|
|
|
|
}
|
|
|
|
*cp = '\0';
|
|
|
|
ret = lookup_env_in_list(name, envs, nenvs);
|
|
|
|
free(name);
|
|
|
|
return ret;
|
|
|
|
}
|