Commit Graph

12432 Commits

Author SHA1 Message Date
djm@openbsd.org 05c08e5f62
upstream: return SSH_ERR_KRL_BAD_MAGIC when a KRL doesn't contain a
valid magic number and not SSH_ERR_MESSAGE_INCOMPLETE; the former is needed
to fall back to text revocation lists in some cases; fixes t-cert-hostkey.

OpenBSD-Commit-ID: 5c670a6c0f027e99b7774ef29f18ba088549c7e1
2023-07-17 15:22:36 +10:00
Damien Miller c6fad2c3d1
avoid AF_LINK on platforms that don't define it 2023-07-17 14:56:14 +10:00
djm@openbsd.org 919bc3d3b7
upstream: Add support for configuration tags to ssh(1).
This adds a ssh_config(5) "Tag" directive and corresponding
"Match tag" predicate that may be used to select blocks of
configuration similar to the pf.conf(5) keywords of the same
name.

ok markus

OpenBSD-Commit-ID: dc08358e70e702b59ac3e591827e5a96141b06a3
2023-07-17 14:53:53 +10:00
djm@openbsd.org 3071d85a47
upstream: add a "match localnetwork" predicate.
This allows matching on the addresses of available network interfaces
and may be used to vary the effective client configuration based on
network location (e.g. to use a ProxyJump when not on a particular
network).

ok markus@

OpenBSD-Commit-ID: cffb6ff9a3803abfc52b5cad0aa190c5e424c139
2023-07-17 14:53:53 +10:00
djm@openbsd.org beec17bb31
upstream: remove vestigal support for KRL signatures
When the KRL format was originally defined, it included support for
signing of KRL objects. However, the code to sign KRLs and verify KRL
signatues was never completed in OpenSSH.

Now, some years later, we have SSHSIG support in ssh-keygen that is
more general, well tested and actually works. So this removes the
semi-finished KRL signing/verification support from OpenSSH and
refactors the remaining code to realise the benefit - primarily, we
no longer need to perform multiple parsing passes over KRL objects.

ok markus@

OpenBSD-Commit-ID: 517437bab3d8180f695c775410c052340e038804
2023-07-17 14:52:35 +10:00
djm@openbsd.org 449566f64c
upstream: Support for KRL extensions.
This defines wire formats for optional KRL extensions and implements
parsing of the new submessages. No actual extensions are supported at
this point.

ok markus

OpenBSD-Commit-ID: ae2fcde9a22a9ba7f765bd4f36b3f5901d8c3fa7
2023-07-17 14:52:20 +10:00
dtucker@openbsd.org 18ea857770
upstream: Include stdint.h for SIZE_MAX. Fixes OPENSSL=no build.
OpenBSD-Commit-ID: e7c31034a5434f2ead3579b13a7892960651e6b0
2023-07-17 14:52:03 +10:00
Darren Tucker 20b768fcd1
Fix typo in declaration of nmesg. 2023-07-14 17:07:32 +10:00
Damien Miller 4b94d09542
portable-specific int overflow defence-in-depth
These too are unreachable, but we want the code to be safe regardless of
context. Reported by Yair Mizrahi @ JFrog
2023-07-14 15:34:47 +10:00
djm@openbsd.org 2ee48adb9f
upstream: add defence-in-depth checks for some unreachable integer
overflows reported by Yair Mizrahi @ JFrog; feedback/ok millert@

OpenBSD-Commit-ID: 52af085f4e7ef9f9d8423d8c1840a6a88bda90bd
2023-07-14 15:33:30 +10:00
djm@openbsd.org 4b43bc358a
upstream: misplaced debug message
OpenBSD-Commit-ID: d0f12af0a5067a756aa707bc39a83fa6f58bf7e5
2023-07-14 15:33:29 +10:00
Damien Miller 8c7203bcee
replace deprecate selinux matchpathcon function
This function is apparently deprecated. Documentation on what is the
supposed replacement is is non-existent, so this follows the approach
glibc used https://sourceware.org/git/?p=glibc.git;a=patch;h=f278835f59

ok dtucker@
2023-07-12 11:41:19 +10:00
dtucker@openbsd.org 7e8800f5d7
upstream: minleft and maxsign are u_int so cast appropriately. Prompted
by github PR#410, ok deraadt.

OpenBSD-Commit-ID: 0514cd51db3ec60239966622a0d3495b15406ddd
2023-07-07 08:30:58 +10:00
dlg@openbsd.org 94842bfe9b
upstream: add support for unix domain sockets to ssh -W
ok djm@ dtucker@

OpenBSD-Commit-ID: 3e6d47567b895c7c28855c7bd614e106c987a6d8
2023-07-07 08:20:25 +10:00
David Seifert a95fc5eed0
gss-serv.c: `MAXHOSTNAMELEN` -> `HOST_NAME_MAX`
`MAXHOSTNAMELEN` is not defined in POSIX, which breaks on musl:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html

Bug: https://bugs.gentoo.org/834044
2023-07-05 17:54:15 +10:00
Darren Tucker 8a6cd08850
Update runner OS version for hardenedmalloc test.
Hardenedmalloc dropped support for "legacy glibc" versions in their
64dad0a69 so use a newer Ubuntu version for the runner for that test.
2023-06-23 09:49:02 +10:00
Damien Miller cfca6f17e6
handle sysconf(SC_OPEN_MAX) returning > INT_MAX;
bz3581; ok dtucker
2023-06-22 15:04:03 +10:00
djm@openbsd.org c1c2ca1365
upstream: better validate CASignatureAlgorithms in ssh_config and
sshd_config.

Previously this directive would accept certificate algorithm names, but
these were unusable in practice as OpenSSH does not support CA chains.

part of bz3577; ok dtucker@

OpenBSD-Commit-ID: a992d410c8a78ec982701bc3f91043dbdb359912
2023-06-21 15:13:56 +10:00
djm@openbsd.org 4e73cd0f4a
upstream: make `ssh -Q CASignatureAlgorithms` only list signature
algorithms that are valid for CA signing. Previous behaviour was to list all
signing algorithms, including certificate algorithms (OpenSSH certificates do
not support CA chains). part of bz3577; ok dtucker@

OpenBSD-Commit-ID: 99c2b072dbac0f44fd1f2269e3ff6c1b5d7d3e59
2023-06-21 15:13:55 +10:00
djm@openbsd.org a69062f169
upstream: handle rlimits > INT_MAX (rlim_t is u64); ok dtucker
bz3581

OpenBSD-Commit-ID: 31cf59c041becc0e5ccb0a77106f812c4cd1cd74
2023-06-21 15:13:54 +10:00
djm@openbsd.org 8d33f2aa6b
upstream: prepare for support for connecting to unix domain sockets
using ssh -W by explicitly decoding PORT_STREAMLOCAL (a negative number) from
the u32 that's passed over the multiplexing socket; previously code would
just cast, which is UB.

OpenBSD-Commit-ID: e5ac5f40d354096c51e8c118a5c1b2d2b7a31384
2023-06-21 15:13:30 +10:00
djm@openbsd.org b4ac435b4e
upstream: reset comment=NULL for each key in do_fingerprint();
fixes "no comment" not showing on when running `ssh-keygen -l` on multiple
keys where one has a comment and other following keys do not. Patch from
Markus Kuhn via GHPR407, bz3580

OpenBSD-Commit-ID: 3cce84456fdcd67dc6b84e369f92c6686d111d9b
2023-06-20 10:07:06 +10:00
millert@openbsd.org b53a809a54
upstream: Store timeouts as int, not u_int as they are limited to
INT_MAX. Fixes sign compare warnings systems with 32-bit time_t due to type
promotion.  OK djm@

OpenBSD-Commit-ID: 48081e9ad35705c5f1705711704a4c2ff94e87b7
2023-06-20 10:07:06 +10:00
Philip Hands 2709809fd6
fixup! if -s & -p specified, mention 'sftp -P' on
success

SSH-Copy-ID-Upstream: 32686e7c65b4fa2846e474d3315102dfa0f043b0
2023-05-25 18:24:58 +10:00
Darren Tucker 204e0bf051
Make ssh-copy-id(1) consistent with OpenSSH.
This makes the ssh-copy-id man page more consistent with the rest of the
OpenSSH man pages:
- new sentence, new line
- no sentences >80
- N.B. -> NB
- zap unused .Pp
- zap trailing whitespace

Report from Debian via mindrot bz#3331, diff from jmc at openbsd.org.

SSH-Copy-ID-Upstream: d8974cfb6242316460ed22a1ccc662800a50c5d3
2023-05-25 18:24:55 +10:00
Philip Hands 9de79df66d
if -s & -p specified, mention 'sftp -P' on success
This was inspired by this:
 https://github.com/openssh/openssh-portable/pull/321
but I thought that it was better to not do the sed patching.

BTW the reason one can get away with using $SSH_OPTS throughout, despite
the lowercase -p in there, even if sftp is in use, is that the sftp call
is using the already-established ssh master connection, so the port was
passed to the earlier ssh.

SSH-Copy-ID-Upstream: 1c124d9bfafdbe28a00b683367ebf5750ce12eb2
2023-05-25 18:24:53 +10:00
Philip Hands 801cda54c0
drop whitespace
SSH-Copy-ID-Upstream: e604fae1cdee35c18055d35dcec530cf12ef00ad
2023-05-25 18:24:50 +10:00
Philip Hands 288482f536
make -x also apply to the target script
SSH-Copy-ID-Upstream: 3c4214704f427bd0654adf9b0fc079253db21cf4
2023-05-25 18:24:47 +10:00
Philip Hands b79e7b88ed
add -t option to specify the target path
Allow the default target path (.ssh/authorized_files) to be over-riden

This was inspired by this MR from Panagiotis Cheilaris <philaris@cs.ntua.gr>

 https://gitlab.com/phil_hands/ssh-copy-id/-/merge_requests/8

SSH-Copy-ID-Upstream: a942a0e076874adb6d8b2f0fb76d6c7918190fcd
2023-05-25 18:24:45 +10:00
Carlos Rodríguez Gili 914f4ad138
Fix test error for /bin/sh on Solaris 10 and older
On Solaris 10 and older targets /bin/sh is not POSIX-compliant.
Test -z `...` fails with error 'sh: test: argument expected'.
Using quotes around backticks fixes this and doesn't break
POSIX compatibility.

SSH-Copy-ID-Upstream: 98394072a3f985b2650c1e8eab2fef84e38cc065
2023-05-25 18:24:42 +10:00
Jakub Jelen bd382dca31
Remove outdated comment
The commit b068122 removed the code dropping the trailing colon, but the comment stayed leaving the code confusing for future readers

SSH-Copy-ID-Upstream: 930d39f238117cd53810240ec989d0356aa1c1f6
2023-05-25 18:24:39 +10:00
Darren Tucker bdcaf79390
Special case OpenWrt instead of Dropbear.
OpenWrt overrides the location of authorized_keys for root.  Currently we
assume that all Dropbear installations behave this way, which is not the
case.  Check for OpenWrt and root user before using that location instead
of assuming that for all Dropbear servers.  Prompted by Github PR#250.

SSH-Copy-ID-Upstream: 0e1f5d443a9967483c33945793107ae3f3e4af2d
2023-05-25 18:24:37 +10:00
Philip Hands cf84498f67
ssh-copy-id: add -x option (for debugging)
This option causes the ssh-copy-id to run with set -x

SSH-Copy-ID-Upstream: a0ee367ea8c0a29c8b4515245e408d2d349e7844
2023-05-25 18:24:32 +10:00
Philip Hands b4a1efdcb8
update copyright notices
SSH-Copy-ID-Upstream: c284ed33b361814ea48ff68cbd01ca525b2bf117
2023-05-25 18:24:25 +10:00
djm@openbsd.org fcd78e31cd
upstream: fix AuthorizedPrincipalsCommand when AuthorizedKeysCommand
appears previously in configuration. Reported by John Meyers in bz3574 ok
dtucker@

OpenBSD-Commit-ID: 1c92e4517284386703936e1d3abaa36cfacf1951
2023-05-25 09:42:00 +10:00
dtucker@openbsd.org 5ec5504f1d
upstream: Remove unused prototypes for ssh1 RSA functions.
From lengyijun via github PR#396.

OpenBSD-Commit-ID: 379a5afa8b7a0f3cba0c8a9bcceb4e5e33a5c1ef
2023-05-10 20:40:48 +10:00
Darren Tucker fbf362b389
main(void) to prevent unused variable warning. 2023-05-09 19:26:56 +10:00
Darren Tucker baf854c8bb
Remove warning pragma since clang doesn't like it. 2023-05-09 19:25:45 +10:00
Darren Tucker 5fbb7a1349
Suppress warning for snprintf truncation test. 2023-05-09 17:13:33 +10:00
Darren Tucker 47742c513e
Update OpenSSL compat test for 3.x. 2023-05-09 17:12:50 +10:00
Darren Tucker 86ad25d455
Add macos13 PAM test target. 2023-05-08 20:23:08 +10:00
Darren Tucker 77cca2c4b1
Skip agent-peereid test on macos13.
sudo -S nobody doesn't work on the github runners (probably a
permission issue) so skip that test.
2023-05-08 20:14:46 +10:00
Darren Tucker b356b8e916
Include config.guess in debug output. 2023-05-08 20:14:28 +10:00
Darren Tucker b7afd8a4ec
Handle OpenSSL >=3 ABI compatibility.
Beyond OpenSSL 3.0, the ABI compatibility guarantees are wider (only
major must match instead of major and minor in earlier versions).
bz#3548, ok djm@
2023-05-08 20:12:59 +10:00
dtucker@openbsd.org 0e9e2663eb
upstream: Import regenerated moduli.
OpenBSD-Commit-ID: 3d5f811cfcaed8cc4a97e1db49ac61bdf118113c
2023-05-01 19:13:18 +10:00
Darren Tucker d9687f4968
Add macos-13 test target.
Also flatten OS list for clarity.
2023-05-01 18:04:35 +10:00
djm@openbsd.org aacfd67674
upstream: adjust ftruncate() logic to handle servers that reorder
requests.

sftp/scp will ftruncate the destination file after a transfer completes,
to deal with the case where a longer destination file already existed.
We tracked the highest contiguous block transferred to deal with this
case, but our naive tracking doesn't deal with servers that reorder
requests - a misfeature strictly permitted by the protocol but seldom
implemented.

Adjust the logic to ftruncate() at the highest absolute block received
when the transfer is successful. feedback deraadt@ ok markus@

prompted by https://github.com/openssh/openssh-portable/commit/9b733#commitcomment-110679778

OpenBSD-Commit-ID: 4af7fac75958ad8507b4fea58706f3ff0cfddb1b
2023-05-01 08:56:04 +10:00
djm@openbsd.org c8eb394175
upstream: Check for ProxyJump=none in CanonicalizeHostname logic.
Previously ssh would incorrectly refuse to canonicalise the hostname
if ProxyJump was explicitly set to "none" when CanonicalizeHostname=yes

bz3567; ok dtucker

OpenBSD-Commit-ID: 80a58e43c3a32f97361282f756ec8d3f37989efd
2023-04-26 14:38:21 +10:00
jsg@openbsd.org ac383f3a5c
upstream: remove duplicate signal.h include
OpenBSD-Commit-ID: 30c0a34d74d91ddd0e6992525da70d3293392f70
2023-04-17 09:21:14 +10:00
jsg@openbsd.org 740dafa20f
upstream: fix double words ok dtucker@
OpenBSD-Commit-ID: 44d3223902fbce5276422bdc8063ab72a4078489
2023-04-17 09:21:13 +10:00