views:

53

answers:

1

I'm creating an FileSecurity for file creation that should have an write access also for low integrity processes.

FileSecurity fileAcl = new FileSecurity();

// add everyone
IdentityReference sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
FileSystemAccessRule rule = new FileSystemAccessRule(sid, FileSystemRights.FullControl, AccessControlType.Allow);
fileAcl.AddAccessRule(rule);

// add restricted
sid = new SecurityIdentifier(WellKnownSidType.RestrictedCodeSid, null);
rule = new FileSystemAccessRule(sid, FileSystemRights.FullControl, AccessControlType.Allow);
fileAcl.AddAccessRule(rule);

// add low integrity level rights

// ???

If someone knows how to do it without invoking C API I would appreciate it, otherwise I'll have to rework to use it entirely.

Thanks in advance

A: 

I don't know if they are exposed in .NET, but the integrity levels themselves are also well-known SIDs. You should also read the Mandatory Integrity Control documentation to understand how to use them.

Luke
Hi Luke,the sids are known, but the integrity labels are part of sacl, so cannot use the api exposed by MS that offeres to add parsed identities to dacl. I need the binary representation of acl so the more I think about it might be best way to include it as an array created in C app instead of creating it in .net.
Yakeen