UpdateHostkeys now enabled by default

Damien Miller
Thu, 08 Oct 2020 00:55:12 -0000

On Wed, 7 Oct 2020, Christian Weisgerber wrote:

> On 2020-10-03, Damien Miller <djm at mindrot.org> wrote:
>
> > I just fixed a couple of corner-cases relating to UpdateHostkeys in
git
> > HEAD and have enabled the option by default.
>
> I'm struggling to understand under which conditions this adds/changes
> entries in ~/.ssh/known_hosts.
>
> So far it always fails with "wildcard known hosts name found,
> skipping UserKnownHostsFile update".

ah, that's a bug

diff --git a/clientloop.c b/clientloop.c
index 0b27991..8d21b20 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1858,9 +1858,9 @@ hostkeys_find(struct hostkey_foreach_line *l, void *_ctx)

 	/* UpdateHostkeys is skipped for wildcard host names */
 	if (strchr(l->hosts, '*') != NULL ||
-	    strchr(l->hosts, ',') != NULL) {
-		debug3("%s: hostkeys file %s:%ld contains wildcard or pattern",
-		     __func__, l->path, l->linenum);
+	    strchr(l->hosts, '?') != NULL) {
+		debug3("%s: hostkeys file %s:%ld contains wildcard", __func__,
+		    l->path, l->linenum);
 		ctx->wildcard_hostspec = 1;
 	}