summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/clientloop.c
AgeCommit message (Collapse)Author
2024-10-13don't start the ObscureKeystrokeTiming mitigations if there has beenDamien Miller
traffic on a X11 forwarding channel recently. Should fix X11 forwarding performance problems when this setting is enabled. Patch from Antonio Larrosa via bz3655
2024-07-01when sending ObscureKeystrokeTiming chaff packets, we can'tDamien Miller
rely on channel_did_enqueue to tell that there is data to send. This flag indicates that the channels code enqueued a packet on _this_ ppoll() iteration, not that data was enqueued in _any_ ppoll() iteration in the timeslice. ok markus@
2024-05-17remove prototypes with no matching function; ok djm@Jonathan Gray
2024-05-09simplify exit message handling, which was more complicated thanDamien Miller
it needed to be because of unexpunged ssh1 remnants. ok markus@
2024-04-30correctly restore sigprocmask around ppoll()Damien Miller
reported by Tõivo Leedjärv; ok deraadt@
2024-04-30add explict check for server hostkey type against HostkeyAlgorithms.Damien Miller
Allows HostkeyAlgorithms to disable implicit fallback from certificate keys to plain keys. ok markus@
2024-02-21fix proxy multiplexing mode, broken when keystroke timingDamien Miller
obfuscation was added. GHPR#463 from montag451
2023-11-24Plug mem leak of msg when processing a quit message.Darren Tucker
Coverity CID#427852, ok djm@
2023-11-15when deciding whether to enable keystroke timing obfuscation,Damien Miller
only consider enabling it when a channel with a tty is open. Avoids turning on the obfucation when X11 forwarding only is in use, which slows it right down. Reported by Roger Marsh
2023-10-12mask SIGINT/TERM/QUIT/HUP before checking quit_pending and use ppoll()Damien Miller
to unmask them in the mainloop. Avoids race condition between signaling ssh to exit and polling. bz3531; ok dtucker
2023-10-11add ChannelTimeout support to the client, mirroring the same optionDamien Miller
in the server. ok markus@
2023-09-10typo in commentDamien Miller
2023-09-10randomise keystroke obfuscation intervals and average interval rate.Damien Miller
ok dtucker@
2023-09-04trigger keystroke timing obfucation only if the channels layer enqueudDamien Miller
some data in the last poll() cycle; this avoids triggering the obfuscatior for non-channels data like ClientAlive probes and also fixes a related problem were the obfucations would be triggered on fully quiescent connections. Based on / tested by naddy@
2023-09-04avoid bogus "obfuscate_keystroke_timing: stopping ..." debugDamien Miller
messages when keystroke timing obfuscation was never started; spotted by naddy@
2023-08-28explicit long long type in timing calculations (doesn't matter, sinceDamien Miller
the range is pre-clamped)
2023-08-28Add keystroke timing obfuscation to the client.Damien Miller
This attempts to hide inter-keystroke timings by sending interactive traffic at fixed intervals (default: every 20ms) when there is only a small amount of data being sent. It also sends fake "chaff" keystrokes for a random interval after the last real keystroke. These are controlled by a new ssh_config ObscureKeystrokeTiming keyword/ feedback/ok markus@
2023-04-03Move null check up and simplify process_escapes. Based on Coverity CIDDarren Tucker
291863 which points out we check the channel pointer for NULLness after dereferencing it. Move this to the start of the function, and while there simplify initialization of efc a bit. ok djm@
2023-03-31remove redundant testDamien Miller
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2023-03-03Check for non-NULL before string comparison. From jjelen at redhat.comDarren Tucker
via bz#2687.
2023-03-03Use time_t for x11_refuse_time timeout. We need SSH_TIME_T_MAX forDarren Tucker
this, so move from misc.c to misc.h so it's available. Fixes a Coverity warning for 64bit time_t safety, 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
2023-01-06replace manual poll/ppoll timeout math with ptimeout APIDamien Miller
feedback markus / ok markus dtucker
2022-11-29Add void to client_repledge args to fix compiler warning. ok djm@Darren Tucker
2022-11-28tighten pledge(2) after session establishmentDamien Miller
feedback, ok & testing in snaps deraadt@
2022-11-28New EnableEscapeCommandline ssh_config(5) optionDamien Miller
This option (default "no") controls whether the ~C escape is available. Turning it off by default means we will soon be able to use a stricter default pledge(2) in the client. feedback deraadt@ dtucker@; tested in snaps for a while
2022-11-10Handle dynamic remote port forwarding in escape commandline's -R processing.Darren Tucker
bz#3499, ok djm@
2022-11-09rename client_global_hostkeys_private_confirm() toDamien Miller
client_global_hostkeys_prove_confirm(), as it handles the "hostkeys-prove00@openssh.com" message; no functional change
2022-06-03Make SetEnv directives first-match-wins in both sshd_config andDamien Miller
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
2022-04-20Try to continue running local I/O for channels in state OPEN duringDamien Miller
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@
2022-01-22add a ssh_packet_process_read() function that reads from a fdDamien Miller
directly into the transport input buffer. Use this in the client and server mainloops to avoid unnecessary copying. It also lets us use a more greedy read size without penalty. Yields a 2-3% performance gain on cipher-speed.sh (in a fairly unscientific test tbf) feedback dtucker@ ok markus@
2022-01-21add a helper for writing an error message to the stderr_buf and settingDamien Miller
quit_pending; no functional change but saves a bunch of boilerplate
2022-01-11suppress "Connection to xxx closed" messages at LogLevel >= errorDamien Miller
bz3378; ok dtucker@
2022-01-06stricter UpdateHostkey signature verification logic on the client-Damien Miller
side. Require RSA/SHA2 signatures for RSA hostkeys except when RSA/SHA1 was explicitly negotiated during initial KEX; bz3375 ok markus@
2022-01-06convert ssh, sshd mainloops from select() to poll();Damien Miller
feedback & ok deraadt@ and markus@ has been in snaps for a few months
2022-01-01spellingJonathan Gray
ok dtucker@
2021-12-19ssh client side of bindingDamien Miller
send session ID, hostkey, signature and a flag indicating whether the agent connection is being forwarded to ssh agent each time a connection is opened via a new "session-bind@openssh.com" agent extension. ok markus@
2021-11-18less confusing debug message; bz#3365Damien Miller
2021-08-29wrap at 80 columnsDamien Miller
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-16Explicitly check for and start time-based rekeying in the clientDamien Miller
and server mainloops. Previously the rekey timeout could expire but rekeying would not start until a packet was sent or received. This could cause us to spin in select() on the rekey timeout if the connection was quiet. ok markus@
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-07-05Fix a couple of whitespace things. Portable already has these so thisDarren Tucker
removes two diffs between the two.
2021-05-26fix SEGV in UpdateHostkeys debug() message, triggered when the updateDamien Miller
removed more host keys than remain present. Fix tested by reporter James Cook, via bugs@
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-04Don't pass NULL as a string in debugging as it does not work on someDarren Tucker
platforms in -portable. ok djm@
2021-05-03more debugging for UpdateHostKeys signature failuresDamien Miller
2021-04-30a little debugging in the main mux process for status confirmationDamien Miller
failures in multiplexed sessions