[PATCH net-next v3 00/10] Deliver TLS session tags to upper-layer consumers (NFSD)
Chuck Lever
cel at kernel.org
Fri Nov 27 08:30:12 PST 2026
On Sat, Nov 21, 2026, at 7:13 PM, Jakub Kicinski wrote:
> On Fri, 13 Nov 2026 14:21:58 -0500 Chuck Lever wrote:
>> NFSD controls remote access to its exports today by IP address and
>> hostname. Neither of these are cryptographically secure. For
>> instance, a MitM can replace the response to a server's plaintext
>> DNS query. As a result, a malicious NFS client can pretend to be a
>> client whose hostname matches one that has access to exports it
>> would otherwise be denied access to.
>>
>> So instead, we want access-control decisions to be based on
>> cryptographically-vetted objects such as TLS peer-certificates.
>> In-kernel x.509 parsing would duplicate work mature userspace
>> libraries already do, so let's make tlshd evaluate peer certificates
>> in user space.
>>
>> The certificates are evaluated against admin-defined policy, such
>> as whether the certificate's Issuer matches a particular string.
>> tlshd then marks NFS TLS sessions with those policy matches. Admins
>> also provide a set of policy names on each NFSD export (allow_tags).
>> Computing the intersection with these per-export tags is quick and
>> completely separate from the details of parsing x.509 certificates.
>>
>> A yet-to-be-posted patch series introduces tag set support to the
>> exportfs command in nfs-utils. tlshd 1.5.0, current as of this
>> writing, already implements TLS session tagging.
> The patches look reasonable to me, overall. At a high level tho -
> I don't have any familiarity with "tag" based policies.
> Are you confident it's flexible and convenient enough to survive
> as uAPI?
>
> Naively I'd think it creates unnecessarily wide API on both ends
> (handshake and server). My knee jerk design would be to populate
> the full policy in the server, and only carry some "policy ID"
> thru the handshake. Number of policy IDs would equal to the number
> of tag combinations (which result in different behavior).
>
> Any examples of APIs like the one you're adding working well?
Here are a few similar mechanisms that are deployed and working.
1. OpenSSH certificate principals. A CA-signed certificate carries
a set of principal names. AuthorizedPrincipalsFile lists the
names a target accepts, and access is granted if any principal
in the certificate matches a line. That is exactly the
non-empty-intersection rule. AuthorizedPrincipalsCommand
computes the set in user space, which is the role tlshd plays
here. The difference is that principals are minted when the
certificate is issued, not mapped by a local policy at handshake
time. [3]
2. AWS IAM Roles Anywhere. It maps X.509 Subject/Issuer/SAN fields
into session principal tags, such as aws:PrincipalTag/x509Subject/OU,
through a per-profile attribute mapping. Resource and trust policies
then condition on those tags. It even uses the name "session tags",
and the certificate-to-tags step is configured separately from the
resource policy, as in your design. The differences: AWS tags are
key/value pairs, and the policy language is richer than set
intersection. [1], [2]
3. Kerberos PAC group SIDs (AD, Samba, SMB). The KDC, a separate
component, resolves identity into a set of group SIDs carried in
the ticket. The file server grants access by intersecting that set
with the resource ACL and never sees how membership was decided.
Linux credentials already work this way: supplementary groups and
the AUTH_SYS gid list are a set of IDs in the credential checked
against the object. The kernel already enforces
"set in the session ∩ set on the resource".
The policy-ID model you mentioned looks a lot like labeled IPsec
(XFRMA_SEC_CTX). The IKE daemon puts a single security context on
the SA, and an LSM enforces it.
The kernel already does only mechanical enforcement (intersection).
Policy IDs make the problem bigger, not smaller, IMHO. One ID per
combination of tags that behaves differently, the combinations grow
combinatorially. Policy IDs also force one compiler that knows both
the certificate rules and every export, which joins together the two
independently managed configs that tags keep apart.
So, we could:
- Rename tags "group memberships" in the cover letter and documentation,
since that is the term PAC, SSH and AWS deployments use.
- Pin the string format in the uAPI by specifying a character set,
maximum length and the existing cap, with any other format rejected
at the DONE downcall. Optionally, reserve a prefix: namespace so other
upper-layer protocols (NVMe) can't collide with NFS tags.
- Clarify in the series cover letter that the kernel only intersects and
group/tag policy is handled in user space.
Lastly, I haven't found a perfect fit for security policy reviewers, but
these come close:
Cc: linux-security-module at vger.kernel.org
Cc: Paul Moore <paul at paul-moore.com>
--
Chuck Lever
[1] IAM Roles Anywhere: certificate attribute mapping (https://docs.aws.amazon.com/rolesanywhere/latest/userguide/attribute-mapping.html)
[2] IAM Roles Anywhere: attribute mapping and trust policy
(https://docs.aws.amazon.com/rolesanywhere/latest/userguide/attribute-mapping-and-trust-policy.html)
[3] openssh-unix-dev: AuthorizedPrincipalsFile (2010) (https://lists.mindrot.org/pipermail/openssh-unix-dev/2010-October/029012.html)
- GitLab: AuthorizedPrincipalsCommand (https://docs.gitlab.com/administration/operations/ssh_certificates/)
More information about the Linux-nvme
mailing list