[LU-13361] setregid or setreuid does not work as expected when cli2mdt SSK is on Created: 16/Mar/20  Updated: 15/May/20

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.12.3, Lustre 2.12.4
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Hans Henrik Happe Assignee: Sebastien Buisson
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Centos 7.7. ZFS on both MDTs and OSTs. TCP network.


Attachments: File test.c    
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

During tests of gocryptfs 1.7 I found that it didn't work on-top of Lustre with cli2mdt SSK. After a bit of tracing I found that after some setreuid/setregid calls it hadn't got permission to open files.

I've attached a test program that causes the issue. The 501 uid/gid is arbitrary, but it must be run in a directory with with the same uid/gid as chosen here.

When cli2mdt SSK is of it works as expected. When cli2mdt SSK is on it returns:

"open: Permission denied"

Cheers,
Hans Henrik



 Comments   
Comment by Sebastien Buisson [ 14/May/20 ]

Hi,

I am able to reproduce this behavior. It stems from the fact that when using SSK, Lustre makes use of the identity upcall that is defined for the MDT targets. You can check with the command:

# lctl get_param mdt.*.identity_upcall
mdt.lustre-MDT0000.identity_upcall=/usr/sbin/l_getidentity
mdt.lustre-MDT0001.identity_upcall=/usr/sbin/l_getidentity

By default, as shown above, l_getidentity is defined as the identity upcall. For it to handle permissions, you have to create a file named /etc/lustre/perm.conf on your MDS nodes, with the following syntax for each line:

permission file format is like this:
{nid} {uid} {perms}

'*' nid means any nid
'*' uid means any uid
the valid values for perms are:
setuid/setgid/setgrp		-- enable corresponding perm
nosetuid/nosetgid/nosetgrp	-- disable corresponding perm

In the case of your test program, you can insert a line with:

* 0 setuid,setgid

It will grant setuid and setgid permissions to user root, from any client node.

Once you have created the file, remember to flush the identity cache on your MDS nodes by doing:

lctl set_param mdt.*.identity_flush=-1

This way, new content in /etc/lustre/perm.conf will be taken into account.

Alternatively, you can disable identity upcall by doing:

lctl set_param mdt.*.identity_upcall=NONE

In this case, Lustre grants setuid, setgid and setgrp permissions.

Comment by Hans Henrik Happe [ 15/May/20 ]

Thanks Sebastien, that works for me.

I would love to help document this, but I'm not sure why there is a difference when turning on SSK?

Comment by Sebastien Buisson [ 15/May/20 ]

This is because when SSK is enabled, credentials checking is carried out a little bit differently on server side.

Generated at Sat Feb 10 03:00:37 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.