-
Notifications
You must be signed in to change notification settings - Fork 103
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
windows root directory fallback #1742
Conversation
c94552f
to
8c438e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud... What are the cases:
db[s] on disk | option | desired outcome |
---|---|---|
old location | old location | old location |
new location | new location | new location |
new location | old location | new location |
old location | new location | old location |
anywhere | developer | developer specified |
cmd/launcher/svc_windows.go
Outdated
@@ -51,6 +51,18 @@ func runWindowsSvc(systemSlogger *multislogger.MultiSlogger, args []string) erro | |||
|
|||
// Create a local logger. This logs to a known path, and aims to help diagnostics | |||
if opts.RootDirectory != "" { | |||
// check for old root directories before creating DB in case we've stomped over with windows MSI install | |||
updatedRootDirectory := determineRootDirectory(opts.RootDirectory, systemSlogger.Logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use the local/debug slogger, not the system one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I guess this is happening before we know where to write debug.json. Tricky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah my first pass at this failed to notice that and the logs end up being split across RootDirs, I thought maybe safer to just do this until we get it set up
1243dab
to
f118073
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels pretty good
"C:\\ProgramData\\Kolide\\Launcher-kolide-k2\\data", | ||
"C:\\Program Files\\Kolide\\Launcher-kolide-k2\\data", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the correct order? It means that if there's a new db path, we should prefer it. And I think that's likely to be true if someone got themselves into this situation. (They'll have already done the pain of it, and going back to the old db will be worse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was my thinking as well. I think for most (upgrade) cases moving forward we'll get ProgramData via opts anyway and check that first before we even iterate these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly talking through my assumptions here.
9ecd3c2
to
cdf6a57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense!
447fe39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is okay to try. We'll need to figure out some really good testing
These changes are to allow a windows device to fallback to a historical (or current) root directory location. When an MSI with a different root directory is freshly installed over another, launcher cannot see the existing DB and triggers a new enrollment.
To avoid this, svc_windows will override the root_directory set by the MSI if a populated database exists in another known root directory location