summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh-keygen.c
AgeCommit message (Collapse)Author
2020-06-26Defer creation of ~/.ssh by ssh(1) until we attempt to write to it so weDarren Tucker
don't leave an empty .ssh directory when it's not needed. Use the same function to replace the code in ssh-keygen that does the same thing. bz#3156, ok djm@
2020-05-29fix exit status for downloading of FIDO resident keys; fromDamien Miller
Pedro Martelletto, ok markus@
2020-05-18avoid possible NULL deref; from Pedro MartellettoDamien Miller
2020-05-13preserve group/world read permission on known_hosts file across runs ofDamien Miller
"ssh-keygen -Rf /path". The old behaviour was to remove all rights for group/other. bz#3146 ok dtucker@
2020-05-02we have a sshkey_save_public() function to save public keys; use itDamien Miller
and save a bunch of redundant code. Patch from loic AT venez.fr; ok markus@ djm@
2020-05-01avoid NULL dereference when attempting to convert invalid ssh.comDamien Miller
private keys using "ssh-keygen -i"; spotted by Michael Forney
2020-04-20fix a bug I introduced in r1.406: when printing private key fingerprintDamien Miller
of old-format key, key comments were not being displayed. Spotted by loic AT venez.fr, ok dtucker
2020-04-17repair private key fingerprint printing to also print comment afterDamien Miller
regression caused by my recent pubkey loading refactor. Reported by loic AT venez.fr, ok dtucker@
2020-04-03give ssh-keygen the ability to dump the contents of a binary keyDamien Miller
revocation list: ssh-keygen -lQf /path bz#3132; ok dtucker
2020-03-13spelling errors in comments; no code changeDamien Miller
from https://fossies.org/linux/misc/openssh-8.2p1.tar.gz/codespell.html
2020-03-13when downloading FIDO2 resident keys from a token, don't prompt for a PINDamien Miller
until the token has told us that it needs one. Avoids double-prompting on devices that implement on-device authentication (e.g. a touchscreen PIN pad on the Trezor Model T). ok dtucker@
2020-03-06fix use-after-free in do_download_sk; ok djmMarkus Friedl
2020-03-06exit if ssh_krl_revoke_key_sha256 fails; ok djmMarkus Friedl
2020-02-28no-touch-required certificate option should be an extension, notDamien Miller
a critical option.
2020-02-26change explicit_bzero();free() to freezero()Jonathan Gray
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@
2020-02-07fix two PIN entry bugs on FIDO keygen: 1) it would allow more than theDamien Miller
intended number of prompts (3) and 2) it would SEGV too many incorrect PINs were entered; based on patch by Gabriel Kihlman
2020-02-06Replace "security key" with "authenticator" in program messages.Christian Weisgerber
This replaces "security key" in error/usage/verbose messages and distinguishes between "authenticator" and "authenticator-hosted key". ok djm@
2020-02-04require FIDO application strings to start with "ssh:"; ok markus@Damien Miller
2020-01-28changes to support FIDO attestationDamien Miller
Allow writing to disk the attestation certificate that is generated by the FIDO token at key enrollment time. These certificates may be used by an out-of-band workflow to prove that a particular key is held in trustworthy hardware. Allow passing in a challenge that will be sent to the card during key enrollment. These are needed to build an attestation workflow that resists replay attacks. ok markus@
2020-01-25improve the error message for u2f enrollment errors by makingDamien Miller
ssh-keygen be solely responsible for printing the error message and convertint some more common error responses from the middleware to a useful ssherr.h status code. more detail remains visible via -v of course. also remove indepedent copy of sk-api.h declarations in sk-usbhid.c and just include it. feedback & ok markus@
2020-01-25factor out reading/writing sshbufs to dedicated functions;Damien Miller
feedback and ok markus@
2020-01-25expose PKCS#11 key labels/X.509 subjects as commentsDamien Miller
Extract the key label or X.509 subject string when PKCS#11 keys are retrieved from the token and plumb this through to places where it may be used as a comment. based on https://github.com/openssh/openssh-portable/pull/138 by Danielle Church feedback and ok markus@
2020-01-24minor tweaks to ssh-keygen -Y find-principals:Damien Miller
emit matched principals one per line to stdout rather than as comma- separated and with a free-text preamble (easy confusion opportunity) emit "not found" error to stderr fix up argument testing for -Y operations and improve error message for unsupported operations
2020-01-24when signing a certificate with an RSA key, default to a safe signatureDamien Miller
algorithm (rsa-sha-512) if not is explicitly specified by the user; ok markus@
2020-01-24allow PEM export of DSA and ECDSA keys; bz3091, patch from Jakub JelenDamien Miller
ok markus@
2020-01-23ssh-keygen -Y find-principals fixes based on feedback from Markus:Damien Miller
use "principals" instead of principal, as allowed_signers lines may list multiple. When the signing key is a certificate, emit only principals that match the certificate principal list. NB. the command -Y name changes: "find-principal" => "find-principals" ok markus@
2020-01-23remove trailing period characters from pub/priv key pathnames -Damien Miller
they make them needlessly more difficult to cut and paste without error; ok markus@ & dtucker@
2020-01-23add a new signature operations "find-principal" to look up theDamien Miller
principal associated with a signature from an allowed-signers file. Work by Sebastian Kinne; ok dtucker@
2020-01-22For ssh-keygen -lF only add a space after key fingerprint when there is aClaudio Jeker
comment. This makes copy-paste of fingerprints into ssh easier. OK djm@
2020-01-21don't #ifdef out the KRL code when compiling without libcryptoDamien Miller
support; it works just fine and disabling it breaks a few tests. ok dtucker@
2020-01-14sync ssh-keygen.1 and ssh-keygen's usage() with each other and realityChristian Weisgerber
ok markus@
2020-01-06Extends the SK API to accept a set of key/value options for allDamien Miller
operations. These are intended to future-proof the API a little by making it easier to specify additional fields for without having to change the API version for each. At present, only two options are defined: one to explicitly specify the device for an operation (rather than accepting the middleware's autoselection) and another to specify the FIDO2 username that may be used when generating a resident key. These new options may be invoked at key generation time via ssh-keygen -O This also implements a suggestion from Markus to avoid "int" in favour of uint32_t for the algorithm argument in the API, to make implementation of ssh-sk-client/helper a little easier. feedback, fixes and ok markus@
2020-01-02ability to download FIDO2 resident keys from a token viaDamien Miller
"ssh-keygen -K". This will save public/private keys into the current directory. This is handy if you move a token between hosts. feedback & ok markus@
2019-12-30Remove the -x option currently used for FIDO/U2F-specific key flags.Damien Miller
Instead these flags may be specified via -O. ok markus@
2019-12-30translate and return error codes; retry on bad PINDamien Miller
Define some well-known error codes in the SK API and pass them back via ssh-sk-helper. Use the new "wrong PIN" error code to retry PIN prompting during ssh-keygen of resident keys. feedback and ok markus@
2019-12-30SK API and sk-helper error/PIN passingDamien Miller
Allow passing a PIN via the SK API (API major crank) and let the ssh-sk-helper API follow. Also enhance the ssh-sk-helper API to support passing back an error code instead of a complete reply. Will be used to signal "wrong PIN", etc. feedback and ok markus@
2019-12-30basic support for generating FIDO2 resident keysDamien Miller
"ssh-keygen -t ecdsa-sk|ed25519-sk -x resident" will generate a device-resident key. feedback and ok markus@
2019-12-30remove single-letter flags for moduli optionsDamien Miller
Move all moduli generation options to live under the -O flag. Frees up seven single-letter flags. NB. this change break existing ssh-keygen commandline syntax for moduli- related operations. Very few people use these fortunately. feedback and ok markus@
2019-12-30prepare for use of ssh-keygen -O flag beyond certsDamien Miller
Move list of available certificate options in ssh-keygen.1 to the CERTIFICATES section. Collect options specified by -O but delay parsing/validation of certificate options until we're sure that we're acting as a CA. ok markus@
2019-12-10when acting as a CA and using a security key as the CA key, remind theDamien Miller
user to touch they key to authorise the signature.
2019-11-25Print a key touch reminder when generating a security key. Most keysDamien Miller
require a touch to authorize the operation.
2019-11-25allow "ssh-keygen -x no-touch-required" when generating a security keyDamien Miller
keypair to request one that does not require a touch for each authentication attempt. The default remains to require touch. feedback deraadt; ok markus@
2019-11-25add a "no-touch-required" option for authorized_keys and a similarDamien Miller
extension for certificates. This option disables the default requirement that security key signatures attest that the user touched their key to authorize them. feedback deraadt, ok markus
2019-11-25Add new structure for signature optionsDamien Miller
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@
2019-11-18more missing mentions of ed25519-sk; ok djm@Christian Weisgerber
2019-11-18additional missing stdarg.h includes when built without WITH_OPENSSL; ok djm@Christian Weisgerber
2019-11-18Fix incorrect error message when key certification failsDamien Miller
2019-11-18allow *-sk key types to be turned into certificatesDamien Miller
2019-11-18missing break in getopt switch; spotted by Sebastian KinneDamien Miller
2019-11-14directly support U2F/FIDO2 security keys in OpenSSH by linkingDamien Miller
against the (previously external) USB HID middleware. The dlopen() capability still exists for alternate middlewares, e.g. for Bluetooth, NFC and test/debugging.