Documentation
¶
Index ¶
- func ACLsByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func ACLsPreload(db *gorm.DB) *gorm.DB
- func EventsByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func EventsPreload(db *gorm.DB) *gorm.DB
- func GenericNameOrID(db *gorm.DB, identifiers []string) *gorm.DB
- func HostGroupsByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func HostGroupsPreload(db *gorm.DB) *gorm.DB
- func HostsByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func HostsPreload(db *gorm.DB) *gorm.DB
- func InitValidator()
- func IsValidHostLoggingMode(name string) bool
- func SSHKeysByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func SSHKeysPreload(db *gorm.DB) *gorm.DB
- func SessionsByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func SessionsPreload(db *gorm.DB) *gorm.DB
- func UserGroupsByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func UserGroupsPreload(db *gorm.DB) *gorm.DB
- func UserKeysByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func UserKeysByUserID(db *gorm.DB, identifiers []string) *gorm.DB
- func UserKeysPreload(db *gorm.DB) *gorm.DB
- func UserRolesByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func UsersByIdentifiers(db *gorm.DB, identifiers []string) *gorm.DB
- func UsersPreload(db *gorm.DB) *gorm.DB
- type ACL
- type ACLAction
- type BastionScheme
- type Config
- type Event
- type Host
- func (host *Host) ClientConfig(hk gossh.HostKeyCallback) (*gossh.ClientConfig, error)
- func (host *Host) DialAddr() string
- func (host *Host) Hostname() string
- func (host *Host) Passwd() string
- func (host *Host) Port() uint64
- func (host *Host) Scheme() BastionScheme
- func (host *Host) String() string
- func (host *Host) Username() string
- type HostGroup
- type SSHKey
- type Session
- type SessionStatus
- type Setting
- type User
- type UserGroup
- type UserKey
- type UserRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenericNameOrID ¶ added in v1.17.0
Generic Helper
func HostGroupsByIdentifiers ¶
func InitValidator ¶ added in v1.12.4
func InitValidator()
func IsValidHostLoggingMode ¶ added in v1.13.0
func UserGroupsByIdentifiers ¶
func UserKeysByUserID ¶ added in v1.16.0
func UserRolesByIdentifiers ¶
Types ¶
type ACL ¶
type ACL struct { gorm.Model HostGroups []*HostGroup `gorm:"many2many:host_group_acls;"` UserGroups []*UserGroup `gorm:"many2many:user_group_acls;"` HostPattern string `valid:"optional"` Action string `valid:"required"` Weight uint `` Comment string `valid:"optional"` Inception *time.Time Expiration *time.Time }
type BastionScheme ¶
type BastionScheme string
const ( BastionSchemeSSH BastionScheme = "ssh" BastionSchemeTelnet BastionScheme = "telnet" )
type Config ¶
type Config struct { SSHKeys []*SSHKey `json:"keys"` Hosts []*Host `json:"hosts"` UserKeys []*UserKey `json:"user_keys"` Users []*User `json:"users"` UserGroups []*UserGroup `json:"user_groups"` HostGroups []*HostGroup `json:"host_groups"` ACLs []*ACL `json:"acls"` Settings []*Setting `json:"settings"` Events []*Event `json:"events"` Sessions []*Session `json:"sessions"` // FIXME: add latest migration Date time.Time `json:"date"` }
type Event ¶
type Event struct { gorm.Model Author *User `gorm:"ForeignKey:AuthorID"` AuthorID uint `valid:"optional"` Domain string `valid:"required"` Action string `valid:"required"` Entity string `valid:"optional"` Args []byte `sql:"size:10000" valid:"optional,length(1|10000)" json:"-"` ArgsMap map[string]interface{} `gorm:"-" json:"Args"` }
type Host ¶
type Host struct { // FIXME: use uuid for ID gorm.Model Name string `gorm:"index:uix_hosts_name,unique;type:varchar(255)" valid:"required,length(1|255)"` Addr string `valid:"optional"` // FIXME: to be removed in a future version in favor of URL User string `valid:"optional"` // FIXME: to be removed in a future version in favor of URL Password string `valid:"optional"` // FIXME: to be removed in a future version in favor of URL URL string `valid:"optional"` SSHKey *SSHKey `gorm:"ForeignKey:SSHKeyID"` // SSHKey used to connect by the client SSHKeyID uint `gorm:"index"` HostKey []byte `sql:"size:1000" valid:"optional"` Groups []*HostGroup `gorm:"many2many:host_host_groups;"` Comment string `valid:"optional"` Logging string `valid:"optional,host_logging_mode"` Hop *Host HopID uint }
func (*Host) ClientConfig ¶
func (host *Host) ClientConfig(hk gossh.HostKeyCallback) (*gossh.ClientConfig, error)
func (*Host) Scheme ¶
func (host *Host) Scheme() BastionScheme
type SSHKey ¶
type SSHKey struct { // FIXME: use uuid for ID gorm.Model Name string `valid:"required,length(1|255),unix_user" gorm:"index:uix_keys_name,unique"` Type string `valid:"required"` Length uint `valid:"required"` Fingerprint string `valid:"optional"` PrivKey string `sql:"size:5000" valid:"required"` PubKey string `sql:"size:1000" valid:"optional"` Hosts []*Host `gorm:"ForeignKey:SSHKeyID"` Comment string `valid:"optional"` }
SSHKey defines a ssh client key (used by sshportal to connect to remote hosts)
type Session ¶
type Session struct { gorm.Model StoppedAt *time.Time `sql:"index" valid:"optional"` Status string `valid:"required"` User *User `gorm:"ForeignKey:UserID"` Host *Host `gorm:"ForeignKey:HostID"` UserID uint `valid:"optional"` HostID uint `valid:"optional"` ErrMsg string `valid:"optional"` Comment string `valid:"optional"` }
type SessionStatus ¶
type SessionStatus string
const ( SessionStatusUnknown SessionStatus = "unknown" SessionStatusActive SessionStatus = "active" SessionStatusClosed SessionStatus = "closed" )
type User ¶
type User struct { // FIXME: use uuid for ID gorm.Model Roles []*UserRole `gorm:"many2many:user_user_roles"` Email string `valid:"required,email"` Name string `valid:"required,length(1|255),unix_user" gorm:"index:uix_users_name,unique"` Keys []*UserKey `gorm:"ForeignKey:UserID"` Groups []*UserGroup `gorm:"many2many:user_user_groups;"` Comment string `valid:"optional"` InviteToken string `valid:"optional,length(10|60)"` }
func (*User) CheckRoles ¶
type UserKey ¶
type UserKey struct { gorm.Model Key []byte `sql:"size:1000" valid:"length(1|1000)"` AuthorizedKey string `sql:"size:1000" valid:"required,length(1|1000)"` UserID uint `` User *User `gorm:"ForeignKey:UserID"` Comment string `valid:"optional"` }
UserKey defines a user public key used by sshportal to identify the user
Click to show internal directories.
Click to hide internal directories.