Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChallengeAnswerSource ¶ added in v0.16.0
type ChallengeAnswerSource string
ChallengeAnswerSource 定义 keyboard-interactive 规则的答案来源类型。
const ( ChallengeSourceOTP ChallengeAnswerSource = "otp" ChallengeSourceLoginPassword ChallengeAnswerSource = "login_password" ChallengeSourceSecret ChallengeAnswerSource = "secret" ChallengeSourceCommand ChallengeAnswerSource = "command" )
type ChallengeRule ¶ added in v0.16.0
type ChallengeRule struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
PromptPattern string `yaml:"prompt_pattern" json:"prompt_pattern"`
InstructionPattern string `yaml:"instruction_pattern,omitempty" json:"instruction_pattern,omitempty"`
Source ChallengeAnswerSource `yaml:"source" json:"source"`
SecretRef *credential.Ref `yaml:"secret_ref,omitempty" json:"secret_ref,omitempty"`
Command string `yaml:"command,omitempty" json:"command,omitempty"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}
ChallengeRule 定义单条 keyboard-interactive 问题正则匹配与自动应答规则。
func (ChallengeRule) Clone ¶ added in v0.16.0
func (r ChallengeRule) Clone() ChallengeRule
Clone returns a deep copy of ChallengeRule.
func (ChallengeRule) Equal ¶ added in v0.16.0
func (r ChallengeRule) Equal(other ChallengeRule) bool
Equal reports whether two ChallengeRule values are structurally equal.
type Host ¶
type Host struct {
Alias []string `yaml:"alias,omitempty"`
Address string `yaml:"address"` // IP 或 域名
Port uint16 `yaml:"port"`
}
Host 定义网络连接信息
type Identity ¶
type Identity struct {
User string `yaml:"user"`
KeyPath string `yaml:"key_path,omitempty"`
KeyFingerprint string `yaml:"key_fingerprint,omitempty"`
Passphrase string `yaml:"passphrase,omitempty"` // 私钥密码(Schema v1)
Password string `yaml:"password,omitempty"` // 登录密码(Schema v1)
AuthType string `yaml:"auth_type"` // "key", "password", "agent", "auto", "otp", "keyboard-interactive"
LoginPasswordRef *credential.Ref `yaml:"login_password_ref,omitempty"`
PassphraseRef *credential.Ref `yaml:"passphrase_ref,omitempty"`
OTP *OTPConfig `yaml:"otp,omitempty"`
KeyboardInteractive *KeyboardInteractiveConfig `yaml:"keyboard_interactive,omitempty"`
}
Identity 定义认证信息
type KeyboardInteractiveConfig ¶ added in v0.16.0
type KeyboardInteractiveConfig struct {
Rules []ChallengeRule `yaml:"rules,omitempty" json:"rules,omitempty"`
}
KeyboardInteractiveConfig 定义 keyboard-interactive 自动应答规则集。
func (*KeyboardInteractiveConfig) Clone ¶ added in v0.16.0
func (k *KeyboardInteractiveConfig) Clone() *KeyboardInteractiveConfig
Clone returns a deep copy of KeyboardInteractiveConfig.
func (*KeyboardInteractiveConfig) Equal ¶ added in v0.16.0
func (k *KeyboardInteractiveConfig) Equal(other *KeyboardInteractiveConfig) bool
Equal reports whether two KeyboardInteractiveConfig values are structurally equal.
type Node ¶
type Node struct {
Alias []string `yaml:"alias,omitempty"`
Tags []string `yaml:"tags,omitempty"` // 用于分组
// 引用解耦
HostRef string `yaml:"host_ref"`
IdentityRef string `yaml:"identity_ref"`
// 高级网络配置
ProxyJump string `yaml:"proxy_jump,omitempty"` // 指向另一个 Node 的 Name
// 提权配置
SudoMode SudoMode `yaml:"sudo_mode"` // 使用 SudoMode 枚举
SuPwd string `yaml:"su_pwd,omitempty"`
PrivilegePasswordRef *credential.Ref `yaml:"privilege_password_ref,omitempty"`
// 交互式拦截配置
PasswordPromptPattern string `yaml:"password_prompt_pattern,omitempty"` // 节点级自定义密码提示正则
// 执行环境配置
Execution *ssh.ExecutionConfig `yaml:"execution,omitempty" json:"execution,omitempty"`
// OpenSSH 客户端选项配置(支持连接复用、超时、主机密钥策略、算法与认证控制等)
SSHOptions *ssh.Options `yaml:"ssh_options,omitempty" json:"ssh_options,omitempty"`
// OpenSSHAlias 记录运行时从 ~/.ssh/config 具体 Host 块派生该节点时的源别名(不序列化落盘)
OpenSSHAlias string `yaml:"-" json:"-"`
}
Node 是用户操作的最小单元,聚合了 Host 和 Identity
type NodeFilter ¶
NodeFilter 用于批量操作时筛选节点
type OTPConfig ¶ added in v0.16.0
type OTPConfig struct {
TOTPSecretRef *credential.Ref `yaml:"totp_secret_ref,omitempty" json:"totp_secret_ref,omitempty"`
Command string `yaml:"command,omitempty" json:"command,omitempty"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"`
PromptPattern string `yaml:"prompt_pattern,omitempty" json:"prompt_pattern,omitempty"`
}
OTPConfig 定义身份的显式 OTP 自动化配置(支持托管 TOTP 种子或外部获取命令)。