SMB3 POSIX and deleting files with FILE_ATTRIBUTE_READONLY
Subsystems (2)
Hi folks,
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has FILE_ATTRIBUTE_READONLY set?
The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted WRITE_ATTRIBUTES access.
Checking WRITE_ATTRIBUTES first means we would correctly honor permissions and the client could have removed FILE_ATTRIBUTE_READONLY anyway to then remove the file.
Windows has some new bits FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE to handle this locally (!) and it seems to be doing it without checking WRITE_ATTRIBUTES on the server.
Thoughts?
Thanks!
-slow
Quoted 10 lines · Ralph Boehme
Hi folks,
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.
I agree that to delete a file with READ_ONLY set should by default require WRITE_ATTRIBUTES (and delete) permission (better to be safe
in restricting a potential dangerous operation).
But this is a good question ...
Quoted 11 lines
Checking
WRITE_ATTRIBUTESfirst means we would correctly honor permissions and the client could have removedFILE_ATTRIBUTE_READONLYanyway to then remove the file.Windows has some new bits
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEto handle this locally (!) and it seems to be doing it without checkingWRITE_ATTRIBUTESon the server.Thoughts?
Signature · 3 lines
Thanks, Steve
Quoted 11 lines · Steve French
Quoted 7 lines · Ralph Boehme
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.I agree that to delete a file with
READ_ONLYset should by default requireWRITE_ATTRIBUTES(and delete)
delete will be checked the usual way, so nothing special there.
Quoted 2 lines
permission (better to be safe
in restricting a potential dangerous operation).
yes, that was my thought as well.
Quoted 2 lines
But this is a good question ...
That's why I brought it up :)))
Thanks!
-slow
Tom Talpey
reviewerQuoted 5 lines · Ralph Boehme
Quoted 4 lines · Steve French
Quoted 3 lines · Ralph Boehme
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.I agree that to delete a file with
READ_ONLYset should by default requireWRITE_ATTRIBUTES(and delete)
Since when does Posix require this?? All that's required is that the /directory/ is writable. The rm command will prompt if the /file/ is not writable, but the unlink(2) itself is not denied.
https://pubs.opengroup.org/onlinepubs/9799919799/
Tom.
Quoted 17 lines
delete will be checked the usual way, so nothing special there.
Quoted 2 lines
permission (better to be safe
in restricting a potential dangerous operation).yes, that was my thought as well.
Quoted 2 lines
But this is a good question ...
That's why I brought it up :)))
Thanks!
-slow
Quoted 11 lines · Tom Talpey
Quoted 10 lines · Ralph Boehme
Quoted 9 lines · Steve French
Quoted 7 lines · Ralph Boehme
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
I agree that to delete a file with
READ_ONLYset should by default requireWRITE_ATTRIBUTES(and delete)Since when does Posix require this??
Obviously it doesn't.
Let me try to ask it differently: do we want to relax Windows security model on a POSIX handle for this operation, even if we can build sane semantics into the protocol that doesn't require this?
Quoted 18 lines · Ralph Boehme
Quoted 16 lines · Tom Talpey
Quoted 14 lines · Ralph Boehme
Quoted 13 lines · Steve French
Quoted 8 lines · Ralph Boehme
what should be the behavior with SMB3 POSIX when a POSIX client tries to
delete a file that hasFILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.I agree that to delete a file with
READ_ONLYset should by default requireWRITE_ATTRIBUTES(and delete)
Quoted 7 lines
Quoted 1 line
Since when does Posix require this??
Obviously it doesn't.
Let me try to ask it differently: do we want to relax Windows security model on a POSIX handle for this operation, even if we can build sane semantics into the protocol that doesn't require this?
If in doubt, better to be "more secure" unless case is very strong to relax this check.
Signature · 3 lines
Thanks, Steve
Quoted 6 lines · Ralph Boehme
Hi folks,
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.
Quoted 7 lines
Checking
WRITE_ATTRIBUTESfirst means we would correctly honor permissions and the client could have removedFILE_ATTRIBUTE_READONLYanyway to then remove the file.Windows has some new bits
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEto handle this locally (!) and it seems to be doing it without checkingWRITE_ATTRIBUTESon the server.Thoughts?
Does Windows ever send FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE over the wire ? What happens if smbclient does ?
Quoted 2 lines · Jeremy Allison
Does Windows ever send
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEover the wire ?
No, it's local only, cf MS-FSCC and the thread "SMB2 DELETE vs UNLINK" on the Linux cifs mailing list.
Quoted 7 lines · Ralph Boehme
Quoted 2 lines · Jeremy Allison
Does Windows ever send
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEover the wire ?No, it's local only, cf MS-FSCC and the thread "SMB2 DELETE vs UNLINK" on the Linux cifs mailing list.
OK, but does the Windows SMB3 server filter it out ?
Can a Linux client send it over the wire and does
it have the desired effect ?
Quoted 10 lines · Jeremy Allison
Quoted 7 lines · Ralph Boehme
Quoted 2 lines · Jeremy Allison
Does Windows ever send
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEover the wire ?No, it's local only, cf MS-FSCC and the thread "SMB2 DELETE vs UNLINK" on the Linux cifs mailing list.
<https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms- fscc/4718fc40-e539-4014-8e33-b675af74e3e1>
OK, but does the Windows SMB3 server filter it out ?
yes.
Quoted 2 lines
Can a Linux client send it over the wire and does
it have the desired effect ?
no. Cf the thread I mentioned.
Thanks!
-slow
As discussed at SambaXP, what about this?
https://gitlab.com/samba-team/smb3-posix-spec/-/merge_requests/6/diffs
Quoted 16 lines · Ralph Boehme via samba-technical
Hi folks,
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.Checking
WRITE_ATTRIBUTESfirst means we would correctly honor permissions and the client could have removedFILE_ATTRIBUTE_READONLYanyway to then remove the file.Windows has some new bits
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEto handle this locally (!) and it seems to be doing it without checkingWRITE_ATTRIBUTESon the server.<https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms- fscc/2e860264-018a-47b3-8555-565a13b35a45>
Thoughts?
Thanks!
-slow
Looks fine to me
Quoted 32 lines · Ralph Boehme
As discussed at SambaXP, what about this?
https://gitlab.com/samba-team/smb3-posix-spec/-/merge_requests/6/diffs
Quoted 25 lines · Ralph Boehme via samba-technical
Hi folks,
what should be the behavior with SMB3 POSIX when a POSIX client tries to delete a file that has
FILE_ATTRIBUTE_READONLYset?The major question that we must answer is, if this we would want to allow for POSIX clients to ignore this in some way: either completely ignore it on POSIX handles or first check if the handle has requested and been granted
WRITE_ATTRIBUTESaccess.Checking
WRITE_ATTRIBUTESfirst means we would correctly honor permissions and the client could have removedFILE_ATTRIBUTE_READONLYanyway to then remove the file.Windows has some new bits
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTEto handle this locally (!) and it seems to be doing it without checkingWRITE_ATTRIBUTESon the server.<https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-
fscc/2e860264-018a-47b3-8555-565a13b35a45>Thoughts?
Thanks!
-slow
Signature · 3 lines
Thanks, Steve