Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateProxyChain(chain *ProxyChainConfig) error
- type Asset
- func (a *Asset) CanConnect() bool
- func (a *Asset) GetCommandPolicy() (*CommandPolicy, error)
- func (a *Asset) GetDatabaseConfig() (*DatabaseConfig, error)
- func (a *Asset) GetEtcdConfig() (*EtcdConfig, error)
- func (a *Asset) GetEtcdPolicy() (*EtcdPolicy, error)
- func (a *Asset) GetK8sConfig() (*K8sConfig, error)
- func (a *Asset) GetK8sPolicy() (*K8sPolicy, error)
- func (a *Asset) GetKafkaConfig() (*KafkaConfig, error)
- func (a *Asset) GetKafkaPolicy() (*KafkaPolicy, error)
- func (a *Asset) GetLocalConfig() (*LocalConfig, error)
- func (a *Asset) GetMongoDBConfig() (*MongoDBConfig, error)
- func (a *Asset) GetMongoPolicy() (*MongoPolicy, error)
- func (a *Asset) GetOSSConfig() (*OSSConfig, error)
- func (a *Asset) GetQueryPolicy() (*QueryPolicy, error)
- func (a *Asset) GetRDPConfig() (*RDPConfig, error)
- func (a *Asset) GetRedisConfig() (*RedisConfig, error)
- func (a *Asset) GetRedisPolicy() (*RedisPolicy, error)
- func (a *Asset) GetSSHConfig() (*SSHConfig, error)
- func (a *Asset) GetSerialConfig() (*SerialConfig, error)
- func (a *Asset) GetVNCConfig() (*VNCConfig, error)
- func (a *Asset) IsDatabase() bool
- func (a *Asset) IsEtcd() bool
- func (a *Asset) IsK8s() bool
- func (a *Asset) IsKafka() bool
- func (a *Asset) IsLocal() bool
- func (a *Asset) IsMongoDB() bool
- func (a *Asset) IsOSS() bool
- func (a *Asset) IsRDP() bool
- func (a *Asset) IsRedis() bool
- func (a *Asset) IsSSH() bool
- func (a *Asset) IsSerial() bool
- func (a *Asset) IsVNC() bool
- func (a *Asset) SSHAddress() (string, error)
- func (a *Asset) SetCommandPolicy(p *CommandPolicy) error
- func (a *Asset) SetDatabaseConfig(cfg *DatabaseConfig) error
- func (a *Asset) SetEtcdConfig(cfg *EtcdConfig) error
- func (a *Asset) SetEtcdPolicy(p *EtcdPolicy) error
- func (a *Asset) SetK8sConfig(cfg *K8sConfig) error
- func (a *Asset) SetK8sPolicy(p *K8sPolicy) error
- func (a *Asset) SetKafkaConfig(cfg *KafkaConfig) error
- func (a *Asset) SetKafkaPolicy(p *KafkaPolicy) error
- func (a *Asset) SetLocalConfig(cfg *LocalConfig) error
- func (a *Asset) SetMongoDBConfig(cfg *MongoDBConfig) error
- func (a *Asset) SetMongoPolicy(p *MongoPolicy) error
- func (a *Asset) SetOSSConfig(cfg *OSSConfig) error
- func (a *Asset) SetQueryPolicy(p *QueryPolicy) error
- func (a *Asset) SetRDPConfig(cfg *RDPConfig) error
- func (a *Asset) SetRedisConfig(cfg *RedisConfig) error
- func (a *Asset) SetRedisPolicy(p *RedisPolicy) error
- func (a *Asset) SetSSHConfig(cfg *SSHConfig) error
- func (a *Asset) SetSerialConfig(cfg *SerialConfig) error
- func (a *Asset) SetVNCConfig(cfg *VNCConfig) error
- func (Asset) TableName() string
- func (a *Asset) Validate() error
- type CommandPolicy
- type DatabaseConfig
- type DatabaseDriver
- type EtcdConfig
- type EtcdPolicy
- type K8sConfig
- type K8sPolicy
- type KafkaConfig
- type KafkaConnectClusterConfig
- type KafkaConnectConfig
- type KafkaPolicy
- type KafkaSchemaRegistryConfig
- type LocalConfig
- type MongoDBConfig
- type MongoPolicy
- type OSSConfig
- type ProxyChainConfig
- type ProxyChainLayer
- type ProxyConfig
- type QueryPolicy
- type RDPConfig
- type RedisConfig
- type RedisPolicy
- type SQLiteSource
- type SSHConfig
- type SerialConfig
- type VNCConfig
Constants ¶
const ( AssetTypeSSH = "ssh" AssetTypeDatabase = "database" AssetTypeRedis = "redis" AssetTypeMongoDB = "mongodb" AssetTypeKafka = "kafka" AssetTypeK8s = "k8s" AssetTypeSerial = "serial" AssetTypeEtcd = "etcd" AssetTypeLocal = "local" AssetTypeVNC = "vnc" AssetTypeRDP = "rdp" AssetTypeOSS = "oss" )
资产类型常量
const ( AuthTypePassword = "password" AuthTypeKey = "key" )
认证方式常量
const ( StatusActive = 1 StatusDeleted = 2 )
状态常量
const ( ProxyChainLayerSSH = "ssh" ProxyChainLayerSOCKS5 = "socks5" ProxyChainLayerHTTPTunnel = "http_tunnel" )
const ( KafkaSASLNone = "none" KafkaSASLPlain = "plain" KafkaSASLSCRAMSHA256 = "scram-sha-256" KafkaSASLSCRAMSHA512 = "scram-sha-512" )
Kafka SASL 机制常量
Variables ¶
var DefaultCommandPolicy = policy.DefaultCommandPolicy
DefaultCommandPolicy 返回默认命令权限策略
var DefaultEtcdPolicy = policy.DefaultEtcdPolicy
DefaultEtcdPolicy 返回默认 etcd 权限策略
var DefaultK8sPolicy = policy.DefaultK8sPolicy
DefaultK8sPolicy 返回默认 K8S 权限策略
var DefaultKafkaPolicy = policy.DefaultKafkaPolicy
DefaultKafkaPolicy 返回默认 Kafka 权限策略
var DefaultMongoPolicy = policy.DefaultMongoPolicy
DefaultMongoPolicy 返回默认 MongoDB 权限策略
var DefaultQueryPolicy = policy.DefaultQueryPolicy
DefaultQueryPolicy 返回默认 SQL 权限策略
var DefaultRedisPolicy = policy.DefaultRedisPolicy
DefaultRedisPolicy 返回默认 Redis 权限策略
Functions ¶
func ValidateProxyChain ¶ added in v1.11.0
func ValidateProxyChain(chain *ProxyChainConfig) error
Types ¶
type Asset ¶
type Asset struct {
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
Name string `gorm:"column:name;type:varchar(255);not null"`
Type string `gorm:"column:type;type:varchar(50);not null;index"`
GroupID int64 `gorm:"column:group_id;index"`
Icon string `gorm:"column:icon;type:varchar(100)"`
Tags string `gorm:"column:tags;type:text"`
Description string `gorm:"column:description;type:text"`
Config string `gorm:"column:config;type:text"`
CmdPolicy string `gorm:"column:command_policy;type:text"`
SortOrder int `gorm:"column:sort_order;default:0"`
SSHTunnelID int64 `gorm:"column:ssh_tunnel_id;default:0" json:"sshTunnelId"`
ExtensionName string `gorm:"column:extension_name;type:varchar(64);index" json:"extensionName,omitempty"`
Status int `gorm:"column:status;default:1"`
Createtime int64 `gorm:"column:createtime"`
Updatetime int64 `gorm:"column:updatetime"`
}
Asset 通用资产实体(充血模型)
func (*Asset) GetCommandPolicy ¶
func (a *Asset) GetCommandPolicy() (*CommandPolicy, error)
GetCommandPolicy 解析命令权限策略
func (*Asset) GetDatabaseConfig ¶
func (a *Asset) GetDatabaseConfig() (*DatabaseConfig, error)
GetDatabaseConfig 解析数据库配置
func (*Asset) GetEtcdConfig ¶ added in v1.7.0
func (a *Asset) GetEtcdConfig() (*EtcdConfig, error)
GetEtcdConfig 解析etcd配置
func (*Asset) GetEtcdPolicy ¶ added in v1.7.0
func (a *Asset) GetEtcdPolicy() (*EtcdPolicy, error)
GetEtcdPolicy 解析etcd权限策略
func (*Asset) GetK8sConfig ¶ added in v1.5.0
GetK8sConfig 解析K8S配置
func (*Asset) GetK8sPolicy ¶ added in v1.5.0
GetK8sPolicy 解析K8S权限策略
func (*Asset) GetKafkaConfig ¶ added in v1.5.0
func (a *Asset) GetKafkaConfig() (*KafkaConfig, error)
GetKafkaConfig 解析 Kafka 配置
func (*Asset) GetKafkaPolicy ¶ added in v1.5.0
func (a *Asset) GetKafkaPolicy() (*KafkaPolicy, error)
GetKafkaPolicy 解析 Kafka 权限策略
func (*Asset) GetLocalConfig ¶ added in v1.8.0
func (a *Asset) GetLocalConfig() (*LocalConfig, error)
GetLocalConfig 解析本地终端配置
func (*Asset) GetMongoDBConfig ¶ added in v1.2.0
func (a *Asset) GetMongoDBConfig() (*MongoDBConfig, error)
GetMongoDBConfig 解析MongoDB配置
func (*Asset) GetMongoPolicy ¶ added in v1.2.0
func (a *Asset) GetMongoPolicy() (*MongoPolicy, error)
GetMongoPolicy 解析MongoDB权限策略
func (*Asset) GetOSSConfig ¶ added in v1.10.0
GetOSSConfig 解析资产配置 JSON 为 OSSConfig。
func (*Asset) GetQueryPolicy ¶
func (a *Asset) GetQueryPolicy() (*QueryPolicy, error)
GetQueryPolicy 解析SQL权限策略(database类型)
func (*Asset) GetRDPConfig ¶ added in v1.10.0
GetRDPConfig 解析 RDP 配置
func (*Asset) GetRedisConfig ¶
func (a *Asset) GetRedisConfig() (*RedisConfig, error)
GetRedisConfig 解析Redis配置
func (*Asset) GetRedisPolicy ¶
func (a *Asset) GetRedisPolicy() (*RedisPolicy, error)
GetRedisPolicy 解析Redis权限策略
func (*Asset) GetSSHConfig ¶
GetSSHConfig 解析SSH配置
func (*Asset) GetSerialConfig ¶ added in v1.6.0
func (a *Asset) GetSerialConfig() (*SerialConfig, error)
GetSerialConfig 解析串口配置
func (*Asset) GetVNCConfig ¶ added in v1.11.0
GetVNCConfig 解析 VNC 配置
func (*Asset) SSHAddress ¶
SSHAddress 返回 host:port 格式地址
func (*Asset) SetCommandPolicy ¶
func (a *Asset) SetCommandPolicy(p *CommandPolicy) error
SetCommandPolicy 序列化命令权限策略
func (*Asset) SetDatabaseConfig ¶
func (a *Asset) SetDatabaseConfig(cfg *DatabaseConfig) error
SetDatabaseConfig 序列化数据库配置到Config字段
func (*Asset) SetEtcdConfig ¶ added in v1.7.0
func (a *Asset) SetEtcdConfig(cfg *EtcdConfig) error
SetEtcdConfig 序列化etcd配置到Config字段
func (*Asset) SetEtcdPolicy ¶ added in v1.7.0
func (a *Asset) SetEtcdPolicy(p *EtcdPolicy) error
SetEtcdPolicy 序列化etcd权限策略
func (*Asset) SetK8sConfig ¶ added in v1.5.0
SetK8sConfig 序列化K8S配置到Config字段
func (*Asset) SetK8sPolicy ¶ added in v1.5.0
SetK8sPolicy 序列化K8S权限策略
func (*Asset) SetKafkaConfig ¶ added in v1.5.0
func (a *Asset) SetKafkaConfig(cfg *KafkaConfig) error
SetKafkaConfig 序列化 Kafka 配置到 Config 字段
func (*Asset) SetKafkaPolicy ¶ added in v1.5.0
func (a *Asset) SetKafkaPolicy(p *KafkaPolicy) error
SetKafkaPolicy 序列化 Kafka 权限策略
func (*Asset) SetLocalConfig ¶ added in v1.8.0
func (a *Asset) SetLocalConfig(cfg *LocalConfig) error
SetLocalConfig 序列化本地终端配置到 Config 字段
func (*Asset) SetMongoDBConfig ¶ added in v1.2.0
func (a *Asset) SetMongoDBConfig(cfg *MongoDBConfig) error
SetMongoDBConfig 序列化MongoDB配置到Config字段
func (*Asset) SetMongoPolicy ¶ added in v1.2.0
func (a *Asset) SetMongoPolicy(p *MongoPolicy) error
SetMongoPolicy 序列化MongoDB权限策略
func (*Asset) SetOSSConfig ¶ added in v1.10.0
SetOSSConfig 将 cfg 序列化进资产配置 JSON。
func (*Asset) SetQueryPolicy ¶
func (a *Asset) SetQueryPolicy(p *QueryPolicy) error
SetQueryPolicy 序列化SQL权限策略
func (*Asset) SetRDPConfig ¶ added in v1.10.0
SetRDPConfig 序列化 RDP 配置到 Config 字段
func (*Asset) SetRedisConfig ¶
func (a *Asset) SetRedisConfig(cfg *RedisConfig) error
SetRedisConfig 序列化Redis配置到Config字段
func (*Asset) SetRedisPolicy ¶
func (a *Asset) SetRedisPolicy(p *RedisPolicy) error
SetRedisPolicy 序列化Redis权限策略
func (*Asset) SetSSHConfig ¶
SetSSHConfig 序列化SSH配置到Config字段
func (*Asset) SetSerialConfig ¶ added in v1.6.0
func (a *Asset) SetSerialConfig(cfg *SerialConfig) error
SetSerialConfig 序列化串口配置到Config字段
func (*Asset) SetVNCConfig ¶ added in v1.11.0
SetVNCConfig 序列化 VNC 配置到 Config 字段
type CommandPolicy ¶
type CommandPolicy = policy.CommandPolicy
CommandPolicy 命令权限策略(类型别名,定义在 policy 包)
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver DatabaseDriver `json:"driver"`
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password,omitempty"` // credential_svc 加密(内联,向后兼容)
CredentialID int64 `json:"credential_id,omitempty"` // 统一凭证 ID(密码)
Database string `json:"database,omitempty"` // 默认数据库
SSLMode string `json:"ssl_mode,omitempty"` // postgresql: disable/require/verify-full
TLS bool `json:"tls,omitempty"` // mysql: 启用 TLS 加密连接
Params string `json:"params,omitempty"` // 额外连接参数
ReadOnly bool `json:"read_only,omitempty"` // 连接级只读
SSHAssetID int64 `json:"ssh_asset_id,omitempty"` // Deprecated: use Asset.SSHTunnelID
SQLiteSource SQLiteSource `json:"sqlite_source,omitempty"` // SQLite 文件来源: local(默认) / remote_ssh_vfs
Path string `json:"path,omitempty"` // SQLite 文件路径;local 为本地绝对路径,remote_ssh_vfs 为远端绝对路径
Proxy *ProxyConfig `json:"proxy,omitempty"` // SOCKS5 代理(与 SSH 隧道互斥,隧道优先)
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
DatabaseConfig 数据库类型的特定配置
func (*DatabaseConfig) GetCredentialID ¶ added in v1.2.0
func (c *DatabaseConfig) GetCredentialID() int64
DatabaseConfig PasswordSource implementation
func (*DatabaseConfig) GetPassword ¶ added in v1.2.0
func (c *DatabaseConfig) GetPassword() string
type DatabaseDriver ¶
type DatabaseDriver string
DatabaseDriver 数据库驱动类型
const ( DriverMySQL DatabaseDriver = "mysql" DriverPostgreSQL DatabaseDriver = "postgresql" DriverMSSQL DatabaseDriver = "mssql" DriverSQLite DatabaseDriver = "sqlite" )
type EtcdConfig ¶ added in v1.7.0
type EtcdConfig struct {
Endpoints []string `json:"endpoints"` // 至少 1 个 host:port
Username string `json:"username,omitempty"` // 留空 = 不启用 RBAC
Password string `json:"password,omitempty"` // AES-256-GCM 密文
CredentialID int64 `json:"credential_id,omitempty"`
SSHAssetID int64 `json:"ssh_asset_id,omitempty"` // Deprecated: use Asset.SSHTunnelID; kept for form test/backward compat
Proxy *ProxyConfig `json:"proxy,omitempty"` // SOCKS5 代理(与 SSH 隧道互斥,隧道优先)
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
TLS bool `json:"tls,omitempty"`
TLSInsecure bool `json:"tls_insecure,omitempty"`
TLSServerName string `json:"tls_server_name,omitempty"`
TLSCAFile string `json:"tls_ca_file,omitempty"`
TLSCertFile string `json:"tls_cert_file,omitempty"`
TLSKeyFile string `json:"tls_key_file,omitempty"`
DialTimeoutSeconds int `json:"dial_timeout_seconds,omitempty"`
CommandTimeoutSeconds int `json:"command_timeout_seconds,omitempty"`
}
EtcdConfig etcd类型的特定配置
func (*EtcdConfig) GetCredentialID ¶ added in v1.7.0
func (c *EtcdConfig) GetCredentialID() int64
EtcdConfig PasswordSource implementation
func (*EtcdConfig) GetPassword ¶ added in v1.7.0
func (c *EtcdConfig) GetPassword() string
type EtcdPolicy ¶ added in v1.7.0
type EtcdPolicy = policy.EtcdPolicy
EtcdPolicy etcd 权限策略(类型别名,定义在 policy 包)
type K8sConfig ¶ added in v1.5.0
type K8sConfig struct {
Kubeconfig string `json:"kubeconfig,omitempty"` // kubeconfig YAML 内容
Namespace string `json:"namespace,omitempty"` // 默认命名空间
Context string `json:"context,omitempty"` // kubeconfig context 名称
Proxy *ProxyConfig `json:"proxy,omitempty"` // SOCKS5 代理(与 SSH 隧道互斥,隧道优先)
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
K8sConfig K8S集群类型的特定配置
func (*K8sConfig) GetCredentialID ¶ added in v1.5.0
K8sConfig PasswordSource implementation. Kubeconfig 在落库时由 assettype/k8s.go 加密;返回密文走通用解密路径 (credential_resolver.ResolvePasswordGeneric)。
func (*K8sConfig) GetPassword ¶ added in v1.5.0
type KafkaConfig ¶ added in v1.5.0
type KafkaConfig struct {
Brokers []string `json:"brokers"`
ClientID string `json:"client_id,omitempty"`
SASLMechanism string `json:"sasl_mechanism,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CredentialID int64 `json:"credential_id,omitempty"`
TLS bool `json:"tls,omitempty"`
TLSInsecure bool `json:"tls_insecure,omitempty"`
TLSServerName string `json:"tls_server_name,omitempty"`
TLSCAFile string `json:"tls_ca_file,omitempty"`
TLSCertFile string `json:"tls_cert_file,omitempty"`
TLSKeyFile string `json:"tls_key_file,omitempty"`
RequestTimeoutSeconds int `json:"request_timeout_seconds,omitempty"`
MessagePreviewBytes int `json:"message_preview_bytes,omitempty"`
MessageFetchLimit int `json:"message_fetch_limit,omitempty"`
SSHAssetID int64 `json:"ssh_asset_id,omitempty"` // Deprecated: use Asset.SSHTunnelID
Proxy *ProxyConfig `json:"proxy,omitempty"` // SOCKS5 代理(与 SSH 隧道互斥,隧道优先)
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
SchemaRegistry KafkaSchemaRegistryConfig `json:"schema_registry,omitempty"`
Connect KafkaConnectConfig `json:"connect,omitempty"`
}
KafkaConfig Kafka 类型的特定配置
func (*KafkaConfig) GetCredentialID ¶ added in v1.5.0
func (c *KafkaConfig) GetCredentialID() int64
KafkaConfig PasswordSource implementation
func (*KafkaConfig) GetPassword ¶ added in v1.5.0
func (c *KafkaConfig) GetPassword() string
type KafkaConnectClusterConfig ¶ added in v1.5.0
type KafkaConnectClusterConfig struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
AuthType string `json:"auth_type,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CredentialID int64 `json:"credential_id,omitempty"`
TLSInsecure bool `json:"tls_insecure,omitempty"`
TLSServerName string `json:"tls_server_name,omitempty"`
TLSCAFile string `json:"tls_ca_file,omitempty"`
TLSCertFile string `json:"tls_cert_file,omitempty"`
TLSKeyFile string `json:"tls_key_file,omitempty"`
}
KafkaConnectClusterConfig 单个 Kafka Connect 集群配置
func (*KafkaConnectClusterConfig) GetCredentialID ¶ added in v1.5.0
func (c *KafkaConnectClusterConfig) GetCredentialID() int64
KafkaConnectClusterConfig PasswordSource implementation
func (*KafkaConnectClusterConfig) GetPassword ¶ added in v1.5.0
func (c *KafkaConnectClusterConfig) GetPassword() string
type KafkaConnectConfig ¶ added in v1.5.0
type KafkaConnectConfig struct {
Enabled bool `json:"enabled,omitempty"`
Clusters []KafkaConnectClusterConfig `json:"clusters,omitempty"`
}
KafkaConnectConfig Kafka Connect companion 配置
type KafkaPolicy ¶ added in v1.5.0
type KafkaPolicy = policy.KafkaPolicy
KafkaPolicy Kafka 权限策略(类型别名,定义在 policy 包)
type KafkaSchemaRegistryConfig ¶ added in v1.5.0
type KafkaSchemaRegistryConfig struct {
Enabled bool `json:"enabled,omitempty"`
URL string `json:"url,omitempty"`
AuthType string `json:"auth_type,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CredentialID int64 `json:"credential_id,omitempty"`
TLSInsecure bool `json:"tls_insecure,omitempty"`
TLSServerName string `json:"tls_server_name,omitempty"`
TLSCAFile string `json:"tls_ca_file,omitempty"`
TLSCertFile string `json:"tls_cert_file,omitempty"`
TLSKeyFile string `json:"tls_key_file,omitempty"`
}
KafkaSchemaRegistryConfig Schema Registry companion 配置
func (*KafkaSchemaRegistryConfig) GetCredentialID ¶ added in v1.5.0
func (c *KafkaSchemaRegistryConfig) GetCredentialID() int64
KafkaSchemaRegistryConfig PasswordSource implementation
func (*KafkaSchemaRegistryConfig) GetPassword ¶ added in v1.5.0
func (c *KafkaSchemaRegistryConfig) GetPassword() string
type LocalConfig ¶ added in v1.8.0
type LocalConfig struct {
Shell string `json:"shell,omitempty"` // 为空时运行时按 OS 兜底
Args []string `json:"args,omitempty"` // shell 参数
Cwd string `json:"cwd,omitempty"` // 工作目录
}
LocalConfig 本地终端(local)类型的特定配置。无 host/port/凭证。
func (*LocalConfig) GetCredentialID ¶ added in v1.8.0
func (c *LocalConfig) GetCredentialID() int64
LocalConfig PasswordSource implementation(本地终端无密码,返回空)
func (*LocalConfig) GetPassword ¶ added in v1.8.0
func (c *LocalConfig) GetPassword() string
type MongoDBConfig ¶ added in v1.2.0
type MongoDBConfig struct {
ConnectionURI string `json:"connection_uri,omitempty"` // 完整连接 URI(优先于手动配置)
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
ReplicaSet string `json:"replica_set,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CredentialID int64 `json:"credential_id,omitempty"` // 统一凭证 ID(密码)
Database string `json:"database,omitempty"` // 默认数据库
AuthSource string `json:"auth_source,omitempty"` // 认证源数据库
TLS bool `json:"tls,omitempty"`
SSHAssetID int64 `json:"ssh_asset_id,omitempty"` // Deprecated: use Asset.SSHTunnelID
Proxy *ProxyConfig `json:"proxy,omitempty"` // SOCKS5 代理(与 SSH 隧道互斥,隧道优先)
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
MongoDBConfig MongoDB类型的特定配置
func (*MongoDBConfig) GetCredentialID ¶ added in v1.2.0
func (c *MongoDBConfig) GetCredentialID() int64
MongoDBConfig PasswordSource implementation
func (*MongoDBConfig) GetPassword ¶ added in v1.2.0
func (c *MongoDBConfig) GetPassword() string
type MongoPolicy ¶ added in v1.2.0
type MongoPolicy = policy.MongoPolicy
MongoPolicy MongoDB 权限策略(类型别名,定义在 policy 包)
type OSSConfig ¶ added in v1.10.0
type OSSConfig struct {
Provider string `json:"provider"` // UI provider preset; connection behavior is determined by endpoint/region/addressing fields
Endpoint string `json:"endpoint"` // host 或 scheme://host[:port]
Region string `json:"region"`
AccessKeyID string `json:"access_key_id"`
SecretAccessKey string `json:"secret_access_key"` // 内联时为 AES-256-GCM 密文;托管时为空
CredentialID int64 `json:"credential_id"` // >0 表示引用托管密码凭证
UsePathStyle bool `json:"use_path_style"`
UseSSL bool `json:"use_ssl"`
SkipTLSVerify bool `json:"skip_tls_verify"`
ConnectTimeout int `json:"connect_timeout"` // 秒;0 表示默认
PartSizeMB int `json:"part_size_mb"` // 0 表示由 SDK 自动选择
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
OSSConfig 是对象存储(OSS)资产的每资产配置,序列化到 Asset.Config。
func (*OSSConfig) GetCredentialID ¶ added in v1.10.0
GetCredentialID 实现 credential_resolver.PasswordSource。
func (*OSSConfig) GetPassword ¶ added in v1.10.0
GetPassword 实现 credential_resolver.PasswordSource。
type ProxyChainConfig ¶ added in v1.11.0
type ProxyChainConfig struct {
Layers []ProxyChainLayer `json:"layers,omitempty"`
}
func EffectiveProxyChain ¶ added in v1.11.0
func EffectiveProxyChain(chain *ProxyChainConfig, tunnelID int64, proxy *ProxyConfig) *ProxyChainConfig
func NormalizeProxyChain ¶ added in v1.11.0
func NormalizeProxyChain(chain *ProxyChainConfig) *ProxyChainConfig
type ProxyChainLayer ¶ added in v1.11.0
type ProxyChainLayer struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Type string `json:"type"`
Order int `json:"order,omitempty"`
SSHAssetID int64 `json:"ssh_asset_id,omitempty"`
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
URL string `json:"url,omitempty"`
Token string `json:"token,omitempty"`
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}
type ProxyConfig ¶
type ProxyConfig struct {
Type string `json:"type"` // "socks5"
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
ProxyConfig 代理配置
type RDPConfig ¶ added in v1.10.0
type RDPConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password,omitempty"` // credential_svc 加密(内联,向后兼容)
CredentialID int64 `json:"credential_id,omitempty"` // 统一凭证 ID(密码)
Domain string `json:"domain,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Clipboard bool `json:"clipboard"`
SSHAssetID int64 `json:"ssh_asset_id,omitempty"` // 仅未保存配置的连接测试使用;已保存资产走 Asset.SSHTunnelID
Proxy *ProxyConfig `json:"proxy,omitempty"` // Deprecated: use ProxyChain
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
RDPConfig RDP 类型的特定配置。PoC 阶段只覆盖基础连接、分辨率和剪贴板。
func (*RDPConfig) GetCredentialID ¶ added in v1.10.0
RDPConfig PasswordSource implementation
func (*RDPConfig) GetPassword ¶ added in v1.10.0
type RedisConfig ¶
type RedisConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CredentialID int64 `json:"credential_id,omitempty"` // 统一凭证 ID(密码)
Database int `json:"database,omitempty"` // DB index
TLS bool `json:"tls,omitempty"` // 启用 TLS 加密连接
TLSInsecure bool `json:"tls_insecure,omitempty"` // 跳过 TLS 证书校验
TLSServerName string `json:"tls_server_name,omitempty"` // TLS SNI / ServerName
TLSCAFile string `json:"tls_ca_file,omitempty"` // CA 证书路径
TLSCertFile string `json:"tls_cert_file,omitempty"` // 客户端证书路径
TLSKeyFile string `json:"tls_key_file,omitempty"` // 客户端私钥路径
CommandTimeoutSeconds int `json:"command_timeout_seconds,omitempty"` // Redis 命令超时,0 使用默认值
ScanPageSize int `json:"scan_page_size,omitempty"` // Key 扫描分页大小,0 使用默认值
KeySeparator string `json:"key_separator,omitempty"` // 树形视图 key 分隔符,默认 ":"
SSHAssetID int64 `json:"ssh_asset_id,omitempty"` // Deprecated: use Asset.SSHTunnelID
Proxy *ProxyConfig `json:"proxy,omitempty"` // SOCKS5 代理(与 SSH 隧道互斥,隧道优先)
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
RedisConfig Redis类型的特定配置
func (*RedisConfig) GetCredentialID ¶ added in v1.2.0
func (c *RedisConfig) GetCredentialID() int64
RedisConfig PasswordSource implementation
func (*RedisConfig) GetPassword ¶ added in v1.2.0
func (c *RedisConfig) GetPassword() string
type SQLiteSource ¶ added in v1.10.0
type SQLiteSource string
const ( SQLiteSourceLocal SQLiteSource = "local" SQLiteSourceRemoteSSHVFS SQLiteSource = "remote_ssh_vfs" )
type SSHConfig ¶
type SSHConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
AuthType string `json:"auth_type"`
Password string `json:"password,omitempty"` // 加密后的密码(内联,向后兼容)
CredentialID int64 `json:"credential_id,omitempty"` // 统一凭证 ID(密码或密钥)
PrivateKeys []string `json:"private_keys,omitempty"` // 本地密钥文件路径(向后兼容)
PrivateKeyPassphrase string `json:"private_key_passphrase,omitempty"` // 本地密钥密码(加密存储)
JumpHostID int64 `json:"jump_host_id,omitempty"` // Deprecated: use Asset.SSHTunnelID
Proxy *ProxyConfig `json:"proxy,omitempty"`
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
// KeepAliveIntervalSeconds 覆盖该资产的 SSH 空闲保活心跳间隔(秒)。
// 0/缺省 = 跟随全局默认(System 设置里的保活间隔)。
KeepAliveIntervalSeconds int `json:"keepalive_interval_seconds,omitempty"`
// RestoreCwdOnReconnect 开启后,该资产 SSH 终端断线手动重连时自动 cd 回上次目录,
// 并在连接时自动启用目录同步以持续追踪 cwd(仅 bash/zsh/ksh/mksh)。
RestoreCwdOnReconnect bool `json:"restore_cwd_on_reconnect,omitempty"`
}
SSHConfig SSH类型的特定配置
type SerialConfig ¶ added in v1.6.0
type SerialConfig struct {
PortPath string `json:"port_path"` // 串口路径,如 COM3, /dev/ttyUSB0
BaudRate int `json:"baud_rate"` // 波特率,如 9600, 115200
DataBits int `json:"data_bits"` // 数据位: 5, 6, 7, 8
StopBits string `json:"stop_bits"` // 停止位: "1", "1.5", "2"
Parity string `json:"parity"` // 校验位: "none", "odd", "even", "mark", "space"
FlowControl string `json:"flow_control,omitempty"` // 流控制: "none", "hardware"("software" / XON-XOFF 暂未支持)
}
SerialConfig 串口(COM/TTY)类型的特定配置
func (*SerialConfig) GetCredentialID ¶ added in v1.6.0
func (c *SerialConfig) GetCredentialID() int64
SerialConfig PasswordSource implementation(串口无密码,返回空)
func (*SerialConfig) GetPassword ¶ added in v1.6.0
func (c *SerialConfig) GetPassword() string
type VNCConfig ¶ added in v1.11.0
type VNCConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CredentialID int64 `json:"credential_id,omitempty"`
FileSSHAssetID int64 `json:"file_ssh_asset_id,omitempty"`
ProxyChain *ProxyChainConfig `json:"proxy_chain,omitempty"`
}
VNCConfig VNC 远程桌面类型的特定配置。
func (*VNCConfig) GetCredentialID ¶ added in v1.11.0
VNCConfig PasswordSource implementation