diff --git a/pkg/auth/provisioning/scim/users_test.go b/pkg/auth/provisioning/scim/users_test.go index e02cd61..773eb9f 100644 --- a/pkg/auth/provisioning/scim/users_test.go +++ b/pkg/auth/provisioning/scim/users_test.go @@ -232,6 +232,11 @@ func TestCreateUserConnectionDeleteUserFlow(t *testing.T) { w.Write([]byte("OK")) return } + if r.RequestURI == "/refresh-server-config" { + w.WriteHeader(http.StatusAccepted) + w.Write([]byte("OK")) + return + } w.WriteHeader(http.StatusBadRequest) default: w.WriteHeader(http.StatusBadRequest) @@ -348,6 +353,11 @@ func TestCreateUserConnectionSuspendUserFlow(t *testing.T) { w.Write([]byte("OK")) return } + if r.RequestURI == "/refresh-server-config" { + w.WriteHeader(http.StatusAccepted) + w.Write([]byte("OK")) + return + } w.WriteHeader(http.StatusBadRequest) default: w.WriteHeader(http.StatusBadRequest) diff --git a/pkg/rest/setup.go b/pkg/rest/setup.go index e588da6..4354dbf 100644 --- a/pkg/rest/setup.go +++ b/pkg/rest/setup.go @@ -169,6 +169,12 @@ func (c *Context) vpnSetupHandler(w http.ResponseWriter, r *http.Request) { } switch r.Method { case http.MethodGet: + packetLogTypes := []string{} + for k, enabled := range vpnConfig.PacketLogsTypes { + if enabled { + packetLogTypes = append(packetLogTypes, k) + } + } setupRequest := VPNSetupRequest{ Routes: strings.Join(vpnConfig.ClientRoutes, ", "), VPNEndpoint: vpnConfig.Endpoint, @@ -178,6 +184,8 @@ func (c *Context) vpnSetupHandler(w http.ResponseWriter, r *http.Request) { ExternalInterface: vpnConfig.ExternalInterface, Nameservers: strings.Join(vpnConfig.Nameservers, ","), DisableNAT: vpnConfig.DisableNAT, + EnablePacketLogs: vpnConfig.EnablePacketLogs, + PacketLogsTypes: packetLogTypes, } out, err := json.Marshal(setupRequest) if err != nil { @@ -276,7 +284,9 @@ func (c *Context) vpnSetupHandler(w http.ResponseWriter, r *http.Request) { if !slices.Equal(setupRequest.PacketLogsTypes, packetLogTypes) { vpnConfig.PacketLogsTypes = make(map[string]bool) for _, v := range setupRequest.PacketLogsTypes { - vpnConfig.PacketLogsTypes[v] = true + if v == "http+https" || v == "dns" || v == "tcp" { + vpnConfig.PacketLogsTypes[v] = true + } } writeVPNConfig = true } diff --git a/webapp/src/Routes/Setup/VPNSetup.tsx b/webapp/src/Routes/Setup/VPNSetup.tsx index 5338660..70f923f 100644 --- a/webapp/src/Routes/Setup/VPNSetup.tsx +++ b/webapp/src/Routes/Setup/VPNSetup.tsx @@ -24,7 +24,7 @@ type VPNSetupRequest = { nameservers: string, disableNAT: boolean, enablePacketLogs: boolean, - packetLogTypes: string[], + packetLogsTypes: string[], }; export function VPNSetup() { const [saved, setSaved] = useState(false) @@ -57,7 +57,7 @@ export function VPNSetup() { nameservers: "", disableNAT: false, enablePacketLogs: false, - packetLogTypes: [] + packetLogsTypes: [] }, }); const setupMutation = useMutation({ @@ -250,8 +250,14 @@ export function VPNSetup() { > : null}