From 69797aa50b7875bcdd7beef7d40ab2565ce784f0 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Fri, 9 Feb 2024 19:37:09 +0100 Subject: [PATCH] Remove old config options --- agent/actions/login.go | 2 +- agent/config/config.go | 32 ++++++++++++---------------- agent/unixsocketagent.go | 9 -------- client/setup/setup_linux.go | 2 +- main.go | 42 +++++++++++-------------------------- 5 files changed, 27 insertions(+), 60 deletions(-) diff --git a/agent/actions/login.go b/agent/actions/login.go index e49155a..1109b06 100644 --- a/agent/actions/login.go +++ b/agent/actions/login.go @@ -15,7 +15,7 @@ import ( ) func handleLogin(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vault, callingContext *sockets.CallingContext) (response messages.IPCMessage, err error) { - if !cfg.HasPin() && !cfg.ConfigFile.RuntimeConfig.DisablePinRequirement { + if !cfg.HasPin() { response, err = messages.IPCMessageFromPayload(messages.ActionResponse{ Success: false, Message: "No pin set. Set a pin first!", diff --git a/agent/config/config.go b/agent/config/config.go index 9b5a77e..9e9dd3d 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -31,25 +31,19 @@ const ( ) type RuntimeConfig struct { - DisableAuth bool - DisablePinRequirement bool - AuthMethod string - DoNotPersistConfig bool - ConfigDirectory string - DisableSSHAgent bool - WebsocketDisabled bool - ApiURI string - IdentityURI string - NotificationsURI string - SingleProcess bool - DeviceUUID string - User string - Password string - Pin string - UseMemguard bool - SSHAgentSocketPath string - GoldwardenSocketPath string - DaemonAuthToken string + AuthMethod string + DoNotPersistConfig bool + ConfigDirectory string + DisableSSHAgent bool + WebsocketDisabled bool + DeviceUUID string + User string + Password string + Pin string + UseMemguard bool + SSHAgentSocketPath string + GoldwardenSocketPath string + DaemonAuthToken string } type ConfigFile struct { diff --git a/agent/unixsocketagent.go b/agent/unixsocketagent.go index 9c8dbb0..e8122a0 100644 --- a/agent/unixsocketagent.go +++ b/agent/unixsocketagent.go @@ -316,15 +316,6 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error { cfg.WriteConfig() } cfg.ConfigFile.RuntimeConfig = runtimeConfig - if cfg.ConfigFile.RuntimeConfig.ApiURI != "" { - cfg.ConfigFile.ApiUrl = cfg.ConfigFile.RuntimeConfig.ApiURI - } - if cfg.ConfigFile.RuntimeConfig.IdentityURI != "" { - cfg.ConfigFile.IdentityUrl = cfg.ConfigFile.RuntimeConfig.IdentityURI - } - if cfg.ConfigFile.RuntimeConfig.NotificationsURI != "" { - cfg.ConfigFile.NotificationsUrl = cfg.ConfigFile.RuntimeConfig.NotificationsURI - } if cfg.ConfigFile.RuntimeConfig.DeviceUUID != "" { cfg.ConfigFile.DeviceUUID = cfg.ConfigFile.RuntimeConfig.DeviceUUID } diff --git a/client/setup/setup_linux.go b/client/setup/setup_linux.go index 96a550c..34916a8 100644 --- a/client/setup/setup_linux.go +++ b/client/setup/setup_linux.go @@ -10,7 +10,7 @@ import ( ) func VerifySetup(runtimeConfig config.RuntimeConfig) bool { - if !cmd.IsPolkitSetup() && !runtimeConfig.DisableAuth { + if !cmd.IsPolkitSetup() { fmt.Println("Polkit is not setup. Run 'goldwarden setup polkit' to set it up.") return false } diff --git a/main.go b/main.go index 29e81ae..9264656 100644 --- a/main.go +++ b/main.go @@ -20,23 +20,18 @@ func main() { configPath = strings.ReplaceAll(configPath, "~", userHome) runtimeConfig := config.RuntimeConfig{ - WebsocketDisabled: os.Getenv("GOLDWARDEN_WEBSOCKET_DISABLED") == "true", - DisableSSHAgent: os.Getenv("GOLDWARDEN_SSH_AGENT_DISABLED") == "true", - DisableAuth: os.Getenv("GOLDWARDEN_SYSTEM_AUTH_DISABLED") == "true", - DisablePinRequirement: os.Getenv("GOLDWARDEN_PIN_REQUIREMENT_DISABLED") == "true", - DoNotPersistConfig: os.Getenv("GOLDWARDEN_DO_NOT_PERSIST_CONFIG") == "true", - ApiURI: os.Getenv("GOLDWARDEN_API_URI"), - IdentityURI: os.Getenv("GOLDWARDEN_IDENTITY_URI"), - SingleProcess: os.Getenv("GOLDWARDEN_SINGLE_PROCESS") == "true", - DeviceUUID: os.Getenv("GOLDWARDEN_DEVICE_UUID"), - AuthMethod: os.Getenv("GOLDWARDEN_AUTH_METHOD"), - User: os.Getenv("GOLDWARDEN_AUTH_USER"), - Password: os.Getenv("GOLDWARDEN_AUTH_PASSWORD"), - Pin: os.Getenv("GOLDWARDEN_PIN"), - UseMemguard: os.Getenv("GOLDWARDEN_NO_MEMGUARD") != "true", - SSHAgentSocketPath: os.Getenv("GOLDWARDEN_SSH_AUTH_SOCK"), - GoldwardenSocketPath: os.Getenv("GOLDWARDEN_SOCKET_PATH"), - DaemonAuthToken: os.Getenv("GOLDWARDEN_DAEMON_AUTH_TOKEN"), + WebsocketDisabled: os.Getenv("GOLDWARDEN_WEBSOCKET_DISABLED") == "true", + DisableSSHAgent: os.Getenv("GOLDWARDEN_SSH_AGENT_DISABLED") == "true", + DoNotPersistConfig: os.Getenv("GOLDWARDEN_DO_NOT_PERSIST_CONFIG") == "true", + DeviceUUID: os.Getenv("GOLDWARDEN_DEVICE_UUID"), + AuthMethod: os.Getenv("GOLDWARDEN_AUTH_METHOD"), + User: os.Getenv("GOLDWARDEN_AUTH_USER"), + Password: os.Getenv("GOLDWARDEN_AUTH_PASSWORD"), + Pin: os.Getenv("GOLDWARDEN_PIN"), + UseMemguard: os.Getenv("GOLDWARDEN_NO_MEMGUARD") != "true", + SSHAgentSocketPath: os.Getenv("GOLDWARDEN_SSH_AUTH_SOCK"), + GoldwardenSocketPath: os.Getenv("GOLDWARDEN_SOCKET_PATH"), + DaemonAuthToken: os.Getenv("GOLDWARDEN_DAEMON_AUTH_TOKEN"), ConfigDirectory: configPath, } @@ -67,18 +62,5 @@ func main() { runtimeConfig.GoldwardenSocketPath = userHome + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock" } - if runtimeConfig.SingleProcess { - runtimeConfig.DisablePinRequirement = true - runtimeConfig.DisableAuth = true - } - - if runtimeConfig.DisablePinRequirement { - runtimeConfig.DoNotPersistConfig = true - } - - if runtimeConfig.DisableAuth { - os.Setenv("GOLDWARDEN_SYSTEM_AUTH_DISABLED", "true") - } - cmd.Execute(runtimeConfig) }