summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh.c
AgeCommit message (Collapse)Author
2024-12-06support VersionAddendum in the client, mirroring the option ofDamien Miller
the same name in the server; bz2745 ok dtucker@
2024-10-18require control-escape character sequences passed via the '-e ^x'Damien Miller
commandline to be exactly two characters long. Avoids one by OOB read if ssh is invoked as "ssh -e^ ..." Spotted by Maciej Domanski in GHPR368
2024-01-11make DSA key support compile-time optional, defaulting to onDamien Miller
ok markus@
2023-12-18ban user/hostnames with most shell metacharactersDamien Miller
This makes ssh(1) refuse user or host names provided on the commandline that contain most shell metacharacters. Some programs that invoke ssh(1) using untrusted data do not filter metacharacters in arguments they supply. This could create interactions with user-specified ProxyCommand and other directives that allow shell injection attacks to occur. It's a mistake to invoke ssh(1) with arbitrary untrusted arguments, but getting this stuff right can be tricky, so this should prevent most obvious ways of creating risky situations. It however is not and cannot be perfect: ssh(1) has no practical way of interpreting what shell quoting rules are in use and how they interact with the user's specified ProxyCommand. To allow configurations that use strange user or hostnames to continue to work, this strictness is applied only to names coming from the commandline. Names specified using User or Hostname directives in ssh_config(5) are not affected. feedback/ok millert@ markus@ dtucker@ deraadt@
2023-10-12don't dereference NULL pointer when hashing jumphostDamien Miller
2023-10-12add %j token that expands to the configured ProxyJump hostname (orDamien Miller
the empty string if this option is not being used). bz3610, ok dtucker
2023-10-11sync usage() with ssh.1; spotted by kn@Damien Miller
2023-10-11add ChannelTimeout support to the client, mirroring the same optionDamien Miller
in the server. ok markus@
2023-09-03set interactive mode for ControlPersist sessions if they originallyDamien Miller
requested a tty; enables keystroke timing obfuscation for most ControlPersist sessions. Spotted by naddy@
2023-07-26make ssh -f (fork after authentication) work properly in multiplexedDamien Miller
cases (inc. ControlPersist). bz3589 bz3589 Based on patches by Peter Chubb; ok dtucker@
2023-07-17- add -P to usage()Jason McIntyre
- sync the arg name to -J in usage() with that in ssh.1 - reformat usage() to match what "man ssh" does on 80width
2023-07-17Add support for configuration tags to ssh(1).Damien Miller
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
2023-07-04add support for unix domain sockets to ssh -WDavid Gwynne
ok djm@ dtucker@
2023-06-21make `ssh -Q CASignatureAlgorithms` only list signature algorithms thatDamien Miller
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@
2023-04-26Check for ProxyJump=none in CanonicalizeHostname logic.Damien Miller
Previously ssh would incorrectly refuse to canonicalise the hostname if ProxyJump was explicitly set to "none" when CanonicalizeHostname=yes bz3567; ok dtucker
2023-03-30Ignore return value from muxclient(). It normally loops without returning,Darren Tucker
but it if returns on failure we immediately exit. Coverity CID 405050.
2023-03-27Add tilde and environment variable expansion to RevokedHostKeys.Darren Tucker
bz#3552, ok djm@
2023-02-10make `ssh -Q CASignatureAlgorithms` work as the manpage says it shouldDamien Miller
bz3532
2023-01-17For "ssh -V" always exit 0, there is no need to check opt again.Todd C. Miller
This was missed when the fallthrough in the switch case above it was removed. OK deraadt@
2023-01-13Add a "Host" line to the output of ssh -G showing the original host arg.Darren Tucker
Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@
2023-01-06Add channel_force_close()Damien Miller
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
2022-12-09Warn if no host keys for hostbased auth can be loaded. From bz#3507, ok djm@Darren Tucker
2022-11-09typo in commentDamien Miller
2022-10-24Be more paranoid with host/domain names coming from the resolver:Damien Miller
don't follow CNAMEs with invalid characters when canonicalising and never write a name with bad characters to a known_hosts file. reported by David Leadbeater, ok deraadt@
2022-10-13use correct type with sizeofJonathan Gray
ok djm@
2022-10-06honour user's umask if it is more restrictive then the ssh defaultDamien Miller
(022); based on patch from Alex Henrie, ok dtucker@ deraadt@
2022-09-17add a RequiredRSASize for checking RSA key length in ssh(1).Damien Miller
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@
2022-07-01ignore SIGPIPE earlier in main(), specifically before muxclient()Damien Miller
which performs operations that could cause one; Reported by Noam Lewis via bz3454, ok dtucker@
2022-03-30ssh is almost out of getopt() characters; note the remainingDamien Miller
remaining available ones in a comment
2022-02-08Switch hpdelim interface to accept only ":" as delimiter.Darren Tucker
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@
2022-01-06log some details on hostkeys that ssh loads for hostbased authnDamien Miller
ok markus@
2022-01-01spellingJonathan Gray
2021-12-02don't put the tty into raw mode when SessionType=none, avoids ^c beingDamien Miller
unable to kill such a session. bz3360; ok dtucker@
2021-09-20Fix "Allocated port" debug message for unix sockets. From peder.stray atDarren Tucker
gmail.com via github PR#272, ok deraadt@
2021-09-15allow CanonicalizePermittedCNAMEs=none in ssh_config; ok markus@Damien Miller
2021-09-10Document behaviour of arguments following non-interactive commands.Darren Tucker
Prompted by github PR#139 from EvanTheB, feedback & ok djm@ jmc@
2021-08-08xstrdup environment variable used by ForwardAgent. bz#3328 fromDarren Tucker
goetze at dovetail.com, ok djm@ deraadt@
2021-07-23note successful authentication method in final "Authenticated to ..."Damien Miller
message and partial auth success messages (all at LogLevel=verbose) ok dtucker@
2021-07-23Add a ForkAfterAuthentication ssh_config(5) counterpart to theDamien Miller
ssh(1) -f flag. Last part of GHPR231 from Volker Diels-Grabsch. ok dtucker
2021-07-23Add a StdinNull directive to ssh_config(5) that allows the configDamien Miller
file to do the same thing as -n does on the ssh(1) commandline. Patch from Volker Diels-Grabsch via GHPR231; ok dtucker
2021-07-17wrap some long linesDamien Miller
2021-07-17fix sftp on ControlPersist connections, broken by recent SessionTypeDamien Miller
change; spotted by sthen@
2021-07-13add a SessionType directive to ssh_config, allowing the configurationDamien Miller
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@
2021-06-08Switch ssh_config parsing to use argv_split()Damien Miller
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
2021-06-04allow ssh_config SetEnv to override $TERM, which is otherwise handledDamien Miller
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@
2021-05-19restore blocking status on stdio fds before closeDamien Miller
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@
2021-05-17fix breakage of -W forwaring introduced in 1.554; reported byDamien Miller
naddy@ and sthen@, ok sthen@
2021-05-14fix previous: test saved no_shell_flag, not the one that just gotDamien Miller
clobbered
2021-05-14Fix ssh started with ControlPersist incorrectly executing a shellDamien Miller
when the -N (no shell) option was specified. bz3290 reported by Richard Schwab; patch from markus@ ok me
2021-04-03ensure that pkcs11_del_provider() is called before exit - some PKCS#11Damien Miller
providers get upset if C_Initialize is not matched with C_Finalize. From Adithya Baglody via GHPR#234; ok markus