- 修复SSH资产修改终端类型无效的问题

- 增加「预连接 PDU (Hyper-V / VMConnect)」功能
This commit is contained in:
dushixiang
2022-04-18 21:28:50 +08:00
parent 277599a3b7
commit 4d294e5043
7 changed files with 30 additions and 6 deletions

View File

@ -308,6 +308,8 @@ func (api GuacamoleApi) setConfig(propertyMap map[string]string, s model.Session
configuration.SetParameter(guacd.DisableOffscreenCaching, propertyMap[guacd.DisableOffscreenCaching]) configuration.SetParameter(guacd.DisableOffscreenCaching, propertyMap[guacd.DisableOffscreenCaching])
configuration.SetParameter(guacd.ColorDepth, propertyMap[guacd.ColorDepth]) configuration.SetParameter(guacd.ColorDepth, propertyMap[guacd.ColorDepth])
configuration.SetParameter(guacd.ForceLossless, propertyMap[guacd.ForceLossless]) configuration.SetParameter(guacd.ForceLossless, propertyMap[guacd.ForceLossless])
configuration.SetParameter(guacd.PreConnectionId, propertyMap[guacd.PreConnectionId])
configuration.SetParameter(guacd.PreConnectionBlob, propertyMap[guacd.PreConnectionBlob])
case "ssh": case "ssh":
if len(s.PrivateKey) > 0 && s.PrivateKey != "-" { if len(s.PrivateKey) > 0 && s.PrivateKey != "-" {
configuration.SetParameter("username", s.Username) configuration.SetParameter("username", s.Username)

View File

@ -2,10 +2,10 @@ package api
import ( import (
"context" "context"
"next-terminal/server/service"
"next-terminal/server/dto" "next-terminal/server/dto"
"next-terminal/server/repository" "next-terminal/server/repository"
"next-terminal/server/service"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )

View File

@ -81,7 +81,7 @@ const (
) )
var SSHParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, SshMode, SocksProxyEnable, SocksProxyHost, SocksProxyPort, SocksProxyUsername, SocksProxyPassword} var SSHParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, SshMode, SocksProxyEnable, SocksProxyHost, SocksProxyPort, SocksProxyUsername, SocksProxyPassword}
var RDPParameterNames = []string{guacd.Domain, guacd.RemoteApp, guacd.RemoteAppDir, guacd.RemoteAppArgs, guacd.EnableDrive, guacd.DrivePath, guacd.ColorDepth, guacd.ForceLossless} var RDPParameterNames = []string{guacd.Domain, guacd.RemoteApp, guacd.RemoteAppDir, guacd.RemoteAppArgs, guacd.EnableDrive, guacd.DrivePath, guacd.ColorDepth, guacd.ForceLossless, guacd.PreConnectionId, guacd.PreConnectionBlob}
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} 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}

View File

@ -83,6 +83,9 @@ func (g *Gateway) OpenSshTunnel(id, ip string, port int) (exposedIP string, expo
return "", 0, err return "", 0, err
} }
// TODO debug
hostname = "0.0.0.0"
localAddr := fmt.Sprintf("%s:%d", hostname, localPort) localAddr := fmt.Sprintf("%s:%d", hostname, localPort)
listener, err := net.Listen("tcp", localAddr) listener, err := net.Listen("tcp", localAddr)
if err != nil { if err != nil {
@ -92,7 +95,8 @@ func (g *Gateway) OpenSshTunnel(id, ip string, port int) (exposedIP string, expo
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
tunnel := &Tunnel{ tunnel := &Tunnel{
ID: id, ID: id,
LocalHost: hostname, //LocalHost: hostname,
LocalHost: "docker.for.mac.host.internal",
LocalPort: localPort, LocalPort: localPort,
Gateway: g, Gateway: g,
RemoteHost: ip, RemoteHost: ip,

View File

@ -20,6 +20,9 @@ const (
Backspace = "backspace" Backspace = "backspace"
TerminalType = "terminal-type" TerminalType = "terminal-type"
PreConnectionId = "preconnection-id"
PreConnectionBlob = "preconnection-blob"
EnableDrive = "enable-drive" EnableDrive = "enable-drive"
DriveName = "drive-name" DriveName = "drive-name"
DrivePath = "drive-path" DrivePath = "drive-path"

View File

@ -558,7 +558,7 @@ class Asset extends Component {
const name = record['name']; const name = record['name'];
const sshMode = record['sshMode']; const sshMode = record['sshMode'];
let url = ''; let url = '';
if (protocol === 'ssh' && sshMode === 'native') { if (protocol === 'ssh' && (sshMode === 'native' || sshMode === 'naive')) {
url = `#/term?assetId=${id}&assetName=${name}`; url = `#/term?assetId=${id}&assetName=${name}`;
} else { } else {
url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`; url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`;

View File

@ -339,7 +339,7 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
</Col> </Col>
<Col span={11}> <Col span={11}>
<Collapse <Collapse
defaultActiveKey={['remote-app', '认证', 'VNC中继', 'storage', '模式设置', '显示设置', '控制终端行为', 'socks']} defaultActiveKey={['VNC中继', 'storage', '模式设置', '显示设置', '控制终端行为', 'socks']}
ghost> ghost>
{ {
protocol === 'rdp' ? protocol === 'rdp' ?
@ -379,6 +379,21 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa
<Input type='text' placeholder="身份验证时使用的域"/> <Input type='text' placeholder="身份验证时使用的域"/>
</Form.Item> </Form.Item>
</Panel> </Panel>
<Panel header={<Text strong>预连接 PDU (Hyper-V / VMConnect)</Text>} key="PDU">
<Form.Item
name="preconnection-id"
label='预连接ID'
>
<Input type='text' placeholder="RDP 源的数字 ID"/>
</Form.Item>
<Form.Item
name="preconnection-blob"
label='预连接字符'
>
<Input type='text' placeholder="标识 RDP 源的任意字符串"/>
</Form.Item>
</Panel>
<Panel header={<Text strong>Remote App</Text>} key="remote-app"> <Panel header={<Text strong>Remote App</Text>} key="remote-app">
<Form.Item <Form.Item
name="remote-app" name="remote-app"