Commit Graph

11109 Commits

Author SHA1 Message Date
djm@openbsd.org
660cea10b2 upstream: sprinkle some "# comment" at end of configuration lines
to test comment handling

OpenBSD-Regress-ID: cb82fbf40bda5c257a9f742c63b1798e5a8fdda7
2021-06-08 17:17:24 +10:00
djm@openbsd.org
acc9c32dcb upstream: more descriptive failure message
OpenBSD-Regress-ID: 5300f6faf1d9e99c0cd10827b51756c5510e3509
2021-06-08 17:17:24 +10:00
djm@openbsd.org
ce04dd4eae upstream: test AuthenticationMethods inside a Match block as well
as in the main config section

OpenBSD-Regress-ID: ebe0a686621b7cb8bb003ac520975279c28747f7
2021-06-08 17:17:24 +10:00
djm@openbsd.org
9018bd821f upstream: prepare for stricter sshd_config parsing that will refuse
a config that has {Allow,Deny}{Users,Groups} on a line with no subsequent
arguments. Such lines are permitted but are nonsensical noops ATM

OpenBSD-Regress-ID: ef65463fcbc0bd044e27f3fe400ea56eb4b8f650
2021-06-08 17:17:24 +10:00
djm@openbsd.org
a10f929d1c upstream: switch sshd_config parsing to argv_split()
similar to the previous commit, this switches sshd_config parsing to
the newer tokeniser. Config parsing will be a little stricter wrt
quote correctness and directives appearing without arguments.

feedback and ok markus@

tested in snaps for the last five or so days - thanks Theo and those who
caught bugs

OpenBSD-Commit-ID: 9c4305631d20c2d194661504ce11e1f68b20d93e
2021-06-08 17:17:15 +10:00
djm@openbsd.org
ea9e45c89a upstream: Switch ssh_config parsing to use argv_split()
This fixes a couple of problems with the previous tokeniser,
strdelim()

1. strdelim() is permissive wrt accepting '=' characters. This is
  intended to allow it to tokenise "Option=value" but because it
  cannot keep state, it will incorrectly split "Opt=val=val2".
2. strdelim() has rudimentry handling of quoted strings, but it
  is incomplete and inconsistent. E.g. it doesn't handle escaped
  quotes inside a quoted string.
3. It has no support for stopping on a (unquoted) comment. Because
  of this readconf.c r1.343 added chopping of lines at '#', but
  this caused a regression because these characters may legitimately
  appear inside quoted strings.

The new tokeniser is stricter is a number of cases, including #1 above
but previously it was also possible for some directives to appear
without arguments. AFAIK these were nonsensical in all cases, and the
new tokeniser refuses to accept them.

The new code handles quotes much better, permitting quoted space as
well as escaped closing quotes. Finally, comment handling should be
fixed - the tokeniser will terminate only on unquoted # characters.

feedback & ok markus@

tested in snaps for the last five or so days - thanks Theo and those who
caught bugs

OpenBSD-Commit-ID: dc72fd12af9d5398f4d9e159d671f9269c5b14d5
2021-06-08 17:12:52 +10:00
dtucker@openbsd.org
d786424986 upstream: Check if IPQoS or TunnelDevice are already set before
overriding. Prevents values in config files from overriding values supplied
on the command line.  bz#3319, ok markus.

OpenBSD-Commit-ID: f3b08b898c324debb9195e6865d8999406938f74
2021-06-08 17:12:52 +10:00
djm@openbsd.org
aae4b4d358 upstream: Allow argv_split() to optionally terminate tokenisation
when it encounters an unquoted comment.

Add some additional utility function for working with argument
vectors, since we'll be switching to using them to parse
ssh/sshd_config shortly.

ok markus@ as part of a larger diff; tested in snaps

OpenBSD-Commit-ID: fd9c108cef2f713f24e3bc5848861d221bb3a1ac
2021-06-08 17:12:51 +10:00
Darren Tucker
da9f9acaac Save logs on failure for upstream test 2021-06-07 19:19:23 +10:00
Darren Tucker
76883c6016 Add obsdsnap-i386 upstream test target. 2021-06-07 14:38:17 +10:00
djm@openbsd.org
d45b9c63f9 upstream: fix debug message when finding a private key to match a
certificate being attempted for user authentication. Previously it would
print the certificate's path, whereas it was supposed to be showing the
private key's path. Patch from Alex Sherwin via GHPR247

OpenBSD-Commit-ID: d5af3be66d0f22c371dc1fe6195e774a18b2327b
2021-06-07 13:39:41 +10:00
djm@openbsd.org
530739d42f upstream: Match host certificates against host public keys, not private
keys. Allows use of certificates with private keys held in a ssh-agent.
Reported by Miles Zhou in bz3524; ok dtucker@

OpenBSD-Commit-ID: 25f5bf70003126d19162862d9eb380bf34bac22a
2021-06-06 21:35:29 +10:00
djm@openbsd.org
4265215d73 upstream: Client-side workaround for a bug in OpenSSH 7.4: this release
allows RSA/SHA2 signatures for public key authentication but fails to
advertise this correctly via SSH2_MSG_EXT_INFO. This causes clients of these
server to incorrectly match PubkeyAcceptedAlgorithms and potentially refuse
to offer valid keys.

Reported by and based on patch from Gordon Messmer via bz3213, thanks
also for additional analysis by Jakub Jelen. ok dtucker

OpenBSD-Commit-ID: d6d0b7351d5d44c45f3daaa26efac65847a564f7
2021-06-06 13:41:36 +10:00
djm@openbsd.org
bda270d7fb upstream: degrade gracefully if a sftp-server offers the
limits@openssh.com extension but fails when the client tries to invoke it.
Reported by Hector Martin via bz3318

OpenBSD-Commit-ID: bd9d1839c41811616ede4da467e25746fcd9b967
2021-06-06 13:24:38 +10:00
djm@openbsd.org
d345d5811a upstream: the limits@openssh.com extension was incorrectly marked
as an operation that writes to the filesystem, which made it unavailable in
sftp-server read-only mode. Spotted by Hector Martin via bz3318

OpenBSD-Commit-ID: f054465230787e37516c4b57098fc7975e00f067
2021-06-06 13:24:38 +10:00
naddy@openbsd.org
2b71010d9b upstream: PROTOCOL.certkeys: update reference from IETF draft to
RFC

Also fix some typos.
ok djm@

OpenBSD-Commit-ID: 5e855b6c5a22b5b13f8ffa3897a868e40d349b44
2021-06-06 13:24:37 +10:00
Darren Tucker
aa99b2d9a3 Clear notify_pipe from readset if present.
Prevents leaking an implementation detail to the caller.
2021-06-04 23:41:29 +10:00
Darren Tucker
6de8dadf6b space->tabs. 2021-06-04 23:24:25 +10:00
Darren Tucker
c867706507 Add pselect implementation for platforms without.
This is basically the existing notify_pipe kludge from serverloop.c
moved behind a pselect interface.  It works by installing a signal
handler that writes to a pipe that the select is watching, then calls
the original handler.

The select call in serverloop will become pselect soon, at which point the
kludge will be removed from thereand will only exist in the compat layer.
Original code by markus, help from djm.
2021-06-04 18:39:48 +10:00
Vincent Brillault
7cd7f302d3 auth_log: dont log partial successes as failures
By design, 'partial' logins are successful logins, so initially with
authenticated set to 1, for which another authentication is required. As
a result, authenticated is always reset to 0 when partial is set to 1.
However, even if authenticated is 0, those are not failed login
attempts, similarly to attempts with authctxt->postponed set to 1.
2021-06-04 16:25:32 +10:00
djm@openbsd.org
e760691918 upstream: The RB_GENERATE_STATIC(3) macro expands to a series of
function definitions and not a statement, so there should be no semicolon
following them. Patch from Michael Forney

OpenBSD-Commit-ID: c975dd180580f0bdc0a4d5b7d41ab1f5e9b7bedd
2021-06-04 16:20:28 +10:00
djm@openbsd.org
c298c4da57 upstream: rework authorized_keys example section, removing irrelevant
stuff, de-wrapping the example lines and better aligning the examples with
common usage and FAQs; ok jmc

OpenBSD-Commit-ID: d59f1c9281f828148e2a2e49eb9629266803b75c
2021-06-04 16:00:31 +10:00
djm@openbsd.org
d9cb35bbec upstream: adjust SetEnv description to clarify $TERM handling
OpenBSD-Commit-ID: 8b8cc0124856bc1094949d55615e5c44390bcb22
2021-06-04 15:13:14 +10:00
dtucker@openbsd.org
771f57a862 upstream: Switch the listening select loop from select() to
pselect() and mask signals while checking signal flags, umasking for pselect
and restoring afterwards. Also restore signals before sighup_restart so they
don't remain blocked after restart.

This prevents a race where a SIGTERM or SIGHUP can arrive between
checking the flag and calling select (eg if sshd is processing a
new connection) resulting in sshd not shutting down until the next
time it receives a new connection.  bz#2158, with & ok djm@

OpenBSD-Commit-ID: bf85bf880fd78e00d7478657644fcda97b9a936f
2021-06-04 15:13:14 +10:00
djm@openbsd.org
f64f8c00d1 upstream: allow ssh_config SetEnv to override $TERM, which is otherwise
handled specially by the protocol. Useful in ~/.ssh/config to set TERM to
something generic (e.g. "xterm" instead of "xterm-256color") for destinations
that lack terminfo entries. feedback and ok dtucker@

OpenBSD-Commit-ID: 38b1ef4d5bc159c7d9d589d05e3017433e2d5758
2021-06-04 15:04:52 +10:00
djm@openbsd.org
60107677dc upstream: correct extension name "no-presence-required" =>
"no-touch-required"

document "verify-required" option

OpenBSD-Commit-ID: 1879ff4062cf61d79b515e433aff0bf49a6c55c5
2021-06-04 14:05:37 +10:00
Darren Tucker
ecc186e46e Retire fbsd7 test target.
It's the slowest of the selfhosted targets (since it's 32bit but has
most of the crypto algos). We still have coverage for 32bit i386.
2021-06-02 13:54:11 +10:00
Darren Tucker
5de0867b82 Check for $OPENSSL in md5 fallback too. 2021-06-02 11:22:12 +10:00
Darren Tucker
1db69d1b65 Add dfly60 target. 2021-06-02 11:22:12 +10:00
dtucker@openbsd.org
a3f2dd955f upstream: Merge back shell portability changes
bringing it back in sync with -portable.

OpenBSD-Regress-ID: c07905ba931e66ad7d849b87b7d19648007175d1
2021-06-02 10:33:46 +10:00
dtucker@openbsd.org
9d482295c9 upstream: Use a default value for $OPENSSL,
allowing it to be overridden. Do the same in the PuTTY tests since it's
needed there and not exported by test-exec.sh.

OpenBSD-Regress-ID: c49dcd6aa7602a8606b7afa192196ca1fa65de16
2021-06-02 10:11:25 +10:00
dtucker@openbsd.org
07660b3c99 upstream: Find openssl binary via environment variable. This
allows overriding if necessary (eg in -portable where we're testing against a
specific version of OpenSSL).

OpenBSD-Regress-ID: 491f39cae9e762c71aa4bf045803d077139815c5
2021-06-01 14:38:41 +10:00
djm@openbsd.org
1a4d1da918 upstream: fix memleak in test
OpenBSD-Regress-ID: 5e529d0982aa04666604936df43242e97a7a6f81
2021-06-01 14:38:41 +10:00
djm@openbsd.org
60455a5d98 upstream: also check contents of remaining string
OpenBSD-Regress-ID: d526fa07253f4eebbc7d6205a0ab3d491ec71a28
2021-06-01 14:38:41 +10:00
djm@openbsd.org
39f6cd2078 upstream: unit test for misc.c:strdelim() that mostly servces to
highlight its inconsistencies

OpenBSD-Regress-ID: 8d2bf970fcc01ccc6e36a5065f89b9c7fa934195
2021-06-01 14:38:41 +10:00
Darren Tucker
7a3a1dd2c7 Put minix3 config in the host-specific block. 2021-06-01 09:38:26 +10:00
djm@openbsd.org
59a194825f upstream: Hash challenge supplied by client during FIDO key enrollment
prior to passing it to libfido2, which does expect a hash.

There is no effect for users who are simply generating FIDO keys using
ssh-keygen - by default we generate a random 256 bit challenge, but
people building attestation workflows around our tools should now have
a more consistent experience (esp. fewer failures when they fail to
guess the magic 32-byte challenge length requirement).

ok markus@

OpenBSD-Commit-ID: b8d5363a6a7ca3b23dc28f3ca69470472959f2b5
2021-05-31 16:50:00 +10:00
Darren Tucker
eb68e669bc Include login_cap.h for login_getpwclass override.
On minix3, login_getpwclass is __RENAME'ed to __login_getpwclass50 so
without this the include overriding login_getpwclass causes a compile
error.
2021-05-27 21:14:15 +10:00
Darren Tucker
2063af7142 Add minix3 test target. 2021-05-27 21:13:38 +10:00
djm@openbsd.org
2e1efcfd9f upstream: fix SEGV in UpdateHostkeys debug() message, triggered
when the update removed more host keys than remain present. Fix tested by
reporter James Cook, via bugs@

OpenBSD-Commit-ID: 44f641f6ee02bb957f0c1d150495b60cf7b869d3
2021-05-26 12:46:01 +10:00
naddy@openbsd.org
9acd76e6e4 upstream: ssh: The client configuration keyword is
"hostbasedacceptedalgorithms"

This fixes a mistake that slipped in when "HostbasedKeyTypes" was
renamed to "HostbasedAcceptedAlgorithms".

Bug report by zack@philomathiclife.com

OpenBSD-Commit-ID: d745a7e8e50b2589fc56877f322ea204bc784f38
2021-05-26 12:46:01 +10:00
Darren Tucker
078a0e60c9 Rename README.md to ci-status.md.
The original intent was to provide a status page for the CIs configured
in that directory, but it had the side effect of replacing the top-level
README.md.
2021-05-25 11:40:47 +10:00
djm@openbsd.org
7be4ac8136 upstream: restore blocking status on stdio fds before close
ssh(1) needs to set file descriptors to non-blocking mode to operate
but it was not restoring the original state on exit. This could cause
problems with fds shared with other programs via the shell, e.g.

> $ cat > test.sh << _EOF
> #!/bin/sh
> {
>         ssh -Fnone -oLogLevel=verbose ::1 hostname
>         cat /usr/share/dict/words
> } | sleep 10
> _EOF
> $ ./test.sh
> Authenticated to ::1 ([::1]:22).
> Transferred: sent 2352, received 2928 bytes, in 0.1 seconds
> Bytes per second: sent 44338.9, received 55197.4
> cat: stdout: Resource temporarily unavailable

This restores the blocking status for fds 0,1,2 (stdio) before ssh(1)
abandons/closes them.

This was reported as bz3280 and GHPR246; ok dtucker@

OpenBSD-Commit-ID: 8cc67346f05aa85a598bddf2383fcfcc3aae61ce
2021-05-19 11:52:14 +10:00
djm@openbsd.org
c4902e1a65 upstream: fix breakage of -W forwaring introduced in 1.554; reported by
naddy@ and sthen@, ok sthen@

OpenBSD-Commit-ID: f72558e643a26dc4150cff6e5097b5502f6c85fd
2021-05-18 11:02:32 +10:00
dtucker@openbsd.org
afea01381a upstream: Regenerate moduli.
OpenBSD-Commit-ID: 83c93a2a07c584c347ac6114d6329b18ce515557
2021-05-17 19:25:00 +10:00
Damien Miller
be2866d620 Handle Android libc returning NULL pw->pw_passwd
Reported by Luke Dashjr
2021-05-17 09:41:46 +10:00
djm@openbsd.org
5953c14300 upstream: fix previous: test saved no_shell_flag, not the one that just
got clobbered

OpenBSD-Commit-ID: b8deace085d9d941b2d02f810243b9c302e5355d
2021-05-14 17:20:35 +10:00
djm@openbsd.org
1e9fa55f4d upstream: Fix ssh started with ControlPersist incorrectly executing a
shell when the -N (no shell) option was specified. bz3290 reported by Richard
Schwab; patch from markus@ ok me

OpenBSD-Commit-ID: ea1ea4af16a95687302f7690bdbe36a6aabf87e1
2021-05-14 13:10:50 +10:00
dtucker@openbsd.org
d1320c492f upstream: Clarify language about moduli. While both ends of the
connection do need to use the same parameters (ie groups), the DH-GEX
protocol takes care of that and both ends do not need the same contents in
the moduli file, which is what the previous text suggested.  ok djm@ jmc@

OpenBSD-Commit-ID: f0c18cc8e79c2fbf537a432a9070ed94e96a622a
2021-05-14 08:14:41 +10:00
djm@openbsd.org
d3cc4d650c upstream: include pid in LogVerbose spam
OpenBSD-Commit-ID: aacb86f96ee90c7cb84ec27452374285f89a7f00
2021-05-10 10:58:11 +10:00