Reputation: 4301
My goal is to install my application to a folder:
I've tried various combinations and arrangements of the wix Permission
and PermissionEx
elements.
My latest attempt is this:
<CreateFolder>
<util:PermissionEx User="Users" GenericRead="no" Read="no"/>
<util:PermissionEx User="Everyone" GenericRead="no" Read="no"/>
<util:PermissionEx User="Administrators" GenericAll="yes"/>
</CreateFolder>
inside a Component
element.
My results are always the same: Users still show permission for Read, Read and Execute, and Listfolder contents on the installed folder.
My goal is quite similar to Restrict access to a folder installed using wix installer
I've also considered WIX: Giving Permissions to a folder and Wix: How to set permissions for folder and all sub folders.
Upvotes: 5
Views: 2896
Reputation: 42126
I am just wondering what your overall goal is (several options could apply):
As I am sure you are acutely aware of, modifying ACLs can have many side effects, especially deny rights (what happens during self-repair?). I don't have time to test specific ACLs right now, but I will check again tomorrow if you still need it. I think the require admin rights option might work for you?
Just want to add a quick way to test permissions that I discovered. Just modify the ACL permissions as desired in Windows Explorer. Then launch an elevated command prompt and navigate to the folder whose ACL you want to capture. Then go:
cacls.exe foldername /s
This should show a SDDL string that you can dump straight in WiX to use the new, built-in LockPermissionEx
table in MSI files (MSI 5 only!):
<Component Feature="ProductFeature">
<File Source="Files\Test.exe" />
<CreateFolder>
<PermissionEx Id="p1" Sddl="D:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a8;;;BU)" />
</CreateFolder>
</Component>
The above should yield a folder that has full access for SYSTEM, Administrators and "special access" for regular users (traverse folder / run file, read attributes, read extended attributes, read access). As stated below this does not work too well since administrators generally run non-elevated and then impersonate regular users (not 100% sure how this really works).
As you know there are many, different WiX elements that relate to permissioning (mid page), and you can also use custom actions to do permissioning (not recommended). Going to test a little bit more tomorrow. Maybe a combination of an elevated EXE with a protected data folder could work? Or maybe a way to make the triggering shortcut invoke elevation before the system tries to launch the file it points to without elevation.
UPDATE: Not much testing done today, but I got thinking about the list of possible options. Some of these options are just jotted down and not really viable. They are in to rule stuff out and to see if they could spark new and better ideas. Maybe 8
, 1
, 2
, 3
& 6
could be used? Maybe in combination?
Combo?: Super-hidden installation folder that is also ACL-locked and accessed by an always elevated EXE run from a mapped drive? (accessing an access-based enumeration server share?):
Make Folder Super-Hidden: this is probably a silly option. It depends on your use case and how protected these files must be? Are they just desired out of view, or do they have to be "locked" and inaccessible? You can set a super-hidden flag for your folder with a simple attrib command:
attrib +s +h "C:\Folder\"
The folder is now super-hidden like some core OS folders. Such a folder doesn't show up in Windows Explorer or in command line unless you take special steps to make it appear (show hidden OS files - see above link). But the folder is not locked for access if the users know the folder is there. Maybe you can combine the super-hidden flag with another approach? (hide the folder and lock it too?)
Access-Based Enumeration Server Share: this new server feature seems to be what you need actually. It hides folders that the user in question does not have access rights to, but I don't think the feature can be used on regular PCs (non servers). Perhaps it can? Something to check later. I don't know if storing files on a server share is an option or not?
Upvotes: 4
Reputation: 20780
If you can locate (or create) a folder with the permissions you need, I would first use CACLS.exe to display the permissions in the SDDL format. Once you've got that, you can use the MsiLockPermissionsEx table in your MSI.
WiX doesn't seem to support the MsiLockPermissionsEx table directly, in the sense that there doesn't seem to be a way to just paste in an SDDL string to apply to something, unless I've missed it somewhere.
Upvotes: 2