Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ func init() {
`An empty string "" clears the previous configuration. `+
`E.g. --dns-resolver-address 127.0.0.1:5053 or --dns-resolver-address ""`,
)
upCmd.PersistentFlags().BoolVar(&rosenpassEnabled, enableRosenpassFlag, false, "[Experimental] Enable Rosenpass feature. If enabled, the connection will be post-quantum secured via Rosenpass.")
upCmd.PersistentFlags().BoolVar(&rosenpassPermissive, rosenpassPermissiveFlag, false, "[Experimental] Enable Rosenpass in permissive mode to allow this peer to accept WireGuard connections without requiring Rosenpass functionality from peers that do not have Rosenpass enabled.")
upCmd.PersistentFlags().BoolVar(&rosenpassEnabled, enableRosenpassFlag, false, "[Deprecated] Enable Rosenpass feature. If enabled, the connection will be post-quantum secured via Rosenpass.")
upCmd.PersistentFlags().BoolVar(&rosenpassPermissive, rosenpassPermissiveFlag, false, "[Deprecated] Enable Rosenpass in permissive mode to allow this peer to accept WireGuard connections without requiring Rosenpass functionality from peers that do not have Rosenpass enabled.")
upCmd.PersistentFlags().BoolVar(&autoConnectDisabled, disableAutoConnectFlag, false, "Disables auto-connect feature. If enabled, then the client won't connect automatically when the service starts.")
upCmd.PersistentFlags().BoolVar(&localMetricsEnabled, enableLocalMetricsFlag, false, "Enables a local Prometheus /metrics endpoint exposing connection state (peers, latency, P2P vs relay).")
upCmd.PersistentFlags().StringVar(&localMetricsAddr, localMetricsAddressFlag, localmetrics.DefaultListenAddress, "Listen address of the local Prometheus /metrics endpoint.")
Expand Down
13 changes: 13 additions & 0 deletions client/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func upFunc(cmd *cobra.Command, args []string) error {
return err
}

warnRosenpassDeprecated(cmd)

ctx := internal.CtxInitState(cmd.Context())

if hostName != "" {
Expand Down Expand Up @@ -146,6 +148,17 @@ func upFunc(cmd *cobra.Command, args []string) error {
return runInDaemonMode(ctx, cmd, pm, activeProf, profileSwitched)
}

// warnRosenpassDeprecated prints a deprecation notice when the user turns Rosenpass on.
// Turning it off stays silent, since that is the action the notice asks for.
func warnRosenpassDeprecated(cmd *cobra.Command) {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
enabling := cmd.Flag(enableRosenpassFlag).Changed && rosenpassEnabled
permissive := cmd.Flag(rosenpassPermissiveFlag).Changed && rosenpassPermissive
if !enabling && !permissive {
return
}
cmd.PrintErrln("Warning: Rosenpass support is deprecated and may be removed in a future release.")
}

// switchOrCreateProfile switches the active profile to the one identified by
// handle, creating it first when it does not exist yet. This restores the
// pre-0.73 behaviour where `netbird up --profile <name>` auto-creates a
Expand Down
45 changes: 45 additions & 0 deletions client/cmd/up_rosenpass_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package cmd

import (
"bytes"
"testing"

"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestWarnRosenpassDeprecated(t *testing.T) {
tests := []struct {
name string
args []string
wantWarn bool
}{
{name: "no rosenpass flags", args: nil, wantWarn: false},
{name: "enable rosenpass", args: []string{"--" + enableRosenpassFlag}, wantWarn: true},
{name: "disable rosenpass", args: []string{"--" + enableRosenpassFlag + "=false"}, wantWarn: false},
{name: "enable permissive", args: []string{"--" + rosenpassPermissiveFlag}, wantWarn: true},
{
name: "disable both",
args: []string{"--" + enableRosenpassFlag + "=false", "--" + rosenpassPermissiveFlag + "=false"},
wantWarn: false,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// The flags bind to the package-level vars, so a fresh command per case
// resets both the values and the Changed state.
cmd := &cobra.Command{}
cmd.Flags().BoolVar(&rosenpassEnabled, enableRosenpassFlag, false, "")
cmd.Flags().BoolVar(&rosenpassPermissive, rosenpassPermissiveFlag, false, "")
require.NoError(t, cmd.ParseFlags(tt.args))

var stderr bytes.Buffer
cmd.SetErr(&stderr)
warnRosenpassDeprecated(cmd)

assert.Equal(t, tt.wantWarn, stderr.Len() > 0, "deprecation warning presence, stderr=%q", stderr.String())
})
}
}
9 changes: 8 additions & 1 deletion client/ui/frontend/src/modules/settings/SettingsSecurity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ export function SettingsSecurity() {
if (!v) setField("rosenpassPermissive", false);
}}
label={t("settings.security.rosenpass.label")}
helpText={t("settings.security.rosenpass.help")}
helpText={
<>
{t("settings.security.rosenpass.help")}
<span className={"mt-1 block"}>
{t("settings.security.rosenpass.deprecated")}
</span>
</>
}
/>
)}
{!hideRosenpassPermissive && (
Expand Down
4 changes: 4 additions & 0 deletions client/ui/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@
"message": "Add a post-quantum key exchange via Rosenpass on top of WireGuard®.",
"description": "Helper text: adds a post-quantum key exchange via Rosenpass on top of WireGuard®. 'Rosenpass' and 'WireGuard®' are product names — do not translate; keep the ® symbol."
},
"settings.security.rosenpass.deprecated": {
"message": "Deprecated: Rosenpass support may be removed in a future release.",
"description": "Notice shown under the quantum-resistance toggle: the Rosenpass feature is deprecated and may be removed later. 'Rosenpass' is a product name — do not translate."
},
"settings.security.rosenpassPermissive.label": {
"message": "Enable Permissive Mode",
"description": "Toggle label: enable permissive mode (for quantum-resistance)."
Expand Down
Loading