增加k8s接入
This commit is contained in:
@ -111,6 +111,8 @@ func TunEndpoint(c echo.Context) error {
|
|||||||
configuration.SetParameter(guacd.FontSize, propertyMap[guacd.FontSize])
|
configuration.SetParameter(guacd.FontSize, propertyMap[guacd.FontSize])
|
||||||
configuration.SetParameter(guacd.FontName, propertyMap[guacd.FontName])
|
configuration.SetParameter(guacd.FontName, propertyMap[guacd.FontName])
|
||||||
configuration.SetParameter(guacd.ColorScheme, propertyMap[guacd.ColorScheme])
|
configuration.SetParameter(guacd.ColorScheme, propertyMap[guacd.ColorScheme])
|
||||||
|
configuration.SetParameter(guacd.Backspace, propertyMap[guacd.Backspace])
|
||||||
|
configuration.SetParameter(guacd.TerminalType, propertyMap[guacd.TerminalType])
|
||||||
break
|
break
|
||||||
case "vnc":
|
case "vnc":
|
||||||
configuration.SetParameter("username", session.Username)
|
configuration.SetParameter("username", session.Username)
|
||||||
@ -119,7 +121,20 @@ func TunEndpoint(c echo.Context) error {
|
|||||||
case "telnet":
|
case "telnet":
|
||||||
configuration.SetParameter("username", session.Username)
|
configuration.SetParameter("username", session.Username)
|
||||||
configuration.SetParameter("password", session.Password)
|
configuration.SetParameter("password", session.Password)
|
||||||
|
|
||||||
|
configuration.SetParameter(guacd.FontSize, propertyMap[guacd.FontSize])
|
||||||
|
configuration.SetParameter(guacd.FontName, propertyMap[guacd.FontName])
|
||||||
|
configuration.SetParameter(guacd.ColorScheme, propertyMap[guacd.ColorScheme])
|
||||||
|
configuration.SetParameter(guacd.Backspace, propertyMap[guacd.Backspace])
|
||||||
|
configuration.SetParameter(guacd.TerminalType, propertyMap[guacd.TerminalType])
|
||||||
break
|
break
|
||||||
|
case "kubernetes":
|
||||||
|
|
||||||
|
configuration.SetParameter(guacd.FontSize, propertyMap[guacd.FontSize])
|
||||||
|
configuration.SetParameter(guacd.FontName, propertyMap[guacd.FontName])
|
||||||
|
configuration.SetParameter(guacd.ColorScheme, propertyMap[guacd.ColorScheme])
|
||||||
|
configuration.SetParameter(guacd.Backspace, propertyMap[guacd.Backspace])
|
||||||
|
configuration.SetParameter(guacd.TerminalType, propertyMap[guacd.TerminalType])
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration.SetParameter("hostname", session.IP)
|
configuration.SetParameter("hostname", session.IP)
|
||||||
|
@ -48,6 +48,15 @@ const (
|
|||||||
PasswordRegex = "password-regex"
|
PasswordRegex = "password-regex"
|
||||||
LoginSuccessRegex = "login-success-regex"
|
LoginSuccessRegex = "login-success-regex"
|
||||||
LoginFailureRegex = "login-failure-regex"
|
LoginFailureRegex = "login-failure-regex"
|
||||||
|
|
||||||
|
Namespace = "namespace"
|
||||||
|
Pod = "pod"
|
||||||
|
Container = "container"
|
||||||
|
UesSSL = "use-ssl"
|
||||||
|
ClientCert = "client-cert"
|
||||||
|
ClientKey = "client-key"
|
||||||
|
CaCert = "ca-cert"
|
||||||
|
IgnoreCert = "ignore-cert"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Delimiter = ';'
|
const Delimiter = ';'
|
||||||
|
@ -24,6 +24,7 @@ var SSHParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorSche
|
|||||||
var RDPParameterNames = []string{guacd.RemoteApp, guacd.RemoteAppDir, guacd.RemoteAppArgs}
|
var RDPParameterNames = []string{guacd.RemoteApp, guacd.RemoteAppDir, guacd.RemoteAppArgs}
|
||||||
var VNCParameterNames = []string{guacd.ColorDepth, guacd.Cursor, guacd.SwapRedBlue, guacd.DestHost, guacd.DestPort}
|
var VNCParameterNames = []string{guacd.ColorDepth, guacd.Cursor, guacd.SwapRedBlue, guacd.DestHost, guacd.DestPort}
|
||||||
var TelnetParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, guacd.UsernameRegex, guacd.PasswordRegex, guacd.LoginSuccessRegex, guacd.LoginFailureRegex}
|
var TelnetParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, guacd.UsernameRegex, guacd.PasswordRegex, guacd.LoginSuccessRegex, guacd.LoginFailureRegex}
|
||||||
|
var KubernetesParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, guacd.Namespace, guacd.Pod, guacd.Container, guacd.UesSSL, guacd.ClientCert, guacd.ClientKey, guacd.CaCert, guacd.IgnoreCert}
|
||||||
|
|
||||||
func UpdateAssetAttributes(assetId, protocol string, m echo.Map) error {
|
func UpdateAssetAttributes(assetId, protocol string, m echo.Map) error {
|
||||||
var data []AssetAttribute
|
var data []AssetAttribute
|
||||||
@ -37,6 +38,9 @@ func UpdateAssetAttributes(assetId, protocol string, m echo.Map) error {
|
|||||||
parameterNames = VNCParameterNames
|
parameterNames = VNCParameterNames
|
||||||
case "telnet":
|
case "telnet":
|
||||||
parameterNames = TelnetParameterNames
|
parameterNames = TelnetParameterNames
|
||||||
|
case "kubernetes":
|
||||||
|
parameterNames = KubernetesParameterNames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range parameterNames {
|
for i := range parameterNames {
|
||||||
@ -94,6 +98,8 @@ func FindAssetAttrMapByAssetId(assetId string) (map[string]interface{}, error) {
|
|||||||
parameterNames = VNCParameterNames
|
parameterNames = VNCParameterNames
|
||||||
case "telnet":
|
case "telnet":
|
||||||
parameterNames = TelnetParameterNames
|
parameterNames = TelnetParameterNames
|
||||||
|
case "kubernetes":
|
||||||
|
parameterNames = KubernetesParameterNames
|
||||||
}
|
}
|
||||||
propertiesMap := FindAllPropertiesMap()
|
propertiesMap := FindAllPropertiesMap()
|
||||||
var attributeMap = make(map[string]interface{})
|
var attributeMap = make(map[string]interface{})
|
||||||
|
@ -270,6 +270,12 @@ class Asset extends Component {
|
|||||||
asset['tags'] = [];
|
asset['tags'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asset['use-ssl'] = asset['use-ssl'] === 'true';
|
||||||
|
|
||||||
|
asset['ignore-cert'] = asset['ignore-cert'] === 'true';
|
||||||
|
|
||||||
|
console.log(asset)
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
modalTitle: title,
|
modalTitle: title,
|
||||||
modalVisible: true,
|
modalVisible: true,
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import {Col, Collapse, Form, Input, InputNumber, Modal, Radio, Row, Select, Tooltip, Typography} from "antd/lib/index";
|
import {
|
||||||
|
Col,
|
||||||
|
Collapse,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Modal,
|
||||||
|
Radio,
|
||||||
|
Row,
|
||||||
|
Select,
|
||||||
|
Switch,
|
||||||
|
Tooltip,
|
||||||
|
Typography
|
||||||
|
} from "antd/lib/index";
|
||||||
import {ExclamationCircleOutlined} from "@ant-design/icons";
|
import {ExclamationCircleOutlined} from "@ant-design/icons";
|
||||||
import {isEmpty} from "../../utils/utils";
|
import {isEmpty} from "../../utils/utils";
|
||||||
|
|
||||||
@ -43,13 +56,14 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
let [accountType, setAccountType] = useState(model.accountType);
|
let [accountType, setAccountType] = useState(model.accountType);
|
||||||
let [protocol, setProtocol] = useState(model.protocol);
|
let [protocol, setProtocol] = useState(model.protocol);
|
||||||
let [sshMode, setSshMode] = useState(model['ssh-mode']);
|
let [sshMode, setSshMode] = useState(model['ssh-mode']);
|
||||||
console.log(sshMode)
|
|
||||||
|
|
||||||
let initAccountTypes = []
|
let initAccountTypes = []
|
||||||
if (model.protocol) {
|
if (model.protocol) {
|
||||||
initAccountTypes = protocolMapping[model.protocol];
|
initAccountTypes = protocolMapping[model.protocol];
|
||||||
}
|
}
|
||||||
let [accountTypes, setAccountTypes] = useState(initAccountTypes);
|
let [accountTypes, setAccountTypes] = useState(initAccountTypes);
|
||||||
|
let [useSSL, setUseSSL] = useState(model['use-ssl']);
|
||||||
|
let [ignoreCert, setIgnoreCert] = useState(model['ignore-cert']);
|
||||||
|
|
||||||
for (let key in model) {
|
for (let key in model) {
|
||||||
if (model.hasOwnProperty(key)) {
|
if (model.hasOwnProperty(key)) {
|
||||||
@ -95,6 +109,9 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
});
|
});
|
||||||
handleAccountTypeChange('custom');
|
handleAccountTypeChange('custom');
|
||||||
break;
|
break;
|
||||||
|
case 'kubernetes':
|
||||||
|
port = 6443;
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
port = 65535;
|
port = 65535;
|
||||||
}
|
}
|
||||||
@ -135,7 +152,7 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
|
|
||||||
<Form form={form} {...formLayout} initialValues={model}>
|
<Form form={form} {...formLayout} initialValues={model}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col span={12}>
|
<Col span={13}>
|
||||||
<Form.Item name='id' noStyle>
|
<Form.Item name='id' noStyle>
|
||||||
<Input hidden={true}/>
|
<Input hidden={true}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -150,10 +167,11 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
|
|
||||||
<Form.Item label="接入协议" name='protocol' rules={[{required: true, message: '请选择接入协议'}]}>
|
<Form.Item label="接入协议" name='protocol' rules={[{required: true, message: '请选择接入协议'}]}>
|
||||||
<Radio.Group onChange={handleProtocolChange}>
|
<Radio.Group onChange={handleProtocolChange}>
|
||||||
<Radio value="rdp">rdp</Radio>
|
<Radio value="rdp">RDP</Radio>
|
||||||
<Radio value="ssh">ssh</Radio>
|
<Radio value="ssh">SSH</Radio>
|
||||||
<Radio value="vnc">vnc</Radio>
|
<Radio value="vnc">VNC</Radio>
|
||||||
<Radio value="telnet">telnet</Radio>
|
<Radio value="telnet">Telnet</Radio>
|
||||||
|
<Radio value="kubernetes">Kubernetes</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
@ -161,7 +179,32 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
<InputNumber min={1} max={65535} placeholder='TCP端口'/>
|
<InputNumber min={1} max={65535} placeholder='TCP端口'/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label="账户类型" name='accountType' rules={[{required: true, message: '请选择接账户类型'}]}>
|
{
|
||||||
|
protocol === 'kubernetes' ? <>
|
||||||
|
<Form.Item
|
||||||
|
name="namespace"
|
||||||
|
label="命名空间"
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder="为空时默认使用default命名空间"/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="pod"
|
||||||
|
label="pod"
|
||||||
|
rules={[{required: true, message: '请输入Pod名称'}]}
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder="Kubernetes Pod的名称,其中包含与之相连的容器。"/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="container"
|
||||||
|
label="容器"
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder="为空时默认使用第一个容器"/>
|
||||||
|
</Form.Item>
|
||||||
|
</> : <>
|
||||||
|
<Form.Item label="账户类型" name='accountType'
|
||||||
|
rules={[{required: true, message: '请选择接账户类型'}]}>
|
||||||
<Select onChange={handleAccountTypeChange}>
|
<Select onChange={handleAccountTypeChange}>
|
||||||
{accountTypes.map(item => {
|
{accountTypes.map(item => {
|
||||||
return (<Option key={item.value} value={item.value}>{item.text}</Option>)
|
return (<Option key={item.value} value={item.value}>{item.text}</Option>)
|
||||||
@ -169,6 +212,7 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
accountType === 'credential' ?
|
accountType === 'credential' ?
|
||||||
<Form.Item label="授权凭证" name='credentialId'
|
<Form.Item label="授权凭证" name='credentialId'
|
||||||
@ -191,11 +235,13 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
{
|
{
|
||||||
accountType === 'custom' ?
|
accountType === 'custom' ?
|
||||||
<>
|
<>
|
||||||
<Form.Item label="授权账户" name='username' noStyle={!(accountType === 'custom')}>
|
<Form.Item label="授权账户" name='username'
|
||||||
|
noStyle={!(accountType === 'custom')}>
|
||||||
<Input placeholder="输入授权账户"/>
|
<Input placeholder="输入授权账户"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label="授权密码" name='password' noStyle={!(accountType === 'custom')}>
|
<Form.Item label="授权密码" name='password'
|
||||||
|
noStyle={!(accountType === 'custom')}>
|
||||||
<Input.Password placeholder="输入授权密码"/>
|
<Input.Password placeholder="输入授权密码"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
@ -219,6 +265,8 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
</>
|
</>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
<Form.Item label="标签" name='tags'>
|
<Form.Item label="标签" name='tags'>
|
||||||
<Select mode="tags" placeholder="标签可以更加方便的检索资产">
|
<Select mode="tags" placeholder="标签可以更加方便的检索资产">
|
||||||
@ -235,8 +283,8 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
|
|||||||
<TextArea rows={4} placeholder='关于资产的一些信息您可以写在这里'/>
|
<TextArea rows={4} placeholder='关于资产的一些信息您可以写在这里'/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={11}>
|
||||||
<Collapse defaultActiveKey={['remote-app', '认证', '显示设置', '控制终端行为', 'VNC中继', '模式设置']} ghost>
|
<Collapse defaultActiveKey={['remote-app', '认证', 'VNC中继', '模式设置']} ghost>
|
||||||
{
|
{
|
||||||
protocol === 'rdp' ?
|
protocol === 'rdp' ?
|
||||||
<>
|
<>
|
||||||
@ -504,6 +552,121 @@ Windows需要对远程应用程序的名称使用特殊的符号。
|
|||||||
</Panel>
|
</Panel>
|
||||||
</> : undefined
|
</> : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
protocol === 'kubernetes' ?
|
||||||
|
<>
|
||||||
|
<Panel header={<Text strong>认证</Text>} key="认证">
|
||||||
|
<Form.Item
|
||||||
|
name="use-ssl"
|
||||||
|
label="使用SSL"
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch checkedChildren="是" unCheckedChildren="否"
|
||||||
|
onChange={(checked, event) => {
|
||||||
|
setUseSSL(checked);
|
||||||
|
}}/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
{
|
||||||
|
useSSL ?
|
||||||
|
<>
|
||||||
|
<Form.Item
|
||||||
|
name="client-cert"
|
||||||
|
label="client-cert"
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder=""/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="client-key"
|
||||||
|
label="client-key"
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder=""/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="ca-cert"
|
||||||
|
label="ca-cert"
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder=""/>
|
||||||
|
</Form.Item>
|
||||||
|
</> : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="ignore-cert"
|
||||||
|
label="忽略证书"
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch checkedChildren="是" unCheckedChildren="否"
|
||||||
|
onChange={(checked, event) => {
|
||||||
|
|
||||||
|
}}/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
</Panel>
|
||||||
|
<Panel header={<Text strong>显示设置</Text>} key="显示设置">
|
||||||
|
<Form.Item
|
||||||
|
name="color-scheme"
|
||||||
|
label="配色方案"
|
||||||
|
initialValue=""
|
||||||
|
>
|
||||||
|
<Select onChange={null}>
|
||||||
|
<Option value="">默认</Option>
|
||||||
|
<Option value="gray-black">黑底灰字</Option>
|
||||||
|
<Option value="green-black">黑底绿字</Option>
|
||||||
|
<Option value="white-black">黑底白字</Option>
|
||||||
|
<Option value="black-white">白底黑字</Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="font-name"
|
||||||
|
label="字体名称"
|
||||||
|
>
|
||||||
|
<Input type='text' placeholder="为空时使用系统默认字体"/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="font-size"
|
||||||
|
label="字体大小"
|
||||||
|
>
|
||||||
|
<Input type='number' placeholder="为空时使用系统默认字体大小" min={8} max={96}/>
|
||||||
|
</Form.Item>
|
||||||
|
</Panel>
|
||||||
|
<Panel header={<Text strong>控制终端行为</Text>} key="控制终端行为">
|
||||||
|
<Form.Item
|
||||||
|
name="backspace"
|
||||||
|
label="退格键映射"
|
||||||
|
initialValue=""
|
||||||
|
>
|
||||||
|
<Select onChange={null}>
|
||||||
|
<Option value="">默认</Option>
|
||||||
|
<Option value="127">删除键(Ctrl-?)</Option>
|
||||||
|
<Option value="8">退格键(Ctrl-H)</Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="terminal-type"
|
||||||
|
label="终端类型"
|
||||||
|
initialValue=""
|
||||||
|
>
|
||||||
|
<Select onChange={null}>
|
||||||
|
<Option value="">默认</Option>
|
||||||
|
<Option value="ansi">ansi</Option>
|
||||||
|
<Option value="linux">linux</Option>
|
||||||
|
<Option value="vt100">vt100</Option>
|
||||||
|
<Option value="vt220">vt220</Option>
|
||||||
|
<Option value="xterm">xterm</Option>
|
||||||
|
<Option value="xterm-256color">xterm-256color</Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</Panel>
|
||||||
|
</> : undefined
|
||||||
|
}
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
Reference in New Issue
Block a user