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 database reset history to uninstall and add uninstall history checkup #1639

Merged
merged 9 commits into from Mar 7, 2024

Conversation

zackattack01
Copy link
Contributor

These changes rework the remote uninstall path to utilize the database reset record functionality (added to support remediation for hardware changes). Now, an uninstallation will first take a record of the previous database before resetting.

This also adds an Uninstall History checkup, which will read from the reset records key to report if any previous uninstallations/resets have been recorded.

RebeccaMahany
RebeccaMahany previously approved these changes Mar 4, 2024
James-Pickett
James-Pickett previously approved these changes Mar 4, 2024
directionless
directionless previously approved these changes Mar 5, 2024

for _, uninstallRecord := range resetRecords {
resetTimeKey := time.Unix(uninstallRecord.ResetTimestamp, 0)
hc.data[resetTimeKey.Format(time.RFC3339)] = map[string]any{
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but feels like a bit of overkill. The time sorted array was probably fine

return nil
}

resetRecordsRaw, err := hc.k.PersistentHostDataStore().Get(agent.HostDataKeyResetRecords)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider moving this to something like agent.GetResetRecords(ctx context.Context, k types.Knapsack) maybe.

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 will go ahead and do that, it should clean this all up a bit. thank you!

@@ -17,7 +17,7 @@ import (
"github.com/kolide/launcher/pkg/traces"
)

type dbResetRecord struct {
type DBResetRecord struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not totally sure why this is exported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I might be able to un-export this one too after moving to using agent.GetResetRecords, will give that a try

ee/debug/checkups/checkups.go Outdated Show resolved Hide resolved
ee/debug/checkups/uninstall_history.go Outdated Show resolved Hide resolved
RebeccaMahany
RebeccaMahany previously approved these changes Mar 5, 2024
directionless
directionless previously approved these changes Mar 6, 2024
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.

Let's try!

ee/agent/reset.go Outdated Show resolved Hide resolved
Co-authored-by: seph <seph@kolide.co>
@zackattack01 zackattack01 added this pull request to the merge queue Mar 7, 2024
Merged via the queue into main with commit eb6e451 Mar 7, 2024
29 checks passed
@zackattack01 zackattack01 deleted the zack/add_uninstall_history_checkup branch March 7, 2024 16:19
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.

None yet

4 participants