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 func to exclude launcher db from time machine #1531

Conversation

James-Pickett
Copy link
Contributor

No description provided.

@James-Pickett James-Pickett marked this pull request as ready for review January 5, 2024 20:14
RebeccaMahany
RebeccaMahany previously approved these changes Jan 5, 2024
RebeccaMahany
RebeccaMahany previously approved these changes Jan 8, 2024
Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

nice

// darwin and is noop for other oses
func ExcludeLauncherDB(ctx context.Context, k types.Knapsack) {
dbPath := k.BboltDB().Path()
cmd, err := allowedcmd.Tmutil(ctx, "addexclusion", dbPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should exclude the whole root directory. Maybe the secret too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually keep the secret. But probably ignore the whole root directory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that, but if I understand correctly, that would mean we would also not bring along all the updates. So after a time machine restore / backup the user would be back on the very first version of launcher they downloaded and would need to update again. Maybe that's okay?

Copy link
Contributor

Choose a reason for hiding this comment

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

Grabbing the updates, and the TUF db, is a great counterpoint. I think you're right, it's good to carry those.

Maybe we should drop some more stuff though. Can we go by wildcard? Or do we need to do own globbing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can wild card, you thinking *.db?

Copy link
Contributor

Choose a reason for hiding this comment

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

$ ls /var/kolide-k2/k2device-preprod.kolide.com/
augeas-lenses				menu.json
debug-2023-12-31T20-27-14.599.json.gz	menu_template.json
debug-2024-01-03T05-30-26.256.json.gz	metadata.json
debug-2024-01-06T19-20-54.029.json.gz	metadata.plist
debug-2024-01-09T01-44-56.485.json.gz	osquery.autoload
debug-2024-01-10T20-30-07.640.json.gz	osquery.db
debug.json				osquery.pid
desktop_501				osquery.sock
kolide.png				osquery.sock.34719
kv.sqlite				osquery.sock.3513
launcher-staging			osqueryd-staging
launcher-tuf				osqueryd-tuf
launcher-tuf-dev			osqueryd-tuf-dev
launcher-version-1.4.1-3-ge21cebc	tuf
launcher.db				tuf-dev
launcher.pid				updates

json, json.gz, the metadata, the menu, most of the osquery files, desktop, the pid files, sockets...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wildcards did not work as expected, ended up globbing

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.

I love how simple this is

Comment on lines +51 to +52

if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if err != nil {
if err != nil {

@James-Pickett James-Pickett added this pull request to the merge queue Jan 12, 2024
Merged via the queue into kolide:main with commit 6e46249 Jan 12, 2024
27 checks passed
@James-Pickett James-Pickett deleted the james/exclude-launcher-db-from-time-machine branch January 12, 2024 15:46
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.

3 participants