Commit Graph

596 Commits

Author SHA1 Message Date
djm@openbsd.org 2d34205dab
upstream: make ssh -f (fork after authentication) work properly in
multiplexed cases (inc. ControlPersist). bz3589 bz3589 Based on patches by
Peter Chubb; ok dtucker@

OpenBSD-Commit-ID: a7a2976a54b93e6767dc846b85647e6ec26969ac
2023-07-27 09:11:22 +10:00
jmc@openbsd.org 6d6e185ba2
upstream: - add -P to usage() - sync the arg name to -J in usage()
with that in ssh.1 - reformat usage() to match what "man ssh" does on 80width

OpenBSD-Commit-ID: 5235dd7aa42e5bf90ae54579d519f92fc107036e
2023-07-17 16:23:03 +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
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
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 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
dtucker@openbsd.org 7174ba6f8a
upstream: Ignore return value from muxclient(). It normally loops
without returning, but it if returns on failure we immediately exit.
Coverity CID 405050.

OpenBSD-Commit-ID: ab3fde6da384ea588226037c38635a6b2e015295
2023-03-31 15:06:18 +11:00
dtucker@openbsd.org f1a17de150
upstream: Add tilde and environment variable expansion to
RevokedHostKeys. bz#3552, ok djm@

OpenBSD-Commit-ID: ce5d8e0219b63cded594c17d4c2958c06918ec0d
2023-03-27 15:03:53 +11:00
djm@openbsd.org df7d3dbf71
upstream: make `ssh -Q CASignatureAlgorithms` work as the manpage says
it should bz3532

OpenBSD-Commit-ID: 0ddb17b3fcbd99bfb5baea4ac5e449620cbd3adc
2023-02-10 15:44:19 +11:00
millert@openbsd.org 62360feb7f
upstream: For "ssh -V" always exit 0, there is no need to check opt
again. This was missed when the fallthrough in the switch case above it was
removed.  OK deraadt@

OpenBSD-Commit-ID: 5583e5d8f6d62a8a4215cfa95a69932f344c8120
2023-01-18 13:20:41 +11:00
dtucker@openbsd.org 41f36dd896
upstream: Add a "Host" line to the output of ssh -G showing the
original host arg. Inspired by patch from vincent at bernat.ch via bz#3343,
ok djm@

OpenBSD-Commit-ID: 59c0f60a222113a44d0650cd394376e3beecc883
2023-01-13 14:09:32 +11:00
djm@openbsd.org c60438158a
upstream: Add channel_force_close()
This will forcibly close an open channel by simulating read/write errors,
draining the IO buffers and calling the detach function.

Previously the detach function was only ever called during channel garbage
collection, but there was no way to signal the user of a channel (e.g.
session.c) that its channel was being closed deliberately (vs. by the
usual state-machine logic). So this adds an extra "force" argument to the
channel cleanup callback to indicate this condition.

ok markus dtucker

OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b
2023-01-06 16:21:39 +11:00
dtucker@openbsd.org 4403b62f55
upstream: Warn if no host keys for hostbased auth can be loaded.
OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977
2022-12-09 11:36:35 +11:00
djm@openbsd.org 1c2be7c200
upstream: typo in comment
OpenBSD-Commit-ID: 39c58f41e0f32d1ff31731fa6f5bbbc3ad25084a
2022-11-09 20:41:32 +11:00
djm@openbsd.org 445363433b
upstream: Be more paranoid with host/domain names coming from the
never write a name with bad characters to a known_hosts file.

reported by David Leadbeater, ok deraadt@

OpenBSD-Commit-ID: ba9b25fa8b5490b49398471e0c9657b0cbc7a5ad
2022-10-25 10:16:35 +11:00
jsg@openbsd.org 18376847b8
upstream: use correct type with sizeof ok djm@
OpenBSD-Commit-ID: d6c882c2e8a42ff831a5b3cbc2c961ecb2dd6143
2022-10-25 08:55:11 +11:00
djm@openbsd.org 5ee2b8ccfc
upstream: honour user's umask if it is more restrictive then the ssh
default (022); based on patch from Alex Henrie, ok dtucker@ deraadt@

OpenBSD-Commit-ID: fe1b9e15fc9a4f49fc338e848ce14d8727abe82d
2022-10-07 09:45:02 +11:00
djm@openbsd.org 54b333d12e
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
2022-09-17 20:39:02 +10:00
djm@openbsd.org 96faa0de6c 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
2022-07-01 10:37:46 +10:00
djm@openbsd.org 8a74a96d25 upstream: ssh is almost out of getopt() characters; note the
remaining remaining available ones in a comment

OpenBSD-Commit-ID: 48d38cef59d6bc8e84c6c066f6d601875d3253fd
2022-03-30 15:34:33 +11:00
dtucker@openbsd.org 45279abceb upstream: Switch hpdelim interface to accept only ":" as delimiter.
Historicallly, hpdelim accepted ":" or "/" as a port delimiter between
hosts (or addresses) and ports.  These days most of the uses for "/"
are no longer accepted, so there are several places where it checks the
delimiter to disallow it.  Make hpdelim accept only ":" and use hpdelim2
in the other cases.  ok djm@

OpenBSD-Commit-ID: 7e6420bd1be87590b6840973f5ad5305804e3102
2022-02-10 15:14:17 +11:00
djm@openbsd.org 11e8c4309a upstream: log some details on hostkeys that ssh loads for
hostbased authn ok markus@

OpenBSD-Commit-ID: da17061fa1f0e58cb31b88478a40643e18233e38
2022-01-07 09:21:38 +11:00
jsg@openbsd.org c45a752f0d upstream: spelling
OpenBSD-Commit-ID: c63e43087a64d0727af13409c708938e05147b62
2022-01-04 18:22:46 +11:00
djm@openbsd.org dc91ceea33 upstream: don't put the tty into raw mode when SessionType=none, avoids
^c being unable to kill such a session. bz3360; ok dtucker@

OpenBSD-Commit-ID: 83960c433052303b643b4c380ae2f799ac896f65
2021-12-02 13:57:50 +11:00
dtucker@openbsd.org 8c07170135 upstream: Fix "Allocated port" debug message
for unix domain sockets. From peder.stray at gmail.com via github PR#272,
ok deraadt@

OpenBSD-Commit-ID: 8d5ef3fbdcdd29ebb0792b5022a4942db03f017e
2021-09-20 14:31:57 +10:00
djm@openbsd.org a4bee1934b upstream: allow CanonicalizePermittedCNAMEs=none in ssh_config; ok
markus@

OpenBSD-Commit-ID: 668a82ba8e56d731b26ffc5703213bfe071df623
2021-09-16 15:38:16 +10:00
dtucker@openbsd.org 66a658b5d9 upstream: Document behaviour of arguments following non-interactive
commands. Prompted by github PR#139 from EvanTheB, feedback & ok djm@ jmc@

OpenBSD-Commit-ID: fc758d1fe0471dfab4304fcad6cd4ecc3d79162a
2021-09-10 20:34:09 +10:00
dtucker@openbsd.org 724eb900ac upstream: xstrdup environment variable used by ForwardAgent. bz#3328
from goetze at dovetail.com, ok djm@ deraadt@

OpenBSD-Commit-ID: 760320dac1c3b26904284ba417a7d63fccc5e742
2021-08-08 19:14:51 +10:00
djm@openbsd.org 9e1882ef64 upstream: note successful authentication method in final "Authenticated
to ..." message and partial auth success messages (all at LogLevel=verbose)
ok dtucker@

OpenBSD-Commit-ID: 06834b89ceb89f8f16c5321d368a66c08f441984
2021-07-23 15:25:19 +10:00
djm@openbsd.org a917e973a1 upstream: Add a ForkAfterAuthentication ssh_config(5) counterpart
to the ssh(1) -f flag. Last part of GHPR231 from Volker Diels-Grabsch. ok
dtucker

OpenBSD-Commit-ID: b18aeda12efdebe2093d55263c90fe4ea0bce0d3
2021-07-23 14:07:19 +10:00
djm@openbsd.org e0c5088f1c upstream: Add a StdinNull directive to ssh_config(5) that allows
the config file to do the same thing as -n does on the ssh(1) commandline.
Patch from Volker Diels-Grabsch via GHPR231; ok dtucker

OpenBSD-Commit-ID: 66ddf3f15c76796d4dcd22ff464aed1edd62468e
2021-07-23 14:07:19 +10:00
djm@openbsd.org 52c3b6985e upstream: wrap some long lines
OpenBSD-Commit-ID: 4f5186b1466656762dae37d3e569438d900c350d
2021-07-17 10:43:23 +10:00
djm@openbsd.org 43ec991a78 upstream: fix sftp on ControlPersist connections, broken by recent
SessionType change; spotted by sthen@

OpenBSD-Commit-ID: 4c5ddc5698790ae6ff50d2a4f8f832f0eeeaa234
2021-07-17 10:43:23 +10:00
djm@openbsd.org eda8909d1b upstream: add a SessionType directive to ssh_config, allowing the
configuration file to offer equivalent control to the -N (no session) and -s
(subsystem) command-line flags.

Part of GHPR#231 by Volker Diels-Grabsch with some minor tweaks;
feedback and ok dtucker@

OpenBSD-Commit-ID: 726ee931dd4c5cc7f1d7a187b26f41257f9a2d12
2021-07-14 09:49:47 +10:00
Darren Tucker c9f7bba2e6 Move closefrom() to before first malloc.
When built against tcmalloc, tcmalloc allocates a descriptor for its
internal use, so calling closefrom() afterward causes the descriptor
number to be reused resulting in a corrupted connection.  Moving the
closefrom a little earlier should resolve this.  From kircherlike at
outlook.com via bz#3321, ok djm@
2021-06-25 15:08:18 +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
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 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
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
Damien Miller 57ed647ee0 polish whitespace for portable files 2021-04-03 17:47:37 +11:00
djm@openbsd.org 082804c14e upstream: ensure that pkcs11_del_provider() is called before exit -
some PKCS#11 providers get upset if C_Initialize is not matched with
C_Finalize.

From Adithya Baglody via GHPR#234; ok markus

OpenBSD-Commit-ID: f8e770e03b416ee9a58f9762e162add900f832b6
2021-04-03 16:42:45 +11:00
djm@openbsd.org c3b1636770 upstream: warn when the user specifies a ForwardAgent path that does
not exist and exit if ExitOnForwardFailure is set; bz3264

OpenBSD-Commit-ID: 72f7875865e723e464c71bf8692e83110699bf26
2021-02-23 11:09:07 +11:00
markus@openbsd.org da0a9afcc4 upstream: ssh: add PermitRemoteOpen for remote dynamic forwarding
with SOCKS ok djm@, dtucker@

OpenBSD-Commit-ID: 64fe7b6360acc4ea56aa61b66498b5ecc0a96a7c
2021-02-17 15:03:41 +11:00
djm@openbsd.org 69338ab46a upstream: whitespace
OpenBSD-Commit-ID: 544bb092e03fcbecb420196cd0f70af13ea868ad
2021-02-05 13:38:57 +11:00
djm@openbsd.org 4ca6a1fac3 upstream: remove global variable used to stash compat flags and use the
purpose-built ssh->compat variable instead; feedback/ok markus@

OpenBSD-Commit-ID: 7c4f200e112dae6bcf99f5bae1a5629288378a06
2021-01-27 20:28:25 +11:00
dtucker@openbsd.org e9f78d6b06 upstream: Rename HostbasedKeyTypes (ssh) and
HostbasedAcceptedKeyTypes (sshd) to HostbasedAcceptedAlgorithms, which more
accurately reflects its effect. This matches a previous change to
PubkeyAcceptedAlgorithms.  The previous names are retained as aliases.  ok
djm@

OpenBSD-Commit-ID: 49451c382adc6e69d3fa0e0663eeef2daa4b199e
2021-01-26 22:50:40 +11:00
dtucker@openbsd.org ee9c0da803 upstream: Rename PubkeyAcceptedKeyTypes keyword to
PubkeyAcceptedAlgorithms. While the two were originally equivalent, this
actually specifies the signature algorithms that are accepted.  Some key
types (eg RSA) can be used by multiple algorithms (eg ssh-rsa, rsa-sha2-512)
so the old name is becoming increasingly misleading.  The old name is
retained as an alias. Prompted by bz#3253, help & ok djm@, man page help jmc@

OpenBSD-Commit-ID: 0346b2f73f54c43d4e001089759d149bfe402ca5
2021-01-22 15:03:56 +11:00
djm@openbsd.org 0f504f592d upstream: plumb ssh_conn_info through to sshconnect.c; feedback/ok
markus@

OpenBSD-Commit-ID: e8d14a09cda3f1dc55df08f8a4889beff74e68b0
2020-12-21 10:52:28 +11:00