2024-10-02 00:55:20 +08:00
|
|
|
|
import { AccessInput, BaseAccess, IsAccess } from '@certd/pipeline';
|
2024-06-19 00:21:13 +08:00
|
|
|
|
import { ConnectConfig } from 'ssh2';
|
2024-05-27 18:38:41 +08:00
|
|
|
|
|
|
|
|
|
|
@IsAccess({
|
|
|
|
|
|
name: 'ssh',
|
|
|
|
|
|
title: '主机登录授权',
|
|
|
|
|
|
desc: '',
|
|
|
|
|
|
input: {},
|
|
|
|
|
|
})
|
2024-10-02 00:55:20 +08:00
|
|
|
|
export class SshAccess extends BaseAccess implements ConnectConfig {
|
2024-05-27 18:38:41 +08:00
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '主机地址',
|
|
|
|
|
|
component: {
|
|
|
|
|
|
placeholder: '主机域名或IP地址',
|
|
|
|
|
|
},
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
})
|
|
|
|
|
|
host!: string;
|
|
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '端口',
|
2024-09-29 11:50:59 +08:00
|
|
|
|
value: 22,
|
2024-05-27 18:38:41 +08:00
|
|
|
|
component: {
|
2024-06-19 00:21:13 +08:00
|
|
|
|
name: 'a-input-number',
|
2024-05-27 18:38:41 +08:00
|
|
|
|
placeholder: '22',
|
|
|
|
|
|
},
|
|
|
|
|
|
rules: [{ required: true, message: '此项必填' }],
|
|
|
|
|
|
})
|
2024-06-19 00:21:13 +08:00
|
|
|
|
port!: number;
|
2024-05-27 18:38:41 +08:00
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '用户名',
|
|
|
|
|
|
value: 'root',
|
|
|
|
|
|
rules: [{ required: true, message: '此项必填' }],
|
|
|
|
|
|
})
|
|
|
|
|
|
username!: string;
|
|
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '密码',
|
|
|
|
|
|
component: {
|
|
|
|
|
|
name: 'a-input-password',
|
|
|
|
|
|
vModel: 'value',
|
|
|
|
|
|
},
|
2024-08-27 13:46:19 +08:00
|
|
|
|
encrypt: true,
|
2024-05-27 18:38:41 +08:00
|
|
|
|
helper: '登录密码或密钥必填一项',
|
|
|
|
|
|
})
|
|
|
|
|
|
password!: string;
|
|
|
|
|
|
@AccessInput({
|
2024-06-19 00:21:13 +08:00
|
|
|
|
title: '私钥登录',
|
|
|
|
|
|
helper: '私钥或密码必填一项',
|
2024-05-27 18:38:41 +08:00
|
|
|
|
component: {
|
|
|
|
|
|
name: 'a-textarea',
|
|
|
|
|
|
vModel: 'value',
|
|
|
|
|
|
},
|
2024-08-27 13:46:19 +08:00
|
|
|
|
encrypt: true,
|
2024-05-27 18:38:41 +08:00
|
|
|
|
})
|
|
|
|
|
|
privateKey!: string;
|
2024-06-19 00:21:13 +08:00
|
|
|
|
|
|
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '私钥密码',
|
|
|
|
|
|
helper: '如果你的私钥有密码的话',
|
|
|
|
|
|
component: {
|
|
|
|
|
|
name: 'a-input-password',
|
|
|
|
|
|
vModel: 'value',
|
|
|
|
|
|
},
|
2024-08-27 13:46:19 +08:00
|
|
|
|
encrypt: true,
|
2024-06-19 00:21:13 +08:00
|
|
|
|
})
|
|
|
|
|
|
passphrase!: string;
|
2024-06-27 16:38:43 +08:00
|
|
|
|
|
2024-09-29 11:50:59 +08:00
|
|
|
|
@AccessInput({
|
2024-09-29 11:53:03 +08:00
|
|
|
|
title: 'socks代理',
|
|
|
|
|
|
helper: 'socks代理配置,格式:socks5://user:password@host:port',
|
2024-09-29 11:50:59 +08:00
|
|
|
|
component: {
|
|
|
|
|
|
name: 'a-input',
|
|
|
|
|
|
vModel: 'value',
|
2024-10-18 12:06:27 +08:00
|
|
|
|
placeholder: 'socks5://user:password@host:port',
|
2024-09-29 11:50:59 +08:00
|
|
|
|
},
|
|
|
|
|
|
encrypt: false,
|
|
|
|
|
|
})
|
|
|
|
|
|
socksProxy!: string;
|
|
|
|
|
|
|
2024-06-27 16:38:43 +08:00
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '是否Windows',
|
2024-10-25 21:47:28 +08:00
|
|
|
|
helper: '如果是Windows主机,请勾选此项\n并且需要windows[安装OpenSSH](https://certd.docmirror.cn/guide/use/host/windows.html)',
|
2024-06-27 16:38:43 +08:00
|
|
|
|
component: {
|
|
|
|
|
|
name: 'a-switch',
|
|
|
|
|
|
vModel: 'checked',
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
2024-07-03 23:39:12 +08:00
|
|
|
|
windows = false;
|
2024-06-27 16:38:43 +08:00
|
|
|
|
|
|
|
|
|
|
@AccessInput({
|
|
|
|
|
|
title: '命令编码',
|
|
|
|
|
|
helper: '如果是Windows主机,且出现乱码了,请尝试设置为GBK',
|
|
|
|
|
|
component: {
|
|
|
|
|
|
name: 'a-select',
|
|
|
|
|
|
vModel: 'value',
|
2024-07-03 23:39:12 +08:00
|
|
|
|
options: [
|
|
|
|
|
|
{ value: '', label: '默认' },
|
|
|
|
|
|
{ value: 'GBK', label: 'GBK' },
|
|
|
|
|
|
{ value: 'UTF8', label: 'UTF-8' },
|
|
|
|
|
|
],
|
2024-06-27 16:38:43 +08:00
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
encoding: string;
|
2024-05-27 18:38:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
new SshAccess();
|