-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win_lgpo: Support managing arbitrary registry key/value/data actions in Registry.pol #56013
Comments
hiya @lomeroe, any thoughts on this? |
Another use case is when working with an existing registry.pol file, such as from a group policy backup or the Microsoft Security Compliance Toolkit (which is mostly a group policy backup). We want to convert these registry.pol files from the binary format to text so it's diff-able and appropriate for source control. Using the LGPO.exe tool that Microsoft publishes with the SCT, it can read the registry.pol and output the contents to a basic ini format, looking something like this for a single entry:
Trying to convert that to something this win_lgpo.py module supports is rather confusing. It's not If you search the admx you just get this, and it's not
If you open up the admx you can see the whole policy, which then gives you the "name" |
seems reasonable, I don't think it would be too difficult for someone to add this feature |
I didn't think it would be hard, but then I started digging into it, and this code is... dense. Turning out to be rather hard for me to figure out where exactly to fit it in. I was actually thinking it would be easier to just ignore the adml/admx stuff if a user provides the registry paths. Just write out whatever they provide to registry.pol. The comparison and change detection might need some extra thought with that approach though. So I'm kinda taking this route on my own for now, just updating our custom execution module to re-use some of the private functions in salt's lgpo module... |
While re-implementing our custom execution module to utilize the built-in lgpo functionality as much as possible, I realized that my original ask here is not really what we need... We want to be able to set any, arbitrary registry key/value/data via the Here is where we implemented our wrapping custom execution module... We also discovered a number of bugs in various
There's also a bug around DELETE policies, which @twangboy beat me to fixing in master, albeit a much different way than I did it. There were also some, we'll say, differences in stylistic preferences. Like, comparing policy names in a case-insensitive way. And allowing the policy name from a secedit ini file instead of the policy name used by the NetUserModal functions. Those are not necessarily bugs, but could be considered separate feature requests. |
key
and valueName
to specify ADML/ADMX paths
@lorengordon I've put very little testing into this other than a quick "does it work" (0 regression testing/etc), hopefully it captures what you're thinking...I only took a quick glance at your custom module code... This function should add data to the registry.pol file, but requires the
Adding an arbitrary registry entry:
Deleting an arbitrary value
Delete all values under a key
I seriously spent about 30 minutes on this, so it could totally bork things up :) but maybe gets you in the right direction |
I think this approach could help with some of the localization issues we're having as the registry isn't localized. I think I'm going to take a stab at this. Probably steal your code @lomeroe |
Description of Issue
At the moment, the
lgpo
module uses the policyname
orid
(plus path) to identify a distinct item in the ADML/ADMX files. We would like to use thekey
andvalueName
if we can. This is convenient because it directly indicates where in the registry the setting is configured (ultimately), and interfacing with the registry is rather easier than gpedit.msc. Also, DISA SCAP benchmarks reference the registry key/valueName in scan findings, so supporting key/valueName would make it very easy to take a scan and create/update a policy.To pull an example from the docs:
This entry has 3 policy aliases today:
I'm basically asking that the
key
andvalueName
from the xml entry also be supported,key="Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" valueName="NoOnlinePrintsWizard"
The text was updated successfully, but these errors were encountered: