model

package
v0.0.0-...-1569808 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: GPL-3.0 Imports: 12 Imported by: 15

Documentation

Index

Constants

View Source
const (
	InputUser   = "@INPUT"
	DynamicUser = "@USER"
	ANONUser    = "@ANON"
)
View Source
const (
	ProtocolSSH    = "ssh"
	ProtocolTelnet = "telnet"
	ProtocolK8S    = "k8s"
	ProtocolSFTP   = "sftp"
	ProtocolRedis  = "redis"
	ProtocolRDP    = "rdp"
)
View Source
const (
	PGSSLPrefer     = "prefer"
	PGSSLRequire    = "require"
	PGSSLVerifyCa   = "verify-ca"
	PGSSLVerifyFull = "verify-full"
)
View Source
const (
	OperateDownload = "download"
	OperateUpload   = "upload"
)
View Source
const (
	OperateRemoveDir = "rmdir"
	OperateRename    = "rename"
	OperateRenameDir = "rename_dir"
	OperateMkdir     = "mkdir"
	OperateDelete    = "delete"
	OperateSymlink   = "symlink"
)
View Source
const (
	NormalLevel  = 0
	WarningLevel = 4
	RejectLevel  = 5
	ReviewReject = 6
	ReviewAccept = 7
	ReviewCancel = 8
)
View Source
const (
	ActionReject        = "reject"
	ActionAccept        = "accept"
	ActionReview        = "review"
	ActionWarning       = "warning"
	ActionNotifyAndWarn = "notify_and_warn"
	ActionUnknown       = "Unknown"
)
View Source
const (
	TreeTypeNode  = "node"
	TreeTypeAsset = "asset"
)
View Source
const (
	ActionALL      = "all"
	ActionConnect  = "connect"
	ActionUpload   = "upload"
	ActionDownload = "download"
	ActionCopy     = "copy"
	ActionPaste    = "paste"
	ActionDelete   = "delete"
	ActionShare    = "share"
)
View Source
const (
	SuffixGz            = ".gz"
	SuffixReplayGz      = ".replay.gz"
	SuffixCastGz        = ".cast.gz"
	SuffixCast          = ".cast"
	SuffixGuac          = ".guac"
	SuffixPartReplay    = ".part.gz"
	SuffixReplayJson    = ".replay.json"
	SuffixReplayMP4     = ".replay.mp4"
	SuffixReplayPartMp4 = ".part.mp4"
)
View Source
const (
	TaskKillSession = "kill_session"

	TaskLockSession   = "lock_session"
	TaskUnlockSession = "unlock_session"

	TaskPermExpired = "perm_expired"
	TaskPermValid   = "perm_valid"
)
View Source
const (
	TicketOpen     = "pending"
	TicketApproved = "approved"
	TicketRejected = "rejected"
	TicketClosed   = "closed"
)
View Source
const (
	ACLReview = "acl_review"
	ACLReject = "acl_reject"

	ACLFaceVerify             = "acl_face_verify"
	ACLFaceOnline             = "acl_face_online"
	ACLFaceOnlineNotSupported = "acl_face_online_not_supported"
)
View Source
const (
	CodePermOk             = "perm_ok"
	CodePermAccountInvalid = "perm_account_invalid"
	CodePermExpired        = "perm_expired"
)
View Source
const ConnectApplet = "applet"
View Source
const (
	FtpTargetPrefix = "FTP_FILES"
)

Variables

View Source
var (
	AccessKeyNotFound     = errors.New("access key not found")
	AccessKeyFileNotFound = errors.New("access key file not found")
	AccessKeyInvalid      = errors.New("access key not valid")
)
View Source
var EmptyLifecycleLog = SessionLifecycleLog{}

Functions

func SortNodesByKey

func SortNodesByKey(nodes []Node)

Types

type AccessKey

type AccessKey struct {
	ID     string `json:"id"`
	Secret string `json:"secret"`
}

func LoadAccessKeyFromFile

func LoadAccessKeyFromFile(keyPath string) (AccessKey, error)

func (*AccessKey) LoadFromFile

func (ak *AccessKey) LoadFromFile(keyPath string) error

func (*AccessKey) LoadFromStr

func (ak *AccessKey) LoadFromStr(key string) error

func (*AccessKey) SaveToFile

func (ak *AccessKey) SaveToFile(path string) error

type Account

type Account struct {
	BaseAccount
	SuFrom     *BaseAccount `json:"su_from"`
	Privileged bool         `json:"privileged,omitempty"`
}

func (*Account) GetBaseAccount

func (a *Account) GetBaseAccount() *BaseAccount

type AccountAsset

type AccountAsset struct {
	Id       string       `json:"id"`
	Name     string       `json:"name"`
	Address  string       `json:"address"`
	Type     LabelValue   `json:"type"`
	Category LabelValue   `json:"category"`
	Platform BasePlatform `json:"platform"`
}

type AccountChat

type AccountChat struct {
	Id         string       `json:"id"`
	Name       string       `json:"name"`
	Username   string       `json:"username"`
	SecretType LabelValue   `json:"secret_type"`
	SuFrom     BaseAccount  `json:"su_from"`
	Asset      AccountAsset `json:"asset"`
	Version    int          `json:"version"`
	Source     LabelValue   `json:"source"`
	OrgId      string       `json:"org_id"`
	OrgName    string       `json:"org_name"`
	Privileged bool         `json:"privileged"`
	IsActive   bool         `json:"is_active"`

	Comment string `json:"comment"`
}

type AccountDetail

type AccountDetail struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	Username   string     `json:"username"`
	Secret     string     `json:"secret"`
	SecretType LabelValue `json:"secret_type"`
	HasSecret  bool       `json:"has_secret"`
	IsActive   bool       `json:"is_active"`
	Privileged bool       `json:"privileged"`
}

type Action

type Action LabelValue

type Actions

type Actions []Action

func (Actions) EnableConnect

func (a Actions) EnableConnect() bool

func (Actions) EnableCopy

func (a Actions) EnableCopy() bool

func (Actions) EnableDelete

func (a Actions) EnableDelete() bool

func (Actions) EnableDownload

func (a Actions) EnableDownload() bool

func (Actions) EnableDrive

func (a Actions) EnableDrive() bool

func (Actions) EnablePaste

func (a Actions) EnablePaste() bool

func (Actions) EnableShare

func (a Actions) EnableShare() bool

func (Actions) EnableUpload

func (a Actions) EnableUpload() bool

func (Actions) Permission

func (a Actions) Permission() Permission

type Applet

type Applet struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type AppletOption

type AppletOption struct {
	ID              string                 `json:"id"`
	Applet          Applet                 `json:"applet"`
	Host            Asset                  `json:"host"`
	Account         Account                `json:"account"`
	Gateway         *Gateway               `json:"gateway"`
	Platform        *Platform              `json:"platform"`
	RemoteAppOption RemoteAppCommandOption `json:"remote_app_option"`
	Error           string                 `json:"error"`
}

type Asset

type Asset struct {
	ID         string         `json:"id"`
	Address    string         `json:"address"`
	Name       string         `json:"name"`
	OrgID      string         `json:"org_id"`
	Protocols  []Protocol     `json:"protocols"`
	SpecInfo   SpecInfo       `json:"spec_info"`
	SecretInfo SecretInfo     `json:"secret_info"`
	Platform   BasePlatform   `json:"platform"`
	Category   LabelField     `json:"category,omitempty"`
	Type       LabelField     `json:"type,omitempty"`
	Info       map[string]any `json:"info,omitempty"`

	Domain *BaseDomain `json:"domain"` // token 方式获取的资产,domain 为 nil

	Comment  string `json:"comment"`
	OrgName  string `json:"org_name"`
	IsActive bool   `json:"is_active"` // 判断资产是否禁用

	Accounts Actions `json:"accounts,omitempty"` // 只有 detail api才会有这个字段

	Gateway *Gateway `json:"gateway,omitempty"`
}

func (*Asset) FilterProtocols

func (a *Asset) FilterProtocols(filter func(string) bool) []string

func (*Asset) IsSupportProtocol

func (a *Asset) IsSupportProtocol(protocol string) bool

func (*Asset) ProtocolPort

func (a *Asset) ProtocolPort(protocol string) int

func (*Asset) String

func (a *Asset) String() string

func (*Asset) SupportProtocols

func (a *Asset) SupportProtocols() []string

type AssetList

type AssetList []Asset

func (AssetList) SortBy

func (a AssetList) SortBy(tp string) AssetList

type AssetLoginTicketInfo

type AssetLoginTicketInfo struct {
	TicketId    string `json:"ticket_id"`
	NeedConfirm bool   `json:"need_confirm"`
	TicketInfo
}

type AssetMeta

type AssetMeta struct {
	OrgName     string `json:"org_name"`
	SupportSFTP bool   `json:"sftp"`
}

type AssetNodeSorter

type AssetNodeSorter struct {
	// contains filtered or unexported fields
}

func (*AssetNodeSorter) Len

func (a *AssetNodeSorter) Len() int

func (*AssetNodeSorter) Less

func (a *AssetNodeSorter) Less(i, j int) bool

func (*AssetNodeSorter) Swap

func (a *AssetNodeSorter) Swap(i, j int)

type BaseAccount

type BaseAccount struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	Username   string     `json:"username"`
	Secret     string     `json:"secret"`
	SecretType LabelValue `json:"secret_type"`

	// SSHCertificatePrivateKey is generated and populated by a component such
	// as Koko. It is process-local and must never be serialized or logged.
	SSHCertificatePrivateKey []byte `json:"-"`
}

func (*BaseAccount) ClearSSHCertificateCredential

func (a *BaseAccount) ClearSSHCertificateCredential()

func (*BaseAccount) ClearSSHCertificatePrivateKey

func (a *BaseAccount) ClearSSHCertificatePrivateKey()

func (*BaseAccount) HashId

func (a *BaseAccount) HashId() string

func (*BaseAccount) IsAnonymous

func (a *BaseAccount) IsAnonymous() bool

func (*BaseAccount) IsNull

func (a *BaseAccount) IsNull() bool

func (*BaseAccount) IsSSHCertificate

func (a *BaseAccount) IsSSHCertificate() bool

func (*BaseAccount) IsSSHKey

func (a *BaseAccount) IsSSHKey() bool

func (*BaseAccount) String

func (a *BaseAccount) String() string

type BaseDomain

type BaseDomain struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type BasePlatform

type BasePlatform struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type ClipboardPolicy

type ClipboardPolicy struct {
	Copy  *ClipboardPolicyItem `json:"copy"`
	Paste *ClipboardPolicyItem `json:"paste"`
}

type ClipboardPolicyItem

type ClipboardPolicyItem struct {
	Enabled       bool    `json:"enabled"`
	Action        string  `json:"action"`
	PermAllowed   bool    `json:"perm_allowed"`
	ACLAction     *string `json:"acl_action"`
	TextLimit     int     `json:"text_limit"`
	FileSizeLimit int     `json:"file_size_limit"`
}

type Command

type Command struct {
	SessionID string `json:"session"`
	OrgID     string `json:"org_id"`
	Input     string `json:"input"`
	Output    string `json:"output"`
	User      string `json:"user"`
	Server    string `json:"asset"`
	Account   string `json:"account"`
	Timestamp int64  `json:"timestamp"`
	RiskLevel int64  `json:"risk_level"`

	CmdFilterAclId string `json:"cmd_filter_acl"`
	CmdGroupId     string `json:"cmd_group"`

	DateCreated time.Time `json:"@timestamp"`
}

type CommandACL

type CommandACL struct {
	ID            string              `json:"id"`
	Action        CommandAction       `json:"action"`
	CommandGroups []CommandFilterItem `json:"command_groups"`
	IsActive      bool                `json:"is_active"`
	Name          string              `json:"name"`
	Priority      int                 `json:"priority"`
	Reviewers     []interface{}       `json:"reviewers"`
}

func (*CommandACL) Match

type CommandACLs

type CommandACLs []CommandACL

func (CommandACLs) Len

func (f CommandACLs) Len() int

func (CommandACLs) Less

func (f CommandACLs) Less(i, j int) bool

func (CommandACLs) Swap

func (f CommandACLs) Swap(i, j int)

type CommandAction

type CommandAction string

type CommandConfig

type CommandConfig struct {
	TypeName string     `json:"TYPE"`
	Other    *OtherMeta `json:"OTHER,omitempty"`
	Index    string     `json:"INDEX,omitempty"`
	Hosts    []string   `json:"HOSTS,omitempty"`
	DocType  string     `json:"DOC_TYPE,omitempty"`

	ServerURL   string `json:"SERVER_URL,omitempty"`
	AuthToken   string `json:"AUTH_TOKEN,omitempty"`
	Bucket      string `json:"BUCKET,omitempty"`
	Measurement string `json:"MEASUREMENT,omitempty"`
}

type CommandFilterItem

type CommandFilterItem struct {
	ID         string `json:"id"`
	Content    string `json:"content"`
	IgnoreCase bool   `json:"ignore_case"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	RePattern  string `json:"pattern"`
	// contains filtered or unexported fields
}

func (*CommandFilterItem) Pattern

func (cf *CommandFilterItem) Pattern() FindStringer

type CommandTicketInfo

type CommandTicketInfo struct {
	TicketInfo
}

type Component

type Component string
const (
	Koko      Component = "koko"
	Guacamole Component = "guacamole"
	Omnidb    Component = "omnidb"
	Xrdp      Component = "xrdp"
	Lion      Component = "lion"
	Magnus    Component = "magnus"
	Razor     Component = "razor"

	UnknownComponent Component = "Unknown"
)

func SupportedComponent

func SupportedComponent(s string) (Component, bool)

type ConnectMethod

type ConnectMethod struct {
	Component string `json:"component"`
	Type      string `json:"type"`
	Label     string `json:"label"`
	Value     string `json:"value"`
}

type ConnectOptions

type ConnectOptions struct {
	Charset            *string `json:"charset,omitempty"`
	DisableAutoHash    *bool   `json:"disableautohash,omitempty"`
	BackspaceAsCtrlH   *bool   `json:"backspaceAsCtrlH,omitempty"`
	UseSysDBA          bool    `json:"use_sysdba,omitempty"`
	Resolution         string  `json:"resolution"`
	RemoteMicrophone   *bool   `json:"remote_microphone,omitempty"`
	RDPConnectionSpeed string  `json:"rdp_connection_speed,omitempty"`

	FilenameConflictResolution string `json:"file_name_conflict_resolution,omitempty"`
	TerminalThemeName          string `json:"terminal_theme_name,omitempty"`
	Language                   string `json:"lang,omitempty"`
}

type ConnectToken

type ConnectToken struct {
	Id       string     `json:"id"`
	User     User       `json:"user"`
	Value    string     `json:"value"`
	Account  Account    `json:"account"`
	Actions  Actions    `json:"actions"`
	Asset    Asset      `json:"asset"`
	Protocol string     `json:"protocol"`
	Domain   *Domain    `json:"domain"`
	Zone     *Domain    `json:"zone"`
	Gateway  *Gateway   `json:"gateway"`
	ExpireAt ExpireInfo `json:"expire_at"`
	OrgId    string     `json:"org_id"`
	OrgName  string     `json:"org_name"`
	Platform Platform   `json:"platform"`

	ConnectMethod ConnectMethod `json:"connect_method"`

	ConnectOptions ConnectOptions `json:"connect_options"`

	CommandFilterACLs []CommandACL `json:"command_filter_acls"`

	ClipboardPolicy  *ClipboardPolicy  `json:"clipboard_policy"`
	DataMaskingRules []DataMaskingRule `json:"data_masking_rules"`

	Ticket           *ObjectId           `json:"from_ticket,omitempty"`
	TicketInfo       interface{}         `json:"from_ticket_info,omitempty"`
	FaceMonitorToken string              `json:"face_monitor_token,omitempty"`
	SSHCertificate   *SSHCertificateInfo `json:"ssh_certificate,omitempty"`

	Code   string `json:"code"`
	Detail string `json:"detail"`
	Error  string `json:"error"`
}

func (*ConnectToken) ClearSSHCertificateCredential

func (c *ConnectToken) ClearSSHCertificateCredential()

func (*ConnectToken) ClearSSHCertificatePrivateKey

func (c *ConnectToken) ClearSSHCertificatePrivateKey()

func (*ConnectToken) CreateSession

func (c *ConnectToken) CreateSession(addr string,
	loginFrom, SessionType LabelField) Session

type ConnectTokenInfo

type ConnectTokenInfo struct {
	ID                   string          `json:"id"`
	Value                string          `json:"value"`
	ExpireTime           int             `json:"expire_time"`
	Protocol             string          `json:"protocol"`
	Account              string          `json:"account,omitempty"`
	User                 *ObjectId       `json:"user,omitempty"`
	Asset                *ObjectId       `json:"asset,omitempty"`
	InputUsername        string          `json:"input_username,omitempty"`
	InputSecretType      string          `json:"input_secret_type,omitempty"`
	PersonalCredentialID *string         `json:"personal_credential_id,omitempty"`
	ConnectMethod        string          `json:"connect_method,omitempty"`
	ConnectOptions       ConnectOptions  `json:"connect_options,omitempty"`
	Actions              Actions         `json:"actions,omitempty"`
	IsActive             *bool           `json:"is_active,omitempty"`
	IsReusable           *bool           `json:"is_reusable,omitempty"`
	IsExpired            *bool           `json:"is_expired,omitempty"`
	DateExpired          *common.UTCTime `json:"date_expired,omitempty"`
	OrgID                string          `json:"org_id,omitempty"`
	OrgName              string          `json:"org_name,omitempty"`
	RemoteAddr           string          `json:"remote_addr,omitempty"`
	FaceToken            string          `json:"face_token,omitempty"`
	FaceMonitorToken     string          `json:"face_monitor_token,omitempty"`

	Ticket     *ObjectId  `json:"from_ticket,omitempty"`
	TicketInfo TicketInfo `json:"from_ticket_info,omitempty"`

	Code   string `json:"code,omitempty"`
	Detail string `json:"detail,omitempty"`
}

type DataMaskingRule

type DataMaskingRule struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	FieldsPattern string `json:"fields_pattern"`
	MaskingMethod string `json:"masking_method"`
	MaskPattern   string `json:"mask_pattern"`
	Priority      int    `json:"priority"`
	IsActive      bool   `json:"is_active"`
}

type DataMaskingRules

type DataMaskingRules []DataMaskingRule

func (DataMaskingRules) Len

func (f DataMaskingRules) Len() int

func (DataMaskingRules) Less

func (f DataMaskingRules) Less(i, j int) bool

func (DataMaskingRules) Swap

func (f DataMaskingRules) Swap(i, j int)

type Domain

type Domain struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	Gateways []Gateway `json:"gateways"`
}

type ExpireInfo

type ExpireInfo int64

func (ExpireInfo) IsExpired

func (e ExpireInfo) IsExpired(now time.Time) bool

type FTPLog

type FTPLog struct {
	ID         string         `json:"id"`
	User       string         `json:"user"`
	Asset      string         `json:"asset"`
	OrgID      string         `json:"org_id"`
	Account    string         `json:"account"`
	RemoteAddr string         `json:"remote_addr"`
	Operate    string         `json:"operate"`
	Path       string         `json:"filename"`
	DateStart  common.UTCTime `json:"date_start"`
	IsSuccess  bool           `json:"is_success"`
	Session    string         `json:"session"`
}

func (*FTPLog) TargetPath

func (f *FTPLog) TargetPath() string

type FindStringer

type FindStringer interface {
	FindString(s string) string
}

type Gateway

type Gateway struct {
	ID        string    `json:"id"`
	Name      string    `json:"Name"`
	Address   string    `json:"address"`
	Protocols Protocols `json:"protocols"`
	Account   Account   `json:"account"`
}

type Group

type Group struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type HeartbeatData

type HeartbeatData struct {
	SessionOnlineIds []string `json:"sessions"`
	SessionOnline    int      `json:"session_online"`
	CpuUsed          float64  `json:"cpu_load"`
	MemoryUsed       float64  `json:"memory_used"`
	DiskUsed         float64  `json:"disk_used"`
}

type KokoBasic

type KokoBasic struct {
	ThemeName string `json:"terminal_theme_name"`
}

type LabelField

type LabelField string
const (
	NORMALType  LabelField = "normal"
	TUNNELType  LabelField = "tunnel"
	COMMANDType LabelField = "command"
	SFTPType    LabelField = "sftp"
)
const (
	LoginFromSSH LabelField = "ST"
	LoginFromWeb LabelField = "WT"
	LoginFromRT  LabelField = "RT"
	LoginFromDT  LabelField = "DT"
	LoginFromVT  LabelField = "VT"
)

func (LabelField) MarshalJSON

func (s LabelField) MarshalJSON() ([]byte, error)

func (*LabelField) UnmarshalJSON

func (s *LabelField) UnmarshalJSON(bytes []byte) error

type LabelValue

type LabelValue struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type LifecycleEvent

type LifecycleEvent string
const (
	AssetConnectSuccess  LifecycleEvent = "asset_connect_success"
	AssetConnectFinished LifecycleEvent = "asset_connect_finished"
	CreateShareLink      LifecycleEvent = "create_share_link"
	UserJoinSession      LifecycleEvent = "user_join_session"
	UserLeaveSession     LifecycleEvent = "user_leave_session"
	AdminJoinMonitor     LifecycleEvent = "admin_join_monitor"
	AdminExitMonitor     LifecycleEvent = "admin_exit_monitor"
	ReplayConvertStart   LifecycleEvent = "replay_convert_start"
	ReplayConvertSuccess LifecycleEvent = "replay_convert_success"
	ReplayConvertFailure LifecycleEvent = "replay_convert_failure"
	ReplayUploadStart    LifecycleEvent = "replay_upload_start"
	ReplayUploadSuccess  LifecycleEvent = "replay_upload_success"
	ReplayUploadFailure  LifecycleEvent = "replay_upload_failure"
)

type MiniUser

type MiniUser struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Username string `json:"username"`
}

type Node

type Node struct {
	ID           string `json:"id"`
	Key          string `json:"key"`
	Name         string `json:"name"`
	Value        string `json:"value"`
	Parent       string `json:"parent"`
	AssetsAmount int    `json:"assets_amount"`
	OrgID        string `json:"org_id"`
}

type NodeList

type NodeList []Node

type NodeMeta

type NodeMeta struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type NodeTree

type NodeTree struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Title    string   `json:"title"`
	Pid      string   `json:"pId"`
	IsParent bool     `json:"isParent"`
	Meta     TreeMeta `json:"meta"`

	ChkDisabled bool `json:"chkDisabled"` // 判断资产是否禁用
}

type NodeTreeList

type NodeTreeList []NodeTree

type NodeTreeMeta

type NodeTreeMeta struct {
	NodeMeta
	AssetMeta
}

type ObjectId

type ObjectId struct {
	ID string `json:"id"`
}

type OrgRole

type OrgRole struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
}

type OtherMeta

type OtherMeta struct {
	IgnoreVerifyCerts bool `json:"IGNORE_VERIFY_CERTS,omitempty"`
	IsIndexDatastream bool `json:"IS_INDEX_DATASTREAM,omitempty"`
}

type PaginationParam

type PaginationParam struct {
	PageSize int
	Offset   int
	Searches []string
	Refresh  bool

	Order    string
	Category string
	Type     string
	IsActive bool

	Protocols []string
}

type PaginationResponse

type PaginationResponse struct {
	Total       int         `json:"count"`
	NextURL     string      `json:"next"`
	PreviousURL string      `json:"previous"`
	Data        []PermAsset `json:"results"`
}

type PermAccount

type PermAccount struct {
	Name       string  `json:"name"`
	Username   string  `json:"username"`
	SecretType string  `json:"secret_type"`
	HasSecret  bool    `json:"has_secret"`
	Actions    Actions `json:"actions"`
	Alias      string  `json:"alias"`

	Secret string
}

func (*PermAccount) IsAnonymous

func (a *PermAccount) IsAnonymous() bool

func (*PermAccount) IsInputUser

func (a *PermAccount) IsInputUser() bool

func (*PermAccount) IsSSHCertificate

func (a *PermAccount) IsSSHCertificate() bool

func (*PermAccount) IsSSHKey

func (a *PermAccount) IsSSHKey() bool

func (*PermAccount) String

func (a *PermAccount) String() string

type PermAccountList

type PermAccountList []PermAccount

func (PermAccountList) Len

func (a PermAccountList) Len() int

func (PermAccountList) Less

func (a PermAccountList) Less(i, j int) bool

func (PermAccountList) Swap

func (a PermAccountList) Swap(i, j int)

type PermAsset

type PermAsset struct {
	ID       string       `json:"id"`
	Name     string       `json:"name"`
	Address  string       `json:"address"`
	Comment  string       `json:"comment"`
	Platform BasePlatform `json:"platform"`
	OrgID    string       `json:"org_id"`
	OrgName  string       `json:"org_name"`
	IsActive bool         `json:"is_active"`
	Type     LabelField   `json:"type"`
	Category LabelField   `json:"category"`
}

func (*PermAsset) String

func (a *PermAsset) String() string

type PermAssetDetail

type PermAssetDetail struct {
	ID              string        `json:"id"`
	Name            string        `json:"name"`
	Address         string        `json:"address"`
	Comment         string        `json:"comment"`
	Platform        BasePlatform  `json:"platform"`
	OrgID           string        `json:"org_id"`
	OrgName         string        `json:"org_name"`
	IsActive        bool          `json:"is_active"`
	Type            LabelField    `json:"type"`
	Category        LabelField    `json:"category"`
	PermedAccounts  []PermAccount `json:"permed_accounts"`
	PermedProtocols []Protocol    `json:"permed_protocols"`
}

func (*PermAssetDetail) String

func (a *PermAssetDetail) String() string

func (*PermAssetDetail) SupportProtocol

func (a *PermAssetDetail) SupportProtocol(protocol string) bool

type PermAssetList

type PermAssetList []PermAsset

func (PermAssetList) SortBy

func (a PermAssetList) SortBy(tp string) PermAssetList

type Permission

type Permission struct {
	Actions []string `json:"actions"`
}

func (*Permission) EnableConnect

func (p *Permission) EnableConnect() bool

func (*Permission) EnableCopy

func (p *Permission) EnableCopy() bool

func (*Permission) EnableDelete

func (p *Permission) EnableDelete() bool

func (*Permission) EnableDownload

func (p *Permission) EnableDownload() bool

func (*Permission) EnableDrive

func (p *Permission) EnableDrive() bool

func (*Permission) EnablePaste

func (p *Permission) EnablePaste() bool

func (*Permission) EnableShare

func (p *Permission) EnableShare() bool

func (*Permission) EnableUpload

func (p *Permission) EnableUpload() bool

type Phone

type Phone struct {
	CountryCode string `json:"code"`
	Number      string `json:"phone"`
}

type Platform

type Platform struct {
	BaseOs   string                 `json:"base"`
	MetaData map[string]interface{} `json:"meta"`

	ID   int    `json:"id"`
	Name string `json:"name"`

	Protocols PlatformProtocols `json:"protocols"`
	Category  LabelValue        `json:"category"`
	Charset   LabelValue        `json:"charset"`
	Type      LabelValue        `json:"type"`
	SuEnabled bool              `json:"su_enabled"`
	SuMethod  *LabelValue       `json:"su_method,omitempty"`
	//DomainEnabled bool              `json:"domain_enabled"`
	Comment string `json:"comment"`
}

func (Platform) GetProtocol

func (p Platform) GetProtocol(protocol string) PlatformProtocol

func (Platform) GetProtocolSetting

func (p Platform) GetProtocolSetting(protocol string) (PlatformProtocol, bool)

type PlatformProtocol

type PlatformProtocol struct {
	Protocol
	Setting     map[string]any `json:"setting"` // 参考 ProtocolSetting 里的字段
	SecretTypes []string       `json:"secret_types,omitempty"`
}

func (PlatformProtocol) GetSetting

func (p PlatformProtocol) GetSetting() ProtocolSetting

type PlatformProtocols

type PlatformProtocols []PlatformProtocol

func (PlatformProtocols) GetSftpPath

func (p PlatformProtocols) GetSftpPath(protocol string) string

type Protocol

type Protocol struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	Port   int    `json:"port"`
	Public bool   `json:"public"`
}

type ProtocolSetting

type ProtocolSetting struct {
	Security            string `json:"security"`
	SftpEnabled         bool   `json:"sftp_enabled"`
	SftpHome            string `json:"sftp_home"`
	AutoFill            bool   `json:"auto_fill"`
	UsernameSelector    string `json:"username_selector"`
	PasswordSelector    string `json:"password_selector"`
	SubmitSelector      string `json:"submit_selector"`
	SuccessSelector     string `json:"success_selector,omitempty"`
	InteractiveSelector string `json:"interactive_selector,omitempty"`

	Console  bool   `json:"console"`
	AdDomain string `json:"ad_domain"`

	// for redis 特殊处理的字段
	AuthUsername bool `json:"auth_username"`

	TelnetUsernamePrompt string `json:"username_prompt"`
	TelnetPasswordPrompt string `json:"password_prompt"`
	TelnetSuccessPrompt  string `json:"success_prompt"`

	// for mongodb
	AuthSource     string `json:"auth_source"`
	ConnectionOpts string `json:"connection_options"`

	// for sqlserver
	Version string `json:"version"` // choice ('>=2014', '< 2014')
	Encrypt bool   `json:"encrypt"` // for sqlserver 2008

	EnableClusterMode bool `json:"enable_cluster_mode"` // for redis-cli
}

type Protocols

type Protocols []Protocol

func (Protocols) GetProtocolPort

func (p Protocols) GetProtocolPort(protocol string) int

func (Protocols) IsSupportProtocol

func (p Protocols) IsSupportProtocol(protocol string) bool

type PublicSetting

type PublicSetting struct {
	Interface struct {
		LoginTitle string `json:"login_title"`
		LogOut     string `json:"logo_logout"`
		Index      string `json:"logo_index"`
		Image      string `json:"login_image"`
		Favicon    string `json:"favicon"`
	} `json:"INTERFACE"`
	EnableWatermark    bool `json:"SECURITY_WATERMARK_ENABLED"`
	EnableSessionShare bool `json:"SECURITY_SESSION_SHARE"`
	EnableAnnouncement bool `json:"ANNOUNCEMENT_ENABLED"`
	Announcement       struct {
		Id        string         `json:"ID"`
		Subject   string         `json:"SUBJECT"`
		Content   string         `json:"CONTENT"`
		Link      string         `json:"LINK"`
		DateStart common.UTCTime `json:"DATE_START"`
		DateEnd   common.UTCTime `json:"DATE_END"`
	} `json:"ANNOUNCEMENT"`

	XpackEnabled bool `json:"XPACK_ENABLED"`
	ValidLicense bool `json:"XPACK_LICENSE_IS_VALID"`
}

type Regexp2

type Regexp2 struct {
	// contains filtered or unexported fields
}

func (*Regexp2) FindString

func (r *Regexp2) FindString(s string) string

type RemainReplay

type RemainReplay struct {
	Id          string // session id
	TargetDate  string
	AbsFilePath string
	Version     ReplayVersion
	IsGzip      bool
}

func (*RemainReplay) GetGzFilename

func (r *RemainReplay) GetGzFilename() string

func (*RemainReplay) TargetPath

func (r *RemainReplay) TargetPath() string

type RemoteAppCommandOption

type RemoteAppCommandOption struct {
	Program string `json:"remoteapplicationprogram:s"`
	Name    string `json:"remoteapplicationname:s"`
	Shell   string `json:"alternate shell:s"`
	CmdLine string `json:"remoteapplicationcmdline:s"`
}

type ReplayConfig

type ReplayConfig struct {
	TypeName string `json:"TYPE"`

	/*
		obs oss
	*/
	Endpoint  string `json:"ENDPOINT,omitempty"`
	Bucket    string `json:"BUCKET,omitempty"`
	AccessKey string `json:"ACCESS_KEY,omitempty"`
	SecretKey string `json:"SECRET_KEY,omitempty"`

	Region string `json:"REGION,omitempty"`

	/*
		azure 专属
	*/
	AccountName    string `json:"ACCOUNT_NAME,omitempty"`
	AccountKey     string `json:"ACCOUNT_KEY,omitempty"`
	EndpointSuffix string `json:"ENDPOINT_SUFFIX,omitempty"`
	ContainerName  string `json:"CONTAINER_NAME,omitempty"`
}

type ReplayError

type ReplayError LabelField
const (
	SessionReplayErrConnectFailed ReplayError = "connect_failed"
	SessionReplayErrCreatedFailed ReplayError = "replay_create_failed"
	SessionReplayErrUploadFailed  ReplayError = "replay_upload_failed"
	SessionReplayErrUnsupported   ReplayError = "replay_unsupported"
	SessionReplayErrConvertFailed ReplayError = "replay_convert_failed"
)

func (ReplayError) Error

func (r ReplayError) Error() string

type ReplayVersion

type ReplayVersion string
const (
	UnKnown  ReplayVersion = ""
	Version2 ReplayVersion = "2"
	Version3 ReplayVersion = "3"
	Version4 ReplayVersion = "4"
	Version5 ReplayVersion = "5"
)

func ParseReplayVersion

func ParseReplayVersion(gzFile string, defaultValue ReplayVersion) ReplayVersion

type ReqInfo

type ReqInfo struct {
	Method string `json:"method"`
	URL    string `json:"url"`
}

type SSHCertificateInfo

type SSHCertificateInfo struct {
	SerialNumber         string `json:"serial_number"`
	LeaseDuration        int    `json:"lease_duration"`
	KeyID                string `json:"key_id"`
	Principal            string `json:"principal"`
	PublicKeyFingerprint string `json:"public_key_fingerprint"`
}

type SecretInfo

type SecretInfo struct {
	CaCert     string `json:"ca_cert"`
	ClientCert string `json:"client_cert"`
	ClientKey  string `json:"client_key"`
}

type SecretType

type SecretType LabelValue

type Session

type Session struct {
	ID         string         `json:"id,omitempty"`
	User       string         `json:"user"`
	Asset      string         `json:"asset"`
	Account    string         `json:"account"`
	LoginFrom  LabelField     `json:"login_from,omitempty"`
	RemoteAddr string         `json:"remote_addr"`
	Protocol   string         `json:"protocol"`
	DateStart  common.UTCTime `json:"date_start"`
	OrgID      string         `json:"org_id"`
	UserID     string         `json:"user_id"`
	AssetID    string         `json:"asset_id"`
	AccountID  string         `json:"account_id"`
	Type       LabelField     `json:"type"`
	ErrReason  LabelField     `json:"error_reason,omitempty"`
	TokenId    string         `json:"token_id,omitempty"`
	Comment    string         `json:"comment,omitempty"`
	LangCode   string         `json:"lang_code,omitempty"`
}

type SessionLifecycleLog

type SessionLifecycleLog struct {
	Reason string `json:"reason"`
	User   string `json:"user"`
}

type SessionLifecycleReasonErr

type SessionLifecycleReasonErr string
const (
	ReasonErrConnectFailed     SessionLifecycleReasonErr = "connect_failed"
	ReasonErrConnectDisconnect SessionLifecycleReasonErr = "connect_disconnect"
	ReasonErrUserClose         SessionLifecycleReasonErr = "user_close"
	ReasonErrIdleDisconnect    SessionLifecycleReasonErr = "idle_disconnect"
	ReasonErrAdminTerminate    SessionLifecycleReasonErr = "admin_terminate"
	ReasonErrMaxSessionTimeout SessionLifecycleReasonErr = "max_session_timeout"
	ReasonErrPermissionExpired SessionLifecycleReasonErr = "permission_expired"
	ReasonErrNullStorage       SessionLifecycleReasonErr = "null_storage"
)

func (SessionLifecycleReasonErr) String

func (s SessionLifecycleReasonErr) String() string

type SharePostData

type SharePostData struct {
	ShareId    string `json:"sharing"`
	Code       string `json:"verify_code"`
	UserId     string `json:"joiner"`
	RemoteAddr string `json:"remote_addr"`
}

type ShareRecord

type ShareRecord struct {
	ID      string   `json:"id"`
	Code    string   `json:"verify_code"`
	Session ObjectId `json:"session"`
	Sharing ObjectId `json:"sharing"`
	OrgId   string   `json:"org_id"`
	OrgName string   `json:"org_name"`

	ActionPermission LabelValue `json:"action_permission"`

	Err interface{} `json:"error"`
}

func (ShareRecord) Writeable

func (s ShareRecord) Writeable() bool

type SharingSession

type SharingSession struct {
	ID          string `json:"id"`
	IsActive    bool   `json:"is_active"`
	ExpiredTime int    `json:"expired_time"`
	Code        string `json:"verify_code"`

	ActionPermission string `json:"action_permission"`
}

type SharingSessionRequest

type SharingSessionRequest struct {
	SessionID  string   `json:"session"`
	ExpireTime int      `json:"expired_time"`
	Users      []string `json:"users"`
	ActionPerm string   `json:"action_permission"`
	OriginURL  string   `json:"origin"`
}

type SpecInfo

type SpecInfo struct {
	// database
	DBName string `json:"db_name"`

	PgSSLMode string `json:"pg_ssl_mode"`

	UseSSL           bool `json:"use_ssl"`
	AllowInvalidCert bool `json:"allow_invalid_cert"`

	// web
	Autofill            string         `json:"autofill"`
	UsernameSelector    string         `json:"username_selector"`
	PasswordSelector    string         `json:"password_selector"`
	SubmitSelector      string         `json:"submit_selector"`
	HttpProxy           string         `json:"proxy"`
	SuccessSelector     string         `json:"success_selector,omitempty"`
	InteractiveSelector string         `json:"interactive_selector,omitempty"`
	Script              []WebLoginStep `json:"script,omitempty"`
	AllowedURLs         []string       `json:"allowed_urls,omitempty"`
}

type StdRegexp

type StdRegexp struct {
	// contains filtered or unexported fields
}

func (*StdRegexp) FindString

func (r *StdRegexp) FindString(s string) string

type SystemRole

type SystemRole struct {
	ID          string `json:"id"`
	DisplayName string `json:"display_name"`
}

type TaskKwargs

type TaskKwargs struct {
	TerminatedBy  string `json:"terminated_by"`
	CreatedByUser string `json:"created_by"`
}

type Terminal

type Terminal struct {
	Name           string `json:"name"`
	Comment        string `json:"comment"`
	ServiceAccount struct {
		ID        string    `json:"id"`
		Name      string    `json:"name"`
		AccessKey AccessKey `json:"access_key"`
	} `json:"service_account"`
}

type TerminalConfig

type TerminalConfig struct {
	AssetListPageSize   string        `json:"TERMINAL_ASSET_LIST_PAGE_SIZE"`
	AssetListSortBy     string        `json:"TERMINAL_ASSET_LIST_SORT_BY"`
	HeaderTitle         string        `json:"TERMINAL_HEADER_TITLE"`
	PasswordAuth        bool          `json:"TERMINAL_PASSWORD_AUTH"`
	PublicKeyAuth       bool          `json:"TERMINAL_PUBLIC_KEY_AUTH"`
	ReplayStorage       ReplayConfig  `json:"TERMINAL_REPLAY_STORAGE"`
	CommandStorage      CommandConfig `json:"TERMINAL_COMMAND_STORAGE"`
	SessionKeepDuration int           `json:"TERMINAL_SESSION_KEEP_DURATION"`
	TelnetRegex         string        `json:"TERMINAL_TELNET_REGEX"`
	MaxIdleTime         int           `json:"SECURITY_MAX_IDLE_TIME"`
	MaxSessionTime      int           `json:"SECURITY_MAX_SESSION_TIME"`
	HeartbeatDuration   int           `json:"TERMINAL_HEARTBEAT_INTERVAL"`
	HostKey             string        `json:"TERMINAL_HOST_KEY"`
	EnableSessionShare  bool          `json:"SECURITY_SESSION_SHARE"`
	MaxStoreFTPFileSize int           `json:"FTP_FILE_MAX_STORE"`
	ChatAIEnabled       bool          `json:"CHAT_AI_ENABLED"`
	ChatAIMethod        string        `json:"CHAT_AI_METHOD"`
	ChatAIProvider      string        `json:"CHAT_AI_PROVIDER"`
	ChatAIBaseUrl       string        `json:"CHAT_AI_BASE_URL"`
	ChatAIApiKey        string        `json:"CHAT_AI_API_KEY"`
	ChatAIProxy         string        `json:"CHAT_AI_PROXY"`
	ChatAIModel         string        `json:"CHAT_AI_MODEL"`

	LicenseContent string `json:"XPACK_LICENSE_CONTENT"`
	LicenseIsValid bool   `json:"XPACK_LICENSE_IS_VALID"`
}

type TerminalTask

type TerminalTask struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	Args       string     `json:"args"`
	Kwargs     TaskKwargs `json:"kwargs"`
	IsFinished bool

	TokenStatus TokenCheckStatus `json:"-"`
}

type TicketInfo

type TicketInfo struct {
	CheckReq        ReqInfo  `json:"check_ticket_api"`
	CloseReq        ReqInfo  `json:"close_ticket_api"`
	TicketDetailUrl string   `json:"ticket_detail_page_url"`
	Reviewers       []string `json:"assignees"`
}

type TicketState

type TicketState struct {
	ID        string     `json:"id"`
	Processor string     `json:"processor,omitempty"`
	State     LabelField `json:"state"`
	Status    LabelField `json:"status"`
}

type TokenCheckStatus

type TokenCheckStatus struct {
	Detail  string `json:"detail"`
	Code    string `json:"code"`
	Expired bool   `json:"expired"`
}

type TreeMeta

type TreeMeta struct {
	Type string       `json:"type"`
	Data NodeTreeMeta `json:"data"`
}

type User

type User struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Username         string `json:"username"`
	Email            string `json:"email"`
	Role             string `json:"role"`
	IsValid          bool   `json:"is_valid"`
	IsActive         bool   `json:"is_active"`
	OTPLevel         int    `json:"otp_level"`
	Language         string `json:"lang"`
	HasPublicKeys    bool   `json:"has_public_keys"`
	IsServiceAccount bool   `json:"is_service_account"`

	OrgRoles    []OrgRole    `json:"org_roles"`
	SystemRoles []SystemRole `json:"system_roles"`

	IsOrgAdmin  bool            `json:"is_org_admin"`
	IsSuperuser bool            `json:"is_superuser"`
	IsExpired   bool            `json:"is_expired"`
	Groups      []Group         `json:"groups"`
	DateExpired *common.UTCTime `json:"date_expired"`
	LastLogin   *common.UTCTime `json:"last_login"`
	Phone       Phone           `json:"phone"`
}

func (*User) String

func (u *User) String() string

type UserKokoPreference

type UserKokoPreference struct {
	Basic KokoBasic `json:"basic"`
}

type ValidateResult

type ValidateResult struct {
	Ok  bool   `json:"ok"`
	Msg string `json:"msg"`
	Err string `json:"error"`
}

type VirtualApp

type VirtualApp struct {
	Name          string              `json:"name"`
	ImageName     string              `json:"image_name"`
	ImageProtocol string              `json:"image_protocol"`
	ImagePort     int                 `json:"image_port"`
	Error         string              `json:"error"`
	Provider      *VirtualAppProvider `json:"provider,omitempty"`
}

type VirtualAppContainer

type VirtualAppContainer struct {
	ContainerId string `json:"container_id"`
	Host        string `json:"host"`
	Port        int    `json:"port"`
	Protocol    string `json:"protocol"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	SFTPPort    int    `json:"sftp_port"`
}

func (VirtualAppContainer) String

func (v VirtualAppContainer) String() string

type VirtualAppOption

type VirtualAppOption struct {
	ImageName     string `json:"image_name"`
	ImageProtocol string `json:"image_protocol"`
	ImagePort     int    `json:"image_port"`
	DesktopWidth  int    `json:"desktop_width"`
	DesktopHeight int    `json:"desktop_height"`
}

type VirtualAppProvider

type VirtualAppProvider struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Address string   `json:"address"`
	HostID  *string  `json:"host_id,omitempty"`
	Load    string   `json:"load"`
	Host    Asset    `json:"host"`
	Account Account  `json:"account"`
	Gateway *Gateway `json:"gateway,omitempty"`
}

type WebLoginStep

type WebLoginStep struct {
	Step    int    `json:"step"`
	Command string `json:"command"`
	Target  string `json:"target,omitempty"`
	Value   string `json:"value,omitempty"`
	Origin  string `json:"origin,omitempty"`
	Timeout int    `json:"timeout,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL