1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 18:07:59 +00:00
Commit Graph

6666 Commits

Author SHA1 Message Date
Jacob Nevins
f79e69592a winpgnt: document --keylist and bulk ops. 2021-04-05 18:40:10 +01:00
Jacob Nevins
8592ab843c Pageant: docs / help for deferred decryption.
Also, ensure -E/--fptype in Unix Pageant is (correctly) documented
everywhere.
2021-04-05 18:39:40 +01:00
Jacob Nevins
909ab05b96 Pageant: Diagnose agent without protocol extensions.
Gives more helpful messages if Unix pageant ends up being a client for,
say, OpenSSH's ssh-agent, or indeed an older version of Pageant.

(Also, tweak a couple of other messages that still assumed that
pageant-as-client always talks to Pageant-as-agent.)
2021-04-05 18:02:13 +01:00
Jacob Nevins
569fc2681c Pageant: allow adding encrypted key to cleartext.
The protocol already allowed adding an encrypted form to a cleartext key
already held by the agent, and you might want to do so if, say, the key
happened to originally be added in cleartext-only form but you want to
be able to forget that with 'pageant -R' in future.
2021-04-05 18:02:13 +01:00
Jacob Nevins
70a31df9f1 Gtk: handle WM close on About box.
Previously this would prevent the About box ever being opened again.
2021-04-05 18:00:16 +01:00
Jacob Nevins
42e43376fc Unix pageant: handle askpass dialog close button.
Treat as aborting passphrase input. (Previously it would just hang.)
2021-04-05 18:00:16 +01:00
Jacob Nevins
d3249671a2 Fix palette-related segfault with Gtk<3.
This was introduced in ca9cd983e1.
2021-04-05 17:06:40 +01:00
Jacob Nevins
ec23a6b5f4 Restore ability to build with Gtk<3.
This got broken in 696550a5f2.
2021-04-05 17:06:37 +01:00
Jacob Nevins
b375177c67 Unix pageant usage: --foo-prompt not just for -a. 2021-04-05 14:36:04 +01:00
Jacob Nevins
2a65c8ef8c docs: rearrange protocols in the config section.
This makes their order match the configuration GUI, as of 18d273fcf1.

(No change to document content in this commit, just rearrangement.)
2021-04-05 14:35:43 +01:00
Simon Tatham
8edeecdcfd winpgnt: grey out key-list window buttons as appropriate.
Now the Remove button is disabled if there aren't any keys at all
loaded, and the Re-encrypt button is disabled if no key is currently
in a state where it's decrypted but re-encryptable.
2021-04-04 10:14:05 +01:00
Simon Tatham
b8374f1bdf winpgnt: menu options to delete/reencrypt everything.
Now the systray menu includes 'Remove All Keys' and 'Re-encrypt All
Keys' options, which do exactly what they say on the tin.
2021-04-04 10:02:24 +01:00
Simon Tatham
39a72c16cd winpgnt: fix accidental bisection of menu id definitions.
Not quite sure how that happened! But at some point in the past, a bunch
of other definitions in winpgnt.c managed to get in between the first
few IDM_FOO constants and the last few. Bring them all back together.
2021-04-04 09:51:35 +01:00
Simon Tatham
f5df09adb7 winpgnt: add GUI button to re-encrypt an SSH-2 key. 2021-04-04 09:44:00 +01:00
Simon Tatham
9e3d78bddb winpgnt: add context help for 'Add Key (encrypted)' button.
I wrote a docs section, but forgot to link it to the context help.
2021-04-04 09:35:27 +01:00
Simon Tatham
0f61291f80 pageant.rc: make a header file of dialog/control ids.
I'm tired of remembering all those fiddly magic numbers and copying
them back and forth between the .rc file and the source code. I'm even
more tired of having to remember that in the long string of numbers
after a dialog item definition, the first one of them _isn't_ one of
the position and size coordinates. I've given them all symbolic names,
like they should have had all along.

I think I originally didn't bother because this was such a small GUI
compared to the much larger one in PuTTY proper. But it's growing!
2021-04-04 09:28:46 +01:00
Simon Tatham
44c084f33f Windows Pageant: add --keylist option.
This causes the main key list window to open when Pageant starts up,
instead of waiting until you select 'View Keys' from the systray menu.

My main motivation for adding this option is for development: if I'm
_working_ on some detail of the key list window, it cuts down
keystrokes in my edit-compile-retry cycle if I can have it
automatically pop up in every new test run of Pageant.

Normally I'd solve that by hacking an extra couple of lines
temporarily into the code while I was doing that piece of development.
But it suddenly struck me that there's no reason _not_ to add an
option like this permanently (the space of word-length command-line
flags is huge, and that particular one is unlikely to be needed for a
different meaning), and who knows, it _might_ come in useful to
someone in normal use. And at the very least it'll save me doing
another temporary hack the next time I'm doing development work on the
Pageant GUI. So I'll leave it in.
2021-04-04 09:05:36 +01:00
Simon Tatham
c1334f3b08 Unix Pageant: revise --encrypted and -E CLI options.
I've decided that it was a mistake to use -E as the option for adding
keys encrypted, because it's better to use it as a fingerprint type
selector for the Pageant client side. That way it works the same as
command-line PuTTYgen, and also OpenSSH ssh-add (and ssh-keygen).

What spelling(s) to use instead for the option to add keys encrypted?
Obviously, the same ones I've just decided on for Windows Pageant;
there's no sensible reason to make them different.
2021-04-03 10:30:27 +01:00
Simon Tatham
bd5d80b4f6 Pageant: document deferred decryption. 2021-04-02 19:04:19 +01:00
Arthur Liberman
8c20514b8d Windows 10: add per monitor DPI awareness support.
On a system with 2 or more displays with different DPI settings,
moving the PuTTY window from one display to another will make Windows
resize the window using its "bitmap" strategy, stretching/compressing
the text, making it fuzzy and harder to read. This change makes PuTTY
resize its window and font size to accurately fit the DPI of the
display it is on.

We process the WM_DPICHANGED message, saving the new DPI, window size
and position. We proceed to then reset the window, recreating the
fonts using the new DPI and calculate the new window size and position
based on the new font size, user display options (ie. with/without
scrollbar) and the suggested window position provided by Windows. The
suggested window size is usually not a perfect fit, therefore we must
add a small offset to the new window position in order to avoid issues
with repeated DPI changes while dragging the window from one display
to another.
2021-04-02 19:04:19 +01:00
Simon Tatham
fc9fbfe1e4 gtk-askpass: add margins on left and right of the prompt.
If the prompt got big enough to reach to the edges of the dialog box,
it looked ugly without any margins. Previously I hadn't noticed,
because the prompt text was never that big.
2021-04-02 13:43:20 +01:00
Simon Tatham
e0bbe1e6c0 Refactor pageant_nth_ssh*_key.
I've merged the two previous functions, with different return types
per SSH version, into a single one that returns the containing
PageantKey instead of pulling out one of its internal fields.

This actually fixes a bug, though it would only have come up in the
Unix Pageant debugging mode: an encrypted-only key would have
terminated the key list in the diagnostic messages, because
pageant_nth_ssh2_key would have returned pk->skey which was NULL. Now
it returns pk itself, which isn't.
2021-04-02 13:43:20 +01:00
Simon Tatham
30c87c2896 Make unused Pageant accessor functions private.
We're no longer calling pageant_nth_ssh*_key or pageant_add_ssh*_key
from outside pageant.c. Remove them from pageant.h and turn them
static, so that we carry on not doing so.
2021-04-02 13:43:20 +01:00
Simon Tatham
fbab166728 winpgnt: fix GUI removal of encrypted keys.
The GUI loop that responded to the 'Remove Key' button in the key list
worked by actually trying to retrieve a pointer to the ssh_key for a
stored key, and then passing that back to the delete function. But
when a key is encrypted, that pointer is NULL, so we segfaulted.

Fixed by changing pageant_delete_ssh2_key() to take a numeric index in
the list instead of a key pointer.
2021-04-02 13:43:20 +01:00
Simon Tatham
b0f9e3a6ad winpgnt: GUI actions to add keys encrypted.
I've added a new option to the system tray menu, and a new button to
the key list window.
2021-04-02 13:43:20 +01:00
Simon Tatham
af6adb5c4b winpgnt: command-line option to add keys encrypted.
I couldn't quite decide whether to name the option 'encrypted' or
'no-decrypt', so I've supported both.
2021-04-02 13:43:20 +01:00
Simon Tatham
04390ff4a7 winpgnt: more rigorous command-line processing.
This makes Windows Pageant's slightly ad-hoc command-line handling a
bit more like a standard option loop: we start by deciding whether we
think any given argument _is_ an option or not, and if we think it is,
we give an error message if it's one we don't recognise.
2021-04-02 13:43:20 +01:00
Simon Tatham
efc31ee30d Polish up passphrase prompts for key decryption.
Now Windows Pageant has two clearly distinct dialog boxes for
requesting a key passphrase: one to use synchronously when the user
has just used the 'Add Key' GUI action, and one to use asynchronously
in response to an agent client's attempt to use a key that was loaded
encrypted.

Also fixed the wording in the asynchronous box: there were two copies
of the 'enter passphrase' instruction, one from the dialog definition
in pageant.rc file and one from the cross-platform pageant.c. Now
pageant.c doesn't format a whole user-facing message any more: it
leaves that to the platform front end to do it the way it wants.

I've also added a call to SetForegroundWindow, to try to get the
passphrase prompt into the foreground. In my experience this doesn't
actually get it the keyboard focus, which I think is deliberate on
Windows's part and there's nothing I can do about it. But at least the
user should _see_ that the prompt is there, so they can focus it
themself.
2021-04-02 13:43:20 +01:00
Simon Tatham
ceb645b042 winpgnt: mark encrypted/encryptable keys in GUI key list.
Now they have '(encrypted)' or '(re-encryptable)' after them, the same
as Unix Pageant.

Mostly this just involved tinkering with the code in winpgnt.c that
makes up the entry to put in the list box. But I also had to sprinkle
a few more calls to keylist_update() into the cross-platform
pageant.c, to make sure that the key list window is proactively
updated whenever a key is decrypted, re-encrypted, or loaded in
encrypted-only form.
2021-04-02 13:43:19 +01:00
Simon Tatham
c4dc78bd85 winpgnt: use pageant_enum_keys to update GUI key list.
The advantage of this API is that it gives us the extra flags saying
whether each key is encrypted or re-encryptable.

NFC: we don't yet do anything with that information, just make it
available for future work.
2021-04-02 13:43:19 +01:00
Jacob Nevins
443034090c Fix spurious printf format warnings with MinGW.
Correct MinGW format checking depends on the __MINGW_PRINTF_FORMAT
macro, which is defined in its stdio.h. cbfba7a0e9 moved the use of
that macro to before the inclusion of stdio.h, introducing spurious
"unknown conversion type character 'z'" and similar warnings.
2021-04-02 13:10:14 +01:00
Jacob Nevins
8c38e68e8b doc: document Windows hiding system tray icons. 2021-03-31 23:24:46 +01:00
Jacob Nevins
d3fccaf3db doc: index "notification area" as "system tray" 2021-03-31 23:21:51 +01:00
Jacob Nevins
3549e56194 Document multiple fingerprint formats. 2021-03-27 18:39:16 +00:00
Jacob Nevins
e09ca6ed76 Remove MD5 fingerprints from usage messages. 2021-03-27 18:39:16 +00:00
Jacob Nevins
7a91aa3822 pageant: Fix a usage message. 2021-03-27 18:36:18 +00:00
Jacob Nevins
467ea2b10b Acknowledge ssh-ed448 in Pageant docs. 2021-03-27 18:36:18 +00:00
Jacob Nevins
99c371d5ba Fix formatting errors in Plink docs. 2021-03-27 18:36:18 +00:00
Simon Tatham
049acf9ef5 Update references for Argon2.
The next version of the Internet-Draft for Argon2 has come out, and it
resolves the discrepancy between the Argon2i algorithm description and
the test vector.

The resolution is the same one I'd already guessed: the PDF in the
github repo, the C reference implementation in the same repo, and the
test vector in the I-D all agreed with each other, and only the
algorithm spec in the I-D disagreed with them all. The latter has been
corrected, so now all four sources agree with each other, and also
agree with my code.

So now everything is consistent and I don't have to have a comment
explaining which side I came down on.
2021-03-22 18:15:03 +00:00
Simon Tatham
66265d30f5 Switch default host key format to SHA256.
Finally! Now all the previous commits have put the infrastructure in
place to fall back to the old fingerprint if you need to, we can
switch to the new format without a total compatibility break.
2021-03-13 13:54:59 +00:00
Simon Tatham
99a3b0c380 GUI host key prompts: add 'More info' subdialog.
This behaves like the 'i' keystroke I just added to the console host
key prompts: it shows you all fingerprints and the full public key.
2021-03-13 13:54:59 +00:00
Simon Tatham
5612dfe419 GTK: add a callback to create_message_box.
This lets the caller of create_message_box modify the dialog in small
ways without having to repeat all the rest of the hard work as well.
2021-03-13 13:54:59 +00:00
Simon Tatham
1b1a91fa3d Console host key prompts: add 'more info' action.
Now you can press 'i' at the host key prompt, and it will print all
the key fingerprints we know about, plus the full public key. So if
you wanted to check against a fingerprint type that wasn't the one
shown in the default prompt, you can see all the ones we've got.
2021-03-13 13:54:59 +00:00
Simon Tatham
3461196197 Pass more information to interactive host key check.
Now we pass the whole set of fingerprints, and also a displayable
format for the full host public key.

NFC: this commit doesn't modify any of the host key prompts to _use_
any of the new information. That's coming next.
2021-03-13 13:54:59 +00:00
Simon Tatham
04758cb3ec Allow pre-storing host key fingerprints of all types.
verify_ssh_manual_host_key() now takes an array of all key
fingerprints instead of just the default type, which means that an
expected key fingerprint stored in the session configuration can now
be matched against any of them.
2021-03-13 13:54:59 +00:00
Simon Tatham
46b23c581a ssh2kex-client.c: get rid of s->fingerprint.
There's actually never any need to store a host key fingerprint in the
coroutine state. The only time we pass it outside the coroutine is
when it goes to verify_ssh_manual_host_key, which returns
synchronously without keeping a copy, and when it goes to
seat_verify_ssh_host_key. And in fact all current implementations of
the latter will keep their own copy of the fingerprint, even if
they're going to be asynchronous. So it's safe to free our copy
immediately seat_verify_ssh_host_key returns, even if it's launched an
async dialog box.

The corresponding code in SSH-1 was already working this way. Storing
the fingerprint in the SSH-2 coroutine state was overcautious all
along.
2021-03-13 11:01:35 +00:00
Simon Tatham
7cadad4cec Unix Pageant: support multiple fingerprint types.
The callback-function API in pageant.h for key enumeration is modified
so that we pass an array of all the available fingerprints for each
key.

In Unix Pageant, that's used by the -l option to print whichever
fingerprint the user asked for. (Unfortunately, the option name -E is
already taken, so for the moment I've called it --fptype. I may
revisit that later.)

Also, when matching a key by fingerprint, we're prepared to match
against any fingerprint type we know, with disambiguating prefixes if
necessary (e.g. you can match "md5🆎12" or "sha256:Ab12". That has
to be done a bit carefully, because we match MD5 hex fingerprints
case-insensitively, but SHA256 fingerprints are case-sensitive.
2021-03-13 11:01:35 +00:00
Simon Tatham
995e2f7164 Add API for getting all of a key's fingerprints.
ssh2_all_fingerprints() and friends will return a small 'char **'
array, containing all the fingerprints of a key that we know how to
generate, indexed by the FingerprintType enum. The result requires
complex freeing, so there's an ssh2_free_all_fingerprints as well.

For SSH-1 RSA keys, we refuse to generate any fingerprint except the
old SSH-1 MD5 version, because there's no other fingerprint type I
know of that anyone else uses. So I've got a function that returns the
same 'char **' for an SSH-1 key, but it only fills in the MD5 slot,
and leaves the rest NULL.

As a result, I also need a dynamic function that takes a fingerprint
list and returns the id of the most preferred fingerprint type in it
_that actually exists_.

NFC: this API is introduced, but not yet used.
2021-03-13 11:01:35 +00:00
Simon Tatham
911ead25e7 Windows Pageant: configurable fingerprint type.
There's now a drop-down list box below the key list, from which you
can select a fingerprint type. Also, like GUI PuTTYgen, I've widened
the key list window to make room for wider SHA256 fingerprints.
2021-03-13 11:01:35 +00:00
Simon Tatham
43d70071b3 Windows PuTTYgen: support configurable fingerprint type.
The fingerprint type shown in the PuTTYgen main dialog can now be
selected from the Key menu. Also, I've widened the dialog box, because
SHA256 fingerprints are wider than MD5 ones.

(In a fixed-pitch font, the fingerprint itself is slightly shorter -
43 base64 characters in place of 47 characters of colon-separated hex.
But the "SHA256:" prefix lengthens it, and also, in a non-fixed-pitch
font such as the default one in Windows dialogs, the colons are very
narrow, so the MD5 fingerprint has a far smaller pixel width.)
2021-03-13 11:01:35 +00:00