public inbox for kernel-tls-handshake@lists.linux.dev
 help / color / mirror / Atom feed
From: Ken Milmore <ken.milmore@gmail.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: kernel-tls-handshake@lists.linux.dev
Subject: Re: [PATCH 1/7] tlshd_handshake_parms: Dispense with unnecessary dynamic storage for peerids.
Date: Sat, 14 Jun 2025 00:09:16 +0100	[thread overview]
Message-ID: <07ebad41-0c74-4fc0-9e34-d2dc959a1d7b@gmail.com> (raw)
In-Reply-To: <3ece0818-4347-41f7-8016-84c9c4ceda0d@oracle.com>

On 13/06/2025 22:42, Chuck Lever wrote:
> I think server-side tlshd should /always/ check a client's source IP
> address when IP addresses are listed in the presented certificate's SAN
> field. No new configuration option is needed, I will test to make sure
> all of that is working as we expect.

See my comment below re patch 7 for a possible banana skin.

> The two changes I'm still equivocating on are:
> 
> 1. [PATCH 5/7] server: Add boolean config option "verify_peername" under
>    "[authenticate.server]"
> 
>    I'm not comfortable adding a DNS query. There's no way for tlshd to
>    confirm that the query results are trustworthy, and it will add an
>    indeterminate latency to every handshake.

But note that the existing code already performs a reverse DNS query in order
to obtain a host name from the peer address for logging purposes, so there is
already an indeterminate latency cost.

The forward DNS lookup is a standard practice for increasing the relibility
of a name obtained by reverse lookup, as here. I agree there are ways that
this can be subverted in general cases, but that is true of x.509 with DNS in
general. The present code doesn't perform any additional checks on the
certificate SAN at all.

>    IIRC, tlshd used to perform a query like this, and we were asked to
>    remove it by our security reviewers.

Fair enough, but I would be interested to know where the security risk comes
from. AFAICT, providing a (forward-confirmed) host name for verification against
the certificate can only reduce the scenarios in which the certificate gets accepted,
it cannot increase them. That is to say, if a certificate is rejected by the existing
code without any name check, it will continue to be rejected with the patch applied.
If I'm wrong on this point, I'd be grateful for a citation I can follow up.

The only downside I can think of is that enabling this check may create a false
sense of security (which was never there in the first place), if the admin does
not understand the implications.

That's not to say I don't think that tagging sounds like a better solution,
although given the widest use of x.509 certs is effectively to verify DNS host
names I'm slightly surprised that you don't want to support DNS at all.

Note that the client code *does* already pass the supplied host name to GnuTLS
for verification, so we have a situation where the server name matters on the client
but not vice versa. I was attempting to redress this asymmetry a little.

Checking client names on the server this way will be no good in general internet
situations with NAT, proxies etc (where the client certificate is always likely to
be rejected), but is potentially very useful for adding additional security in a
controlled LAN or VPN situation.

> 2. [PATCH 7/7] client: Add boolean config option "relax_sni" under
>    "[authenticate.client]"
> 
>    I haven't looked closely at this one yet, but I suspect it's
>    nearly the same as the deprecated "-n" option, which was too
>    insecure to be allowed to remain alive.

The documentation for gnutls_server_name_set() states that "IPv4 or IPv6
addresses are not permitted to be set by this function". So if the client
peer address is actually a numeric IP address, surely we should not be calling
this function regardless?

In particular, if you are using certificates with IP addresses in the SAN,
and you are validating those on the server, (as you mention above), I suspect the
certificate will always be rejected regardless of validity. I haven't tested such
cases extensively, so I'm open to correction on this. Once I read the
documentation for gnutls_server_name_set() I realised it should never be given a
hostname containing a numeric IP address regardless of the situation.

> I am working on implementing tagging for x.509 certificates. I found
> other software products that do something similar, so we are on the
> right track with this approach. But it's actually quite a complex
> undertaking, due to the variety of information that can be carried in a
> certificate. Stay tuned.

I really look forward to it!

I'm glad that someone has finally taken this up: A means of securing NFS properly
without Kerberos is *very* long overdue. Was it 15 years or more ago now that
SKPM/LIPKEY was about to be supported but then never made it to fruition? So I
really hope you achieve it this time.

Best wishes,

Ken.


  reply	other threads:[~2025-06-13 23:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-08 17:42 [PATCH 1/7] tlshd_handshake_parms: Dispense with unnecessary dynamic storage for peerids Ken Milmore
2025-06-08 18:03 ` Chuck Lever
2025-06-08 19:08   ` Ken Milmore
2025-06-09 16:08     ` Chuck Lever
2025-06-13 21:42 ` Chuck Lever
2025-06-13 23:09   ` Ken Milmore [this message]
2025-06-14  0:40     ` Chuck Lever
2025-06-14  2:03       ` Ken Milmore
2025-06-18 13:42   ` Chuck Lever
2025-06-18 15:03     ` Ken Milmore
2025-06-18 16:00       ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07ebad41-0c74-4fc0-9e34-d2dc959a1d7b@gmail.com \
    --to=ken.milmore@gmail.com \
    --cc=chuck.lever@oracle.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox