Skip to content

Commit

Permalink
Fix preshared key not persisted in config (#1474)
Browse files Browse the repository at this point in the history
* replace the preshared key attribute in LoginRequest protobuff with an optional replacement

* mark old field as deprecated

* fix ui client to also keep preshared key
  • Loading branch information
pascal-fischer authored Jan 19, 2024
1 parent 93646e6 commit f099e02
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 165 deletions.
5 changes: 4 additions & 1 deletion client/cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ var loginCmd = &cobra.Command{

loginRequest := proto.LoginRequest{
SetupKey: setupKey,
PreSharedKey: preSharedKey,
ManagementUrl: managementURL,
IsLinuxDesktopClient: isLinuxRunningDesktop(),
Hostname: hostName,
}

if rootCmd.PersistentFlags().Changed(preSharedKeyFlag) {
loginRequest.OptionalPreSharedKey = &preSharedKey
}

var loginErr error

var loginResp *proto.LoginResponse
Expand Down
5 changes: 4 additions & 1 deletion client/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ func runInDaemonMode(ctx context.Context, cmd *cobra.Command) error {

loginRequest := proto.LoginRequest{
SetupKey: setupKey,
PreSharedKey: preSharedKey,
ManagementUrl: managementURL,
AdminURL: adminURL,
NatExternalIPs: natExternalIPs,
Expand All @@ -173,6 +172,10 @@ func runInDaemonMode(ctx context.Context, cmd *cobra.Command) error {
Hostname: hostName,
}

if rootCmd.PersistentFlags().Changed(preSharedKeyFlag) {
loginRequest.OptionalPreSharedKey = &preSharedKey
}

if cmd.Flag(enableRosenpassFlag).Changed {
loginRequest.RosenpassEnabled = &rosenpassEnabled
}
Expand Down
Loading

0 comments on commit f099e02

Please sign in to comment.