summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/clientloop.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* return non-zero exit status when killed by signal; bz#3281djm2021-03-191-2/+2
| | | | ok dtucker@
* make ssh->kex->session_id a sshbuf instead of u_char*/size_t anddjm2021-01-271-6/+3
| | | | | use that instead of global variables containing copies of it. feedback/ok markus@
* remove global variable used to stash compat flags and use thedjm2021-01-271-2/+2
| | | | purpose-built ssh->compat variable instead; feedback/ok markus@
* load_hostkeys()/hostkeys_foreach() variants for FILE*djm2020-12-201-3/+3
| | | | | | | | | | | | | | | Add load_hostkeys_file() and hostkeys_foreach_file() that accept a FILE* argument instead of opening the file directly. Original load_hostkeys() and hostkeys_foreach() are implemented using these new interfaces. Add a u_int note field to the hostkey_entry and hostkey_foreach_line structs that is passed directly from the load_hostkeys() and hostkeys_foreach() call. This is a lightweight way to annotate results between different invocations of load_hostkeys(). ok markus@
* UpdateHostkeys: fixed/better detection of host keys that exist underdjm2020-10-291-9/+16
| | | | | other names and addresses; spotted by and debugged with lots of help from jca@
* use the new variant log macros instead of prepending __func__ anddjm2020-10-181-184/+152
| | | | appending ssh_err(r) manually; ok markus@
* make UpdateHostkeys still more conservative: refuse to proceed ifdjm2020-10-141-38/+76
| | | | | | | | | one of the keys offered by the server is already in known_hosts under another name. This avoid collisions between address entries for different host aliases when CheckHostIP=yes Also, do not attempt to fix known_hosts with incomplete host/ip matches when there are no new or deprecated hostkeys.
* UpdateHostkeys: check for keys under other namesdjm2020-10-111-7/+82
| | | | | | | | | | | | | Stop UpdateHostkeys from automatically removing deprecated keys from known_hosts files if the same keys exist under a different name or address to the host that is being connected to. This avoids UpdateHostkeys from making known_hosts inconsistent in some cases. For example, multiple host aliases sharing address-based known_hosts on different lines, or hosts that resolves to multiple addresses. ok markus@
* UpdateHostkeys: better CheckHostIP handlingdjm2020-10-111-25/+46
| | | | | | | | | | | | When preparing to update the known_hosts file, fully check both entries for both the host and the address (if CheckHostIP enabled) and ensure that, at the end of the operation, entries for both are recorded. Make sure this works with HashKnownHosts too, which requires maintaining a list of entry-types seen across the whole file for each key. ok markus@
* UpdateHostkeys: better detect manual host entriesdjm2020-10-111-17/+37
| | | | | | | | Disable UpdateHostkeys if the known_hosts line has more than two entries in the pattern-list. ssh(1) only writes "host" or "host,ip" lines so anything else was added by a different tool or by a human. ok markus@
* don't misdetect comma-separated hostkey names as wildcards;djm2020-10-081-4/+4
| | | | spotted by naddy@
* revert kex->flags cert hostkey downgrade back to a plain keydjm2020-10-071-7/+1
| | | | | | | (commitid VtF8vozGOF8DMKVg). We now do this a simpler way that needs less plumbing. ok markus@
* disable UpdateHostkeys when a wildcard hostname pattern isdjm2020-10-031-2/+31
| | | | | encountered or when a certificate host key is in use. feedback/ok markus@
* Remove unused buf, last user was removed when switching to the sshbuf API.dtucker2020-09-161-3/+1
| | | | Patch from Sebastian Andrzej Siewior.
* Only reset the serveralive check when we receive traffic from the serverdtucker2020-07-031-14/+22
| | | | | | and ignore traffic from a port forwarding client, preventing a client from keeping a connection alive when it should be terminated. Based on a patch from jxraynor at gmail.com via openssh-unix-dev and bz#2265, ok djm@
* Remove leave_non_blocking() which is now dead code because nothing setsdtucker2020-04-241-16/+1
| | | | | in_non_blocking_mode any more. Patch from michaael.meeks at collabora.com, ok djm@
* make failures when establishing "Tunnel" forwarding terminate thedjm2020-04-031-2/+5
| | | | connection when ExitOnForwardFailure is enabled; bz3116; ok dtucker
* change explicit_bzero();free() to freezero()jsg2020-02-261-3/+2
| | | | | | | | While freezero() returns early if the pointer is NULL the tests for NULL in callers are left to avoid warnings about passing an uninitialised size argument across a function boundry. ok deraadt@ djm@
* Remove obsolete XXX comment. ok deraadt@dtucker2020-02-261-4/+1
|
* Output (none) in debug in the case in the CheckHostIP=no case asdtucker2020-02-021-2/+2
| | | | suggested by markus@
* Prevent possible null pointer deref of ip_str in debug.dtucker2020-02-021-2/+3
|
* check the return value of ssh_packet_write_poll() and calldjm2020-01-301-3/+7
| | | | | sshpkt_fatal() if it fails; avoid potential busy-loop under some circumstances. Based on patch by Mike Frysinger; ok dtucker@
* markus suggests a simplification to previousdjm2020-01-291-7/+4
|
* give more context to UpdateHostKeys messages, mentioning that thedjm2020-01-291-3/+20
| | | | | changes are validated by the existing trusted host key. Prompted by espie@ feedback and ok markus@
* for UpdateHostKeys, don't report errors for unsupported key types -djm2020-01-261-3/+5
| | | | just ignore them. spotted by and ok dtucker@
* downgrade error() for missing subsequent known_hosts files to debug()djm2020-01-261-2/+2
| | | | as it was intended to be; spotted by dtucker@
* allow UpdateKnownHosts=yes to function when multiple known_hosts filesdjm2020-01-251-14/+43
| | | | | | | | are in use. When updating host keys, ssh will now search subsequent known_hosts files, but will add new/changed host keys to the first specified file only. bz#2738 ok markus@
* Replace all calls to signal(2) with a wrapper around sigaction(2).dtucker2020-01-231-13/+13
| | | | | | This wrapper blocks all other signals during the handler preventing races between handlers, and sets SA_RESTART which should reduce the potential for short read/write operations.
* Remove unsupported algorithms from list of defaults at run time anddtucker2020-01-231-3/+2
| | | | | | | | remove ifdef and distinct settings for OPENSSL=no case. This will make things much simpler for -portable where the exact set of algos depends on the configuration of both OpenSSH and the libcrypto it's linked against (if any). ok djm@
* Allow forwarding a different agent socket to the path specified bydjm2019-12-211-2/+13
| | | | | | | | $SSH_AUTH_SOCK, by extending the existing ForwardAgent option to accepting an explicit path or the name of an environment variable in addition to yes/no. Patch by Eric Chiang, manpage by me; ok markus@
* Add new structure for signature optionsdjm2019-11-251-2/+3
| | | | | | | | | This is populated during signature verification with additional fields that are present in and covered by the signature. At the moment, it is only used to record security key-specific options, especially the flags field. with and ok markus@
* stdarg.h required more broadly; ok djmderaadt2019-11-131-1/+2
|
* When using a combination of a Yubikey+GnuPG+remote forwarding the gpg-agentmestre2019-07-241-2/+2
| | | | | | | | | | | | | | (and options ControlMaster+RemoteForward in ssh_config(5)) then the codepath taken will call mux_client_request_session -> mm_send_fd -> sendmsg(2). Since sendmsg(2) is not allowed in that codepath then pledge(2) kills the process. The solution is to add "sendfd" to pledge(2), which is not too bad considering a little bit later we reduce pledge(2) to only "stdio proc tty" in that codepath. Problem reported and diff provided by Timothy Brown <tbrown at freeshell.org> OK deraadt@
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-6/+6
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* Remove unneeded unlink of xauthfile on error path. From Erik Sjölund viadtucker2019-06-261-2/+1
| | | | github, ok djm@ deraadt@
* Hostname->HostName cleanup; from lauri tirkkonenjmc2019-06-121-2/+2
| | | | ok dtucker
* Use the LogLevel typdef instead of int where appropriate. Patch fromdtucker2019-04-231-2/+2
| | | | Markus Schmidt via openssh-unix-dev, ok markus@
* when logging/fataling on error, include a bit more detail than just thedjm2019-03-291-17/+21
| | | | function name and the error message
* convert the remainder of clientloop.c to new packet APIdjm2019-01-191-35/+32
| | | | with & ok markus@
* convert clientloop.c to new packet APIdjm2019-01-191-121/+166
| | | | with & ok markus@
* begin landing remaining refactoring of packet parsing API, starteddjm2019-01-191-1/+4
| | | | | | | | | | | almost exactly six years ago. This change stops including the old packet_* API by default and makes each file that requires the old API include it explicitly. We will commit file-by-file refactoring to remove the old API in consistent steps. with & ok markus@
* Allow ssh_config ForwardX11Timeout=0 to disable the timeout and allowdjm2018-09-211-15/+28
| | | | X11 connections in untrusted mode indefinitely. ok dtucker@
* remove legacy key emulation layer; ok djm@markus2018-07-111-2/+2
|
* ttymodes: switch to sshbuf API; ok djm@markus2018-07-091-2/+2
|
* client: switch to sshbuf API; ok djm@markus2018-07-091-89/+113
|
* whitespacedjm2018-06-261-4/+4
|
* add a SetEnv directive to ssh_config that allows setting environmentdjm2018-06-091-5/+19
| | | | | | | | variables for the remote session (subject to the server accepting them) refactor SendEnv to remove the arbitrary limit of variable names. ok markus@
* lots of typos in comments/docs. Patch from Karsten Weiss after checkingdjm2018-04-101-2/+2
| | | | with codespell tool (https://github.com/lucasdemarchi/codespell)
* Don't reset signal handlers inside handlers.dtucker2018-02-111-2/+1
| | | | | | | | | The signal handlers from the original ssh1 code on which OpenSSH is based assume unreliable signals and reinstall their handlers. Since OpenBSD (and pretty much every current system) has reliable signals this is not needed. In the unlikely even that -portable is still being used on such systems we will deal with it in the compat layer. ok deraadt@
* Drop compatibility hacks for some ancient SSH implementations, includingdjm2018-01-231-11/+4
| | | | | | | | | | ssh.com <=2.* and OpenSSH <= 3.*. These versions were all released in or before 2001 and predate the final SSH RFCs. The hacks in question aren't necessary for RFC- compliant SSH implementations. ok markus@