Commit Graph

339 Commits

Author SHA1 Message Date
djm@openbsd.org
82662d562c
upstream: ssh-agent implemented an all-or-nothing allow-list of
FIDO application IDs for security key-backed keys, to prevent web key handles
from being used remotely as this would likely lead to unpleasant surprises.
By default, only application IDs that start with "ssh:*" are allowed.

This adds a -Owebsafe-allow=... argument that can override the default
list with a more or less restrictive one. The default remains unchanged.

ok markus@

OpenBSD-Commit-ID: 957c1ed92a8d7c87453b9341f70cb3f4e6b23e8d
2024-11-07 10:49:13 +11:00
djm@openbsd.org
e86d7a077c
upstream: amake ssh-agent drop all keys when it receives SIGUSR1;
let's users zap keys without access to $SSH_AUTH_SOCK

ok deraadt@

OpenBSD-Commit-ID: dae9db0516b1011e5ba8c655ac702fce42e6c023
2024-10-24 14:29:31 +11:00
djm@openbsd.org
9517cc5857
upstream: some extra paranoia, reminded by jsg@
OpenBSD-Commit-ID: 22072bfa1df1391858ae7768a6c627e08593a91e
2024-09-25 11:27:23 +10:00
djm@openbsd.org
a6a740a494
upstream: avoid logging in signal handler by converting mainloop to
ppoll() bz3670, reported by Ben Hamilton; ok dtucker@

OpenBSD-Commit-ID: e58f18042b86425405ca09e6e9d7dfa1df9f5f7f
2024-03-09 16:13:57 +11:00
djm@openbsd.org
242742827f
upstream: wrap a few PKCS#11-specific bits in ENABLE_PKCS11
OpenBSD-Commit-ID: 463e4a69eef3426a43a2b922c4e7b2011885d923
2024-03-06 11:33:18 +11:00
djm@openbsd.org
430ef86464
upstream: match flag type (s/int/u_int)
OpenBSD-Commit-ID: 9422289747c35ccb7b31d0e1888ccd5e74ad566a
2024-01-08 13:25:19 +11:00
djm@openbsd.org
6d51feab15
upstream: ssh-agent: record failed session-bind attempts
Record failed attempts to session-bind a connection and refuse signing
operations on that connection henceforth.

Prevents a future situation where we add a new hostkey type that is not
recognised by an older ssh-agent, that consequently causes session-bind
to fail (this situation is only likely to arise when people mix ssh(1)
and ssh-agent(1) of different versions on the same host). Previously,
after such a failure the agent socket would be considered unbound and
not subject to restriction.

Spotted by Jann Horn

OpenBSD-Commit-ID: b0fdd023e920aa4831413f640de4c5307b53552e
2023-12-19 01:53:40 +11:00
djm@openbsd.org
4448a2938a
upstream: Make it possible to load certs from PKCS#11 tokens
Adds a protocol extension to allow grafting certificates supplied by
ssh-add to keys loaded from PKCS#11 tokens in the agent.

feedback/ok markus@

OpenBSD-Commit-ID: bb5433cd28ede2bc910996eb3c0b53e20f86037f
2023-12-19 01:52:55 +11:00
djm@openbsd.org
881d9c6af9
upstream: apply destination constraints to all p11 keys
Previously applied only to the first key returned from each token.

ok markus@

OpenBSD-Commit-ID: 36df3afb8eb94eec6b2541f063d0d164ef8b488d
2023-12-19 01:51:46 +11:00
djm@openbsd.org
1f2731f5d7
upstream: Disallow remote addition of FIDO/PKCS11 provider
libraries to ssh-agent by default.

The old behaviour of allowing remote clients from loading providers
can be restored using `ssh-agent -O allow-remote-pkcs11`.

Detection of local/remote clients requires a ssh(1) that supports
the `session-bind@openssh.com` extension. Forwarding access to a
ssh-agent socket using non-OpenSSH tools may circumvent this control.

ok markus@

OpenBSD-Commit-ID: 4c2bdf79b214ae7e60cc8c39a45501344fa7bd7c
2023-07-20 00:18:27 +10:00
djm@openbsd.org
4b43bc358a
upstream: misplaced debug message
OpenBSD-Commit-ID: d0f12af0a5067a756aa707bc39a83fa6f58bf7e5
2023-07-14 15:33:29 +10:00
dtucker@openbsd.org
6b73aa2903
upstream: Explictly ignore return codes
where we don't check them.

OpenBSD-Commit-ID: 1ffb03038ba1b6b72667be50cf5e5e396b5f2740
2023-03-31 16:17:46 +11:00
jcs@openbsd.org
633d3dc2a1
upstream: modify parentheses in conditionals to make it clearer what is
being assigned and what is being checked

ok djm dtucker

OpenBSD-Commit-ID: 19c10baa46ae559474409f75a5cb3d0eade7a9b8
2023-03-10 10:40:02 +11:00
guenther@openbsd.org
51875897b8
upstream: Delete obsolete /* ARGSUSED */ lint comments.
ok miod@ millert@

OpenBSD-Commit-ID: 7be168a570264d59e96a7d2d22e927d45fee0e4c
2023-03-08 17:26:53 +11:00
dtucker@openbsd.org
fc7f8f2188
upstream: Remove unused compat.h includes.
We've previously removed a lot of the really old compatibility code,
and with it went the need to include compat.h in most of the files that
have it.

OpenBSD-Commit-ID: 5af8baa194be00a3092d17598e88a5b29f7ea2b4
2023-03-05 19:27:31 +11:00
dtucker@openbsd.org
73dcca1211
upstream: Remove duplicate includes.
Patch from AtariDreams via github PR#364.

OpenBSD-Commit-ID: b9186638a05cb8b56ef7c0de521922b6723644ea
2022-12-04 22:40:04 +11:00
jmc@openbsd.org
4a4883664d
upstream: ssh-agent.1: - use Nm not Xr for self-ref - while here,
wrap a long line

ssh-agent.c:
- add -O to usage()

OpenBSD-Commit-ID: 855dac4695cef22e96d69c53436496bc408ca389
2022-10-25 08:55:10 +11:00
djm@openbsd.org
3991a0cf94
upstream: actually hook up restrict_websafe; the command-line flag
was never actually used. Spotted by Matthew Garrett

OpenBSD-Commit-ID: 0b363518ac4c2819dbaa3dfad4028633ab9cdff1
2022-09-17 20:37:20 +10:00
djm@openbsd.org
940dc10729
upstream: a little extra debugging
OpenBSD-Commit-ID: edf1601c1d0905f6da4c713f4d9cecc7d1c0295a
2022-09-14 10:16:05 +10:00
djm@openbsd.org
4b5f91cb95
upstream: ssh-agent: attempt FIDO key signing without PIN and use
the error to determine whether a PIN is required and prompt only if
necessary. from Corinna Vinschen

OpenBSD-Commit-ID: dd6be6a0b7148608e834ee737c3479b3270b00dd
2022-09-14 10:16:05 +10:00
djm@openbsd.org
0ba39b93b3
upstream: notifier_complete(NULL, ...) is a noop, so no need to test
that ctx!=NULL; from Corinna Vinschen

OpenBSD-Commit-ID: ade2f2e9cc519d01a586800c25621d910bce384a
2022-09-09 13:38:14 +10:00
djm@openbsd.org
247082b501 upstream: fix memleak on session-bind path; from Pedro Martelletto, ok
dtucker@

OpenBSD-Commit-ID: e85899a26ba402b4c0717b531317e8fc258f0a7e
2022-04-29 13:18:31 +10:00
djm@openbsd.org
39d17e189f upstream: allow pin-required FIDO keys to be added to ssh-agent(1).
ssh-askpass will be used to request the PIN at authentication time.

From Pedro Martelletto, ok djm

OpenBSD-Commit-ID: de8189fcd35b45f632484864523c1655550e2950
2022-01-18 10:00:35 +11:00
dtucker@openbsd.org
72bcd7993d upstream: Don't log NULL hostname in restricted agent code,
printf("%s", NULL) is not safe on all platforms.  with & ok djm

OpenBSD-Commit-ID: faf10cdae4adde00cdd668cd1f6e05d0a0e32a02
2022-01-12 15:19:21 +11:00
djm@openbsd.org
a23698c308 upstream: fix memleak in process_extension(); oss-fuzz issue #42719
OpenBSD-Commit-ID: d8d49f840162fb7b8949e3a5adb8107444b6de1e
2022-01-01 15:19:48 +11:00
jsg@openbsd.org
cb885178f3 upstream: spelling ok dtucker@
OpenBSD-Commit-ID: bfc7ba74c22c928de2e257328b3f1274a3dfdf19
2022-01-01 15:19:48 +11:00
Damien Miller
715c892f0a remove sys/param.h in -portable, after upstream 2021-12-22 09:02:50 +11:00
djm@openbsd.org
a6d7677c4a upstream: Use hostkey parsed from hostbound userauth request
Require host-bound userauth requests for forwarded SSH connections.

The hostkey parsed from the host-bound userauth request is now checked
against the most recently bound session ID / hostkey on the agent socket
and the signature refused if they do not match.

ok markus@

OpenBSD-Commit-ID: d69877c9a3bd8d1189a5dbdeceefa432044dae02
2021-12-20 09:28:07 +11:00
djm@openbsd.org
baaff0ff43 upstream: agent support for parsing hostkey-bound signatures
Allow parse_userauth_request() to work with blobs from
publickey-hostbound-v00@openssh.com userauth attempts.

Extract hostkey from these blobs.

ok markus@

OpenBSD-Commit-ID: 81c064255634c1109477dc65c3e983581d336df8
2021-12-20 09:28:07 +11:00
djm@openbsd.org
39f00dcf44 upstream: ssh-agent side of destination constraints
Gives ssh-agent the ability to parse restrict-destination-v00@openssh.com
constraints and to apply them to keys.

Check constraints against the hostkeys recorded for a SocketEntry when
attempting a signature, adding, listing or deleting keys. Note that
the "delete all keys" request will remove constrained keys regardless of
location.

feedback Jann Horn & markus@
ok markus@

OpenBSD-Commit-ID: 84a7fb81106c2d609a6ac17469436df16d196319
2021-12-20 09:27:06 +11:00
djm@openbsd.org
4c1e3ce85e upstream: ssh-agent side of binding
record session ID/hostkey/forwarding status for each active socket.

Attempt to parse data-to-be-signed at signature request time and extract
session ID from the blob if it is a pubkey userauth request.

ok markus@

OpenBSD-Commit-ID: a80fd41e292b18b67508362129e9fed549abd318
2021-12-20 09:24:42 +11:00
djm@openbsd.org
875408270c upstream: check for POLLHUP wherever we check for POLLIN
OpenBSD-Commit-ID: 6aa6f3ec6b17c3bd9bfec672a917f003a76d93e5
2021-11-18 14:32:54 +11:00
djm@openbsd.org
31d8d231eb upstream: highly polished whitespace, mostly fixing spaces-for-tab
and bad indentation on continuation lines. Prompted by GHPR#185

OpenBSD-Commit-ID: e5c81f0cbdcc6144df1ce468ec1bac366d8ad6e9
2021-04-03 17:23:02 +11:00
djm@openbsd.org
e04fd6dde1 upstream: factor SSH_AGENT_CONSTRAIN_EXTENSION parsing into its own
function and remove an unused variable; ok dtucker@

OpenBSD-Commit-ID: e1a938657fbf7ef0ba5e73b30365734a0cc96559
2021-02-17 15:03:41 +11:00
djm@openbsd.org
3287790e78 upstream: memleak on error path; ok markus@
OpenBSD-Commit-ID: 2091a36d6ca3980c81891a6c4bdc544e63cb13a8
2021-02-05 13:38:57 +11:00
djm@openbsd.org
1a4b927586 upstream: fix the values of enum sock_type
OpenBSD-Commit-ID: 18d048f4dbfbb159ff500cfc2700b8fb1407facd
2021-01-30 11:58:31 +11:00
djm@openbsd.org
8afaa7d791 upstream: give typedef'd struct a struct name; makes the fuzzer I'm
writing a bit easier

OpenBSD-Commit-ID: 1052ab521505a4d8384d67acb3974ef81b8896cb
2021-01-30 11:58:31 +11:00
dtucker@openbsd.org
d1532d9007 upstream: Logical not bitwise or. ok djm@
OpenBSD-Commit-ID: d4dc855cf04951b93c45caa383e1ac9af0a3b0e5
2021-01-27 11:45:50 +11:00
dtucker@openbsd.org
e26c980778 upstream: Remove unused variables leftover from refactoring. ok
djm@

OpenBSD-Commit-ID: 8b3ad58bff828fcf874e54b2fc27a4cf1d9505e8
2021-01-26 22:50:40 +11:00
djm@openbsd.org
37c70ea8d4 upstream: refactor key constraint parsing in ssh-agent
Key constraints parsing code previously existed in both the "add regular
key" and "add smartcard key" path. This unifies them but also introduces
more consistency checking: duplicated constraints and constraints that
are nonsensical for a particular situation (e.g. FIDO provider for a
smartcard key) are now banned.

ok markus@

OpenBSD-Commit-ID: 511cb1b1c021ee1d51a4c2d649b937445de7983c
2021-01-26 12:21:48 +11:00
djm@openbsd.org
e0e8bee802 upstream: more ssh-agent refactoring
Allow confirm_key() to accept an additional reason suffix

Factor publickey userauth parsing out into its own function and allow
it to optionally return things it parsed out of the message to its
caller.

feedback/ok markus@

OpenBSD-Commit-ID: 29006515617d1aa2d8b85cd2bf667e849146477e
2021-01-26 12:21:48 +11:00
djm@openbsd.org
1fe16fd61b upstream: use recallocarray to allocate the agent sockets table;
also clear socket entries that are being marked as unused.

spinkle in some debug2() spam to make it easier to watch an agent
do its thing.

ok markus

OpenBSD-Commit-ID: 74582c8e82e96afea46f6c7b6813a429cbc75922
2021-01-26 12:21:48 +11:00
dtucker@openbsd.org
6d30673fed upstream: Change convtime() from returning long to returning int.
On platforms where sizeof(int) != sizeof(long), convtime could accept values
>MAX_INT which subsequently truncate when stored in an int during config
parsing.  bz#3250, ok djm@

OpenBSD-Commit-ID: 8fc932683d6b4660d52f50911d62bd6639c5db31
2021-01-11 15:04:12 +11:00
djm@openbsd.org
d5a0cd4fc4 upstream: when requesting a security key touch on stderr, inform the
user once the touch has been recorded; requested by claudio@ ok markus@

OpenBSD-Commit-ID: 3b76ee444490e546b9ea7f879e4092ee0d256233
2020-11-09 09:39:22 +11:00
djm@openbsd.org
816036f142 upstream: use the new variant log macros instead of prepending
__func__ and appending ssh_err(r) manually; ok markus@

OpenBSD-Commit-ID: 1f14b80bcfa85414b2a1a6ff714fb5362687ace8
2020-10-18 23:46:29 +11:00
djm@openbsd.org
396d32f3a1 upstream: There are lots of place where we want to redirect stdin,
stdout and/or stderr to /dev/null. Factor all these out to a single
stdfd_devnull() function that allows selection of which of these to redirect.
ok markus@

OpenBSD-Commit-ID: 3033ba5a4c47cacfd5def020d42cabc52fad3099
2020-10-03 19:34:24 +10:00
djm@openbsd.org
52a03e9fca upstream: handle multiple messages in a single read()
PR#183 by Dennis Kaarsemaker; feedback and ok markus@

OpenBSD-Commit-ID: 8570bb4d02d00cf70b98590716ea6a7d1cce68d1
2020-09-18 18:17:59 +10:00
djm@openbsd.org
9b8ad93824 upstream: support for user-verified FIDO keys
FIDO2 supports a notion of "user verification" where the user is
required to demonstrate their identity to the token before particular
operations (e.g. signing). Typically this is done by authenticating
themselves using a PIN that has been set on the token.

This adds support for generating and using user verified keys where
the verification happens via PIN (other options might be added in the
future, but none are in common use now). Practically, this adds
another key generation option "verify-required" that yields a key that
requires a PIN before each authentication.

feedback markus@ and Pedro Martelletto; ok markus@

OpenBSD-Commit-ID: 57fd461e4366f87c47502c5614ec08573e6d6a15
2020-08-27 11:28:36 +10:00
djm@openbsd.org
6d755706a0 upstream: some language improvements; ok markus
OpenBSD-Commit-ID: 939d787d571b4d5da50b3b721fd0b2ac236acaa8
2020-07-15 15:07:42 +10:00
jmc@openbsd.org
b659319a5b upstream: updated argument name for -P in first synopsis was
missed in previous;

OpenBSD-Commit-ID: 8d84dc3050469884ea91e29ee06a371713f2d0b7
2020-06-26 15:18:07 +10:00