From e39d87e7221fbd0978eb8a922e6d231fdffe06d6 Mon Sep 17 00:00:00 2001 From: Bartosz Leper Date: Mon, 13 Jan 2025 13:36:04 +0100 Subject: [PATCH] Support SSH port forwarding options in the role editor Allows both modern and legacy options. Bails out on malformed options and degrades to YAML mode. --- .../RoleEditor/StandardEditor/Options.tsx | 33 +- .../StandardEditor/standardmodel.test.ts | 292 +++++++++++++----- .../StandardEditor/standardmodel.ts | 146 ++++++++- .../RoleEditor/StandardEditor/withDefaults.ts | 30 +- .../teleport/src/services/resources/types.ts | 11 +- 5 files changed, 396 insertions(+), 116 deletions(-) diff --git a/web/packages/teleport/src/Roles/RoleEditor/StandardEditor/Options.tsx b/web/packages/teleport/src/Roles/RoleEditor/StandardEditor/Options.tsx index cbde6cb188559..c67f01c85e396 100644 --- a/web/packages/teleport/src/Roles/RoleEditor/StandardEditor/Options.tsx +++ b/web/packages/teleport/src/Roles/RoleEditor/StandardEditor/Options.tsx @@ -17,13 +17,14 @@ */ import { memo, useId } from 'react'; +import { components, OptionProps } from 'react-select'; import styled, { useTheme } from 'styled-components'; import Box from 'design/Box'; import Input from 'design/Input'; import LabelInput from 'design/LabelInput'; import { RadioGroup } from 'design/RadioGroup'; -import { H4 } from 'design/Text'; +import Text, { H4 } from 'design/Text'; import Select from 'shared/components/Select'; import { SectionProps } from './sections'; @@ -33,6 +34,8 @@ import { OptionsModel, requireMFATypeOptions, sessionRecordingModeOptions, + SSHPortForwardingModeOption, + sshPortForwardingModeOptions, } from './standardmodel'; /** @@ -53,6 +56,8 @@ export const Options = memo(function Options({ const createDBUserModeId = `${id}-create-db-user-mode`; const defaultSessionRecordingModeId = `${id}-default-session-recording-mode`; const sshSessionRecordingModeId = `${id}-ssh-session-recording-mode`; + const sshPortForwardingModeId = `${id}-ssh-port-forwarding-mode`; + return ( onChange?.({ ...value, sshSessionRecordingMode: m })} /> + + Port Forwarding Mode + +