Documentation ¶
Index ¶
- Constants
- Variables
- func SortNodesByKey(nodes []Node)
- func SortSystemUserByPriority(sysUsers []SystemUser)
- type AccessKey
- type Application
- type Asset
- type AssetList
- type AssetLoginTicketInfo
- type AssetMeta
- type AssetNodeSorter
- type Attrs
- type Command
- type CommandTicketInfo
- type ConnectTokenInfo
- type ConnectType
- type Domain
- type ExpireInfo
- type FTPLog
- type FilterRule
- type FilterRules
- type Gateway
- type HeartbeatData
- type MiniUser
- type Node
- type NodeList
- type NodeMeta
- type NodeTree
- type NodeTreeList
- type NodeTreeMeta
- type PaginationParam
- type PaginationResponse
- type Permission
- type Platform
- type PublicSetting
- type RemoteAPP
- type RemoteAppParameter
- type ReplayConfig
- type ReplayVersion
- type ReqInfo
- type RuleAction
- type Session
- type ShareRecord
- type SharingSession
- type SystemUser
- type SystemUserAuthInfo
- type TaskKwargs
- type Terminal
- type TerminalConfig
- type TerminalTask
- type TicketInfo
- type TicketState
- type TokenUser
- type TreeMeta
- type User
- type ValidateResult
Constants ¶
View Source
const ( AppTypeMySQL = "mysql" AppTypeK8s = "k8s" AppTypeMariaDB = "mariadb" AppTypeSQLServer = "sqlserver" AppTypePostgres = "postgresql" AppTypeRedis = "redis" AppTypeMongoDB = "mongodb" AppTypeSQLite = "sqlite" AppTypeOracle = "oracle" )
View Source
const ( ProtocolSSH = "ssh" ProtocolTelnet = "telnet" ProtocolK8S = "k8s" ProtocolMysql = "mysql" )
View Source
const ( OperateDownload = "Download" OperateUpload = "Upload" )
View Source
const ( OperateRemoveDir = "Rmdir" OperateRename = "Rename" OperateMkdir = "Mkdir" OperateDelete = "Delete" OperateSymlink = "Symlink" )
View Source
const ( HighRiskFlag = "1" LessRiskFlag = "0" )
View Source
const ( DangerLevel = 5 NormalLevel = 0 )
View Source
const ( TreeTypeNode = "node" TreeTypeAsset = "asset" )
View Source
const ( ActionALL = "all" ActionConnect = "connect" ActionUpload = "upload_file" ActionDownload = "download_file" ActionUploadDownLoad = "updownload" ActionCopy = "clipboard_copy" ActionPaste = "clipboard_paste" ActionCopyPaste = "clipboard_copy_paste" )
View Source
const ( SuffixReplayGz = ".replay.gz" SuffixCastGz = ".cast.gz" SuffixCast = ".cast" SuffixGz = ".gz" )
View Source
const ( AllAction = "all" ConnectAction = "connect" UploadAction = "upload_file" DownloadAction = "download_file" )
View Source
const ( TicketOpen = "pending" TicketApproved = "approved" TicketRejected = "rejected" TicketClosed = "closed" )
View Source
const AppType = "Application"
View Source
const LoginModeManual = "manual"
View Source
const (
TaskKillSession = "kill_session"
)
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 SuffixMap = map[ReplayVersion]string{ Version2: SuffixReplayGz, Version3: SuffixCastGz, }
View Source
var ( SupportedDBTypes = []string{AppTypeMySQL, AppTypeMariaDB, AppTypeSQLServer, AppTypePostgres, AppTypeRedis, AppTypeMongoDB, AppTypeSQLite, AppTypeOracle} )
Functions ¶
func SortNodesByKey ¶
func SortNodesByKey(nodes []Node)
func SortSystemUserByPriority ¶
func SortSystemUserByPriority(sysUsers []SystemUser)
Types ¶
type AccessKey ¶
func (*AccessKey) LoadFromFile ¶
func (*AccessKey) LoadFromStr ¶
func (*AccessKey) SaveToFile ¶
type Application ¶
type Application struct { ID string `json:"id"` Name string `json:"name"` Category string `json:"category"` TypeName string `json:"type"` Domain string `json:"domain"` Comment string `json:"comment"` OrgID string `json:"org_id"` OrgName string `json:"org_name"` Attrs Attrs `json:"attrs"` }
func (Application) String ¶
func (app Application) String() string
type Asset ¶
type Asset struct { ID string `json:"id"` Hostname string `json:"hostname"` IP string `json:"ip"` Os string `json:"os"` Domain string `json:"domain"` // 是否需要走网域 Comment string `json:"comment"` Protocols []string `json:"protocols"` OrgID string `json:"org_id"` OrgName string `json:"org_name"` Platform string `json:"platform"` IsActive bool `json:"is_active"` // 判断资产是否禁用 }
func (*Asset) IsSupportProtocol ¶
func (*Asset) ProtocolPort ¶
type AssetLoginTicketInfo ¶
type AssetLoginTicketInfo struct { TicketId string `json:"ticket_id"` NeedConfirm bool `json:"need_confirm"` TicketInfo }
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 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"` SystemUser string `json:"system_user"` Timestamp int64 `json:"timestamp"` RiskLevel int64 `json:"risk_level"` DateCreated time.Time `json:"@timestamp"` }
type CommandTicketInfo ¶
type CommandTicketInfo struct {
TicketInfo
}
type ConnectTokenInfo ¶
type ConnectTokenInfo struct { Id string `json:"id"` Secret string `json:"secret"` TypeName ConnectType `json:"type"` User *User `json:"user"` Actions []string `json:"actions,omitempty"` Application *Application `json:"application,omitempty"` Asset *Asset `json:"asset,omitempty"` ExpiredAt int64 `json:"expired_at"` Gateway Gateway `json:"gateway,omitempty"` Domain *Domain `json:"domain"` CmdFilterRules FilterRules `json:"cmd_filter_rules,omitempty"` SystemUserAuthInfo *SystemUserAuthInfo `json:"system_user"` }
type ConnectType ¶
type ConnectType string
const ( ConnectApplication ConnectType = "application" ConnectAsset ConnectType = "asset" )
type ExpireInfo ¶
type ExpireInfo struct { HasPermission bool `json:"has_permission"` ExpireAt int64 `json:"expire_at"` Permission }
type FTPLog ¶
type FTPLog struct { User string `json:"user"` Hostname string `json:"asset"` OrgID string `json:"org_id"` SystemUser string `json:"system_user"` RemoteAddr string `json:"remote_addr"` Operate string `json:"operate"` Path string `json:"filename"` DateStart common.UTCTime `json:"date_start"` IsSuccess bool `json:"is_success"` }
type FilterRule ¶
type FilterRule struct { ID string `json:"id"` Priority int `json:"priority"` Type string `json:"type"` Content string `json:"content"` Action RuleAction `json:"action"` OrgId string `json:"org_id"` RePattern string `json:"pattern"` // 已经处理过的正则字符 IgnoreCase bool `json:"ignore_case"` // contains filtered or unexported fields }
func (*FilterRule) Match ¶
func (sf *FilterRule) Match(cmd string) (RuleAction, string)
func (*FilterRule) Pattern ¶
func (sf *FilterRule) Pattern() *regexp.Regexp
type FilterRules ¶
type FilterRules []FilterRule
func (FilterRules) Len ¶
func (f FilterRules) Len() int
func (FilterRules) Less ¶
func (f FilterRules) Less(i, j int) bool
func (FilterRules) Swap ¶
func (f FilterRules) Swap(i, j int)
type HeartbeatData ¶
type NodeTreeList ¶
type NodeTreeList []NodeTree
type NodeTreeMeta ¶
func (NodeTreeMeta) IsSupportProtocol ¶
func (n NodeTreeMeta) IsSupportProtocol(protocol string) bool
type PaginationParam ¶
type PaginationResponse ¶
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) EnableDownload ¶
func (p *Permission) EnableDownload() bool
func (*Permission) EnableDrive ¶
func (p *Permission) EnableDrive() bool
func (*Permission) EnablePaste ¶
func (p *Permission) EnablePaste() bool
func (*Permission) EnableUpload ¶
func (p *Permission) EnableUpload() bool
type PublicSetting ¶
type RemoteAPP ¶
type RemoteAPP struct { ID string `json:"id"` Name string `json:"name"` AssetId string `json:"asset"` Parameters RemoteAppParameter `json:"parameter_remote_app"` }
type RemoteAppParameter ¶
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 ReplayVersion ¶
type ReplayVersion string
const ( UnKnown ReplayVersion = "" Version2 ReplayVersion = "2" Version3 ReplayVersion = "3" )
func ParseReplayVersion ¶
func ParseReplayVersion(gzFile string, defaultValue ReplayVersion) ReplayVersion
type RuleAction ¶
type RuleAction int
const ( ActionDeny RuleAction = 0 ActionAllow RuleAction = 9 ActionConfirm RuleAction = 2 ActionUnknown RuleAction = 3 TypeRegex = "regex" TypeCmd = "command" )
type Session ¶
type Session struct { ID string `json:"id"` // "%s(%s)" Name Username User string `json:"user"` Asset string `json:"asset"` SystemUser string `json:"system_user"` LoginFrom string `json:"login_from"` 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"` SystemUserID string `json:"system_user_id"` }
type ShareRecord ¶
type ShareRecord struct {}
type SharingSession ¶
type SystemUser ¶
type SystemUser struct { ID string `json:"id"` Name string `json:"name"` Username string `json:"username"` Priority int `json:"priority"` Protocol string `json:"protocol"` AdDomain string `json:"ad_domain"` Comment string `json:"comment"` LoginMode string `json:"login_mode"` Password string `json:"-"` PrivateKey string `json:"-"` Actions []string `json:"actions"` SftpRoot string `json:"sftp_root"` OrgId string `json:"org_id"` OrgName string `json:"org_name"` UsernameSameWithUser bool `json:"username_same_with_user"` Token string `json:"-"` SuEnabled bool `json:"su_enabled"` SuFrom string `json:"su_from"` }
func (*SystemUser) IsProtocol ¶
func (s *SystemUser) IsProtocol(p string) bool
func (*SystemUser) String ¶
func (s *SystemUser) String() string
type SystemUserAuthInfo ¶
type SystemUserAuthInfo struct { ID string `json:"id"` Name string `json:"name"` Username string `json:"username"` Protocol string `json:"protocol"` LoginMode string `json:"login_mode"` Password string `json:"password"` PrivateKey string `json:"private_key"` AdDomain string `json:"ad_domain"` Token string `json:"token"` OrgId string `json:"org_id"` OrgName string `json:"org_name"` PublicKey string `json:"public_key"` UsernameSameWithUser bool `json:"username_same_with_user"` }
func (*SystemUserAuthInfo) String ¶
func (s *SystemUserAuthInfo) String() string
type TaskKwargs ¶
type TaskKwargs struct {
TerminatedBy string `json:"terminated_by"`
}
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 map[string]interface{} `json:"TERMINAL_COMMAND_STORAGE"` SessionKeepDuration int `json:"TERMINAL_SESSION_KEEP_DURATION"` TelnetRegex string `json:"TERMINAL_TELNET_REGEX"` MaxIdleTime int `json:"SECURITY_MAX_IDLE_TIME"` HeartbeatDuration int `json:"TERMINAL_HEARTBEAT_INTERVAL"` HostKey string `json:"TERMINAL_HOST_KEY"` }
type TerminalTask ¶
type TerminalTask struct { ID string `json:"id"` Name string `json:"name"` Args string `json:"args"` Kwargs TaskKwargs `json:"kwargs"` IsFinished bool }
type TicketInfo ¶
type TicketState ¶
type TokenUser ¶
type TokenUser struct { UserID string `json:"user"` UserName string `json:"username"` AssetID string `json:"asset"` Hostname string `json:"hostname"` SystemUserID string `json:"system_user"` SystemUserName string `json:"system_user_name"` Type ConnectType `json:"type"` ApplicationID string `json:"application"` }
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"` }
{'id': '1f8e54a8-d99d-4074-b35d-45264adb4e34', 'name': 'EricdeMBP.lan', 'username': 'EricdeMBP.lan', 'email': 'EricdeMBP.lan@serviceaccount.local', 'groups': [], 'groups_display': ”, 'role': 'App','role_display': '应用程序', 'avatar_url': '/static/img/avatar/user.png', 'wechat': ”,'phone': None, 'otp_level': 0, 'comment': ”, 'source': 'local', 'source_display': 'Local', 'is_valid': True, 'is_expired': False, 'is_active': True, 'created_by': ”, 'is_first_login': True, 'date_password_last_updated': '2019-04-08 18:18:24 +0800', 'date_expired': '2089-03-21 18:18:24 +0800'}
type ValidateResult ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.