Skip to content
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

Add username context to kolide_pwpolicy #650

Merged
merged 3 commits into from
Sep 11, 2020

Conversation

terracatta
Copy link
Contributor

This PR adds the username context to the kolide_pwpolicy_table so that users of launcher can obtain the password policy for a specified username. If no username is specified the table behaves as it did before

This also fixes an issue where the first line of output from the usr/bin/pwpolicy binary is not valid XML and can occasionally cause the dataflatten library to fail to parse the plist (esp if that first line contains angle brackets)

Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty close :)

I think there are 2 paths we could take.

First, we could patch dataflattentable.TablePluginExec to handle the specialness this needs. (optional command line parameter, remove the first line of output). This is my general bias, as it seems useful later. However, these are also slower to get right.

Second, this could be updated to follow the more recent ioreg nested forloops. I think that's my current preferred pattern for these.

Happy to work with you either way. Though the first path still feels better

pkg/osquery/table/platform_tables_darwin.go Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Show resolved Hide resolved
@directionless
Copy link
Contributor

I think there are 2 paths we could take.

I thought about how to implement the first path -- expanding the generalized exec. I think it's pretty ugly. So I would recommend that we ditch that idea (sorry) and instead make this look more like ioreg.

@terracatta
Copy link
Contributor Author

terracatta commented Sep 9, 2020

So I would recommend that we ditch that idea (sorry) and instead make this look more like ioreg.

This work is now complete. Can you take another look?

pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
pkg/osquery/tables/pwpolicy/pwpolicy.go Outdated Show resolved Hide resolved
Co-authored-by: seph <seph@kolide.co>
@directionless directionless changed the title Add username context to kolide_pwpolicy_table Add username context to kolide_pwpolicy Sep 11, 2020
@directionless directionless merged commit 7ab5adf into kolide:master Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants