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

set RecoveryActionsOnNonCrashFailures flag in svc_config_windows #1670

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

zackattack01
Copy link
Contributor

@zackattack01 zackattack01 commented Apr 2, 2024

This makes a few updates to our windows service config at runtime:

  • sets the SERVICE_FAILURE_ACTIONS_FLAG to true
    • my device reports this flag as false without setting explicitly (from the changes here)

If this member is TRUE and the service has configured failure actions, the failure actions are queued if the service process terminates without reporting a status of SERVICE_STOPPED or if it enters the SERVICE_STOPPED state but the dwWin32ExitCode member of the SERVICE_STATUS structure is not ERROR_SUCCESS (0).

If this member is FALSE and the service has configured failure actions, the failure actions are queued only if the service terminates without reporting a status of SERVICE_STOPPED.

  • see docs here for full details
  • this also wires our systemSlogger multislogger through to update the existing logging

@zackattack01 zackattack01 marked this pull request as ready for review April 2, 2024 21:07
cmd/launcher/svc_config_windows.go Show resolved Hide resolved

defer sman.Disconnect()

launcherService, err := sman.OpenService(`LauncherKolideK2Svc`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make this a const around where launcherServiceRegistryKeyName lives?

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 yep! will do

cmd/launcher/svc_config_windows.go Show resolved Hide resolved
)

const (
launcherServiceName = `LauncherKolideK2Svc`
Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm. This is fine for now, but this is an interesting thread....

The ServiceName is tied to the identifier the package was built with. I don't recall if we have it available anywhere at runtime. If we did, using that makes more sense.

If we don't, we should consider a longer arc of making something more human friendly, and where we store manage it. (Constant in agent?) But that's all kinda future handwaving

@@ -25,7 +28,7 @@ const (
notFoundInRegistryError = "The system cannot find the file specified."
)

func checkServiceConfiguration(logger log.Logger, opts *launcher.Options) {
func checkServiceConfiguration(logger *slog.Logger, opts *launcher.Options) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Slight preference to calling slog.Logger slogger, but 🤷

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 update this in the second set of changes!

@zackattack01 zackattack01 added this pull request to the merge queue Apr 3, 2024
Merged via the queue into main with commit d9e9bec Apr 3, 2024
29 checks passed
@zackattack01 zackattack01 deleted the zack/windows_service_config branch April 3, 2024 16:14
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.

4 participants