Linux CIFS filesystem development
 help / color / mirror / Atom feed
* Using UPN with mount.cifs?
@ 2025-07-14 12:43 Till Dörges
  2025-07-14 17:23 ` Steve French
  0 siblings, 1 reply; 5+ messages in thread
From: Till Dörges @ 2025-07-14 12:43 UTC (permalink / raw)
  To: linux-cifs

Hello everyone,


I'm wondering whether it is possible to use User Principal Names (UPN) instead of 
accountnames + workgroup/domain, when mounting a share with mount.cifs?


The man page for mount.cifs does not mention UPN. A quick grep through the latest 
sources (cifs-utils-7.4) doesn't mention UPN either.

Searching the ML in particular and the web in general came up emtpy, too.


So, is there a way to do it?


Thanks and regards -- Till

-- 
Dipl.-Inform. Till Dörges                  doerges@pre-sense.de

                                         www.pre-sense.de/fcknzs

PRESENSE Technologies GmbH             Nagelsweg 41, D-20097 HH
Geschäftsführer/Managing Director        AG Hamburg, HRB 107844
Till Dörges                              USt-IdNr.: DE263765024

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using UPN with mount.cifs?
  2025-07-14 12:43 Using UPN with mount.cifs? Till Dörges
@ 2025-07-14 17:23 ` Steve French
  2025-07-15  5:59   ` Alexander Bokovoy
  0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2025-07-14 17:23 UTC (permalink / raw)
  To: Till Dörges; +Cc: linux-cifs, samba-technical

This is an interesting question.

mount.cifs will pass it (the UPN) down to cifs.ko so it will get sent
on the wire, so behavior will vary by server.

I tried it to current Samba (passing "username=testuser" and also
"username=testuser@somedomain" and also for
"username=testuser,domain=somedomain") and it worked fine for all
three cases (with and without UPN, with and without "domain=").

Trying it to Windows though:
1) "username=testuser" worked
2) "username=testuser,domain=somedomain"  worked
3) "username=testuser@somedomain"  did not work to Windows server

So looks like the behavior varies by server, but safest way is to
specify the UPN as "username=" and "domain=" rather than
username=someuser@somedomain

On Mon, Jul 14, 2025 at 7:44 AM Till Dörges <doerges@pre-sense.de> wrote:
>
> Hello everyone,
>
>
> I'm wondering whether it is possible to use User Principal Names (UPN) instead of
> accountnames + workgroup/domain, when mounting a share with mount.cifs?
>
>
> The man page for mount.cifs does not mention UPN. A quick grep through the latest
> sources (cifs-utils-7.4) doesn't mention UPN either.
>
> Searching the ML in particular and the web in general came up emtpy, too.
>
>
> So, is there a way to do it?
>
>
> Thanks and regards -- Till
>
> --
> Dipl.-Inform. Till Dörges                  doerges@pre-sense.de
>
>                                          www.pre-sense.de/fcknzs
>
> PRESENSE Technologies GmbH             Nagelsweg 41, D-20097 HH
> Geschäftsführer/Managing Director        AG Hamburg, HRB 107844
> Till Dörges                              USt-IdNr.: DE263765024
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using UPN with mount.cifs?
  2025-07-14 17:23 ` Steve French
@ 2025-07-15  5:59   ` Alexander Bokovoy
  2025-07-16  6:45     ` Till Dörges
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Bokovoy @ 2025-07-15  5:59 UTC (permalink / raw)
  To: Steve French; +Cc: Till Dörges, linux-cifs, samba-technical

On Пан, 14 ліп 2025, Steve French via samba-technical wrote:
> This is an interesting question.
> 
> mount.cifs will pass it (the UPN) down to cifs.ko so it will get sent
> on the wire, so behavior will vary by server.

Is this with GSSAPI krb5 or NTLMSSP?

For GSSAPI we either expect already existing credential or initialize it
from a keytab. In the first case cifs.upcall is not doing anything to
enable enteprise principal because it is not handling the initial ticket
acquisition. In the second case it doesn't do anything to mark the
client principal as an enteprise one.

The difference is by how that client principal is marked down in GSSAPI
negotiation. It needs two parts:

 - a client name should be an enterprise principal,
 - client code should make sure it sets a flag to accept rewrites of
   its own client principal name by the KDC in the returned ticket
   (principal canonicalization).

Neither is done by the cifs.upcall. More to that, for GSSAPI krb5 the
username passed to the cifs.upcall is pretty much ignored except for the
keytab initialization.

With NTLMSSP you don't really have 'enterprise principals', as it is up
to the SMB server to interpret the name you passed.

The client has nothing to indicate that. A server may consider
interpreting it as a local machine-provided one (username=testuser), or
consider to map it into the local one even if it has domain name
explicitly set (such as with IAKERB case on a standalone Windows).

> 
> I tried it to current Samba (passing "username=testuser" and also
> "username=testuser@somedomain" and also for
> "username=testuser,domain=somedomain") and it worked fine for all
> three cases (with and without UPN, with and without "domain=").
> 
> Trying it to Windows though:
> 1) "username=testuser" worked
> 2) "username=testuser,domain=somedomain"  worked
> 3) "username=testuser@somedomain"  did not work to Windows server
> 
> So looks like the behavior varies by server, but safest way is to
> specify the UPN as "username=" and "domain=" rather than
> username=someuser@somedomain
> 
> On Mon, Jul 14, 2025 at 7:44 AM Till Dörges <doerges@pre-sense.de> wrote:
> >
> > Hello everyone,
> >
> >
> > I'm wondering whether it is possible to use User Principal Names (UPN) instead of
> > accountnames + workgroup/domain, when mounting a share with mount.cifs?
> >
> >
> > The man page for mount.cifs does not mention UPN. A quick grep through the latest
> > sources (cifs-utils-7.4) doesn't mention UPN either.
> >
> > Searching the ML in particular and the web in general came up emtpy, too.
> >
> >
> > So, is there a way to do it?
> >
> >
> > Thanks and regards -- Till
> >
> > --
> > Dipl.-Inform. Till Dörges                  doerges@pre-sense.de
> >
> >                                          www.pre-sense.de/fcknzs
> >
> > PRESENSE Technologies GmbH             Nagelsweg 41, D-20097 HH
> > Geschäftsführer/Managing Director        AG Hamburg, HRB 107844
> > Till Dörges                              USt-IdNr.: DE263765024
> >
> 
> 
> -- 
> Thanks,
> 
> Steve
> 

-- 
/ Alexander Bokovoy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using UPN with mount.cifs?
  2025-07-15  5:59   ` Alexander Bokovoy
@ 2025-07-16  6:45     ` Till Dörges
       [not found]       ` <CAH2r5mvSEv1RGyjpsPg9s8auS5hb9sF4xVNUsetKf1ZkEXJnfA@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Till Dörges @ 2025-07-16  6:45 UTC (permalink / raw)
  To: Alexander Bokovoy, Steve French; +Cc: linux-cifs, samba-technical

Hello,

thanks for your answers.

In our setup we use NTLMSSP and a NetApp.

If I understand you correctly, mount.cifs basically cannot use the UPN to 
authenticate - or at least not reliably.

Simply splitting up the UPN (<user>@<domain>) for mount.cifs doesn't work either, 
because the SAM account name has a different domain and also a different username scheme.

Is there a canonical way (with Linux) to map a given UPN to its SAM account name?

Thanks -- Till


On 15.07.25 07:59, Alexander Bokovoy wrote:
> On Пан, 14 ліп 2025, Steve French via samba-technical wrote:
>> This is an interesting question.
>>
>> mount.cifs will pass it (the UPN) down to cifs.ko so it will get sent
>> on the wire, so behavior will vary by server.
> 
> Is this with GSSAPI krb5 or NTLMSSP?
> 
> For GSSAPI we either expect already existing credential or initialize it
> from a keytab. In the first case cifs.upcall is not doing anything to
> enable enteprise principal because it is not handling the initial ticket
> acquisition. In the second case it doesn't do anything to mark the
> client principal as an enteprise one.
> 
> The difference is by how that client principal is marked down in GSSAPI
> negotiation. It needs two parts:
> 
>   - a client name should be an enterprise principal,
>   - client code should make sure it sets a flag to accept rewrites of
>     its own client principal name by the KDC in the returned ticket
>     (principal canonicalization).
> 
> Neither is done by the cifs.upcall. More to that, for GSSAPI krb5 the
> username passed to the cifs.upcall is pretty much ignored except for the
> keytab initialization.
> 
> With NTLMSSP you don't really have 'enterprise principals', as it is up
> to the SMB server to interpret the name you passed.
> 
> The client has nothing to indicate that. A server may consider
> interpreting it as a local machine-provided one (username=testuser), or
> consider to map it into the local one even if it has domain name
> explicitly set (such as with IAKERB case on a standalone Windows).
> 
>>
>> I tried it to current Samba (passing "username=testuser" and also
>> "username=testuser@somedomain" and also for
>> "username=testuser,domain=somedomain") and it worked fine for all
>> three cases (with and without UPN, with and without "domain=").
>>
>> Trying it to Windows though:
>> 1) "username=testuser" worked
>> 2) "username=testuser,domain=somedomain"  worked
>> 3) "username=testuser@somedomain"  did not work to Windows server
>>
>> So looks like the behavior varies by server, but safest way is to
>> specify the UPN as "username=" and "domain=" rather than
>> username=someuser@somedomain
>>
>> On Mon, Jul 14, 2025 at 7:44 AM Till Dörges <doerges@pre-sense.de> wrote:
>>>
>>> Hello everyone,
>>>
>>>
>>> I'm wondering whether it is possible to use User Principal Names (UPN) instead of
>>> accountnames + workgroup/domain, when mounting a share with mount.cifs?
>>>
>>>
>>> The man page for mount.cifs does not mention UPN. A quick grep through the latest
>>> sources (cifs-utils-7.4) doesn't mention UPN either.
>>>
>>> Searching the ML in particular and the web in general came up emtpy, too.
>>>
>>>
>>> So, is there a way to do it?
>>>
>>>
>>> Thanks and regards -- Till
>>>
>>> --
>>>                                           www.pre-sense.de/fcknzs
>>>
>>> PRESENSE Technologies GmbH             Nagelsweg 41, D-20097 HH
>>> Geschäftsführer/Managing Director        AG Hamburg, HRB 107844
>>> Till Dörges                              USt-IdNr.: DE263765024
>>>
>>
>>
>> -- 
>> Thanks,
>>
>> Steve
>>
> 
-- 
                                         www.pre-sense.de/fcknzs

PRESENSE Technologies GmbH             Nagelsweg 41, D-20097 HH
Geschäftsführer/Managing Director        AG Hamburg, HRB 107844
Till Dörges                              USt-IdNr.: DE263765024

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using UPN with mount.cifs?
       [not found]       ` <CAH2r5mvSEv1RGyjpsPg9s8auS5hb9sF4xVNUsetKf1ZkEXJnfA@mail.gmail.com>
@ 2025-07-17  8:15         ` Till Dörges
  0 siblings, 0 replies; 5+ messages in thread
From: Till Dörges @ 2025-07-17  8:15 UTC (permalink / raw)
  To: Steve French; +Cc: Alexander Bokovoy, linux-cifs, samba-technical

On 16.07.25 19:28, Steve French wrote:

> but obviously it is better to resolve the upn to the correct domain and pass in the 
> domain

Which brings me back to the question, how to do this resolving under Linux? ;-)

Thanks and regards -- Till
-- 
                                         www.pre-sense.de/fcknzs

PRESENSE Technologies GmbH             Nagelsweg 41, D-20097 HH
Geschäftsführer/Managing Director        AG Hamburg, HRB 107844
Till Dörges                              USt-IdNr.: DE263765024

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-17  8:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 12:43 Using UPN with mount.cifs? Till Dörges
2025-07-14 17:23 ` Steve French
2025-07-15  5:59   ` Alexander Bokovoy
2025-07-16  6:45     ` Till Dörges
     [not found]       ` <CAH2r5mvSEv1RGyjpsPg9s8auS5hb9sF4xVNUsetKf1ZkEXJnfA@mail.gmail.com>
2025-07-17  8:15         ` Till Dörges

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox