Versions in this module Expand all Collapse all v1 v1.1.0 Feb 1, 2024 v1.0.1 Mar 21, 2023 v1.0.0 Jul 28, 2022 Changes in this version + var SBGroupNameRegexp = regexp.MustCompile(`^bg_([^-]*)(-(.*))?$`) + func EncryptReplicationDataForTransport(data ReplicationData) (encrypted string, err error) + func GetAccessGormDB(database string) (db *gorm.DB, err error) + func GetAllSBGroups() (groups map[string]*Group, err error) + func GetAllSBUsers() (users []string, err error) + func GetLastSSHSessions(database string, limit int) (sessions []*helpers.SSHSession, err error) + func GetReplicationGormDB(database string) (db *gorm.DB, err error) + func IsAValidSBAccessFromUserInput(access string) bool + type Access struct + Alias string + Comment string + Host string + IP net.IP + Port int + Prefix string + UniqID string + User string + func BuildSBAccess(host, user, port, alias string, strictHostCheck bool) (ba *Access, err error) + func BuildSBAccessFromUserInput(access string) (ba *Access, err error) + func GetAllAccesses(db *gorm.DB) (accesses []*Access, err error) + func LoadSBAccess(host, user, port string, db *gorm.DB) (ba *Access, err error) + func (ba *Access) BeforeCreate(tx *gorm.DB) (err error) + func (ba *Access) Delete(db *gorm.DB) (err error) + func (ba *Access) Equals(a *Access) bool + func (ba *Access) Save(db *gorm.DB) (err error) + func (ba *Access) ShortString() string + func (ba *Access) String() string + type AccessesByKeys struct + Accesses []*Access + Group string + Keys []*helpers.SSHKeyPair + Type string + type Group struct + ACLKeeper bool + GateKeeper bool + Member bool + Name string + OverriddenDatabaseAccessFilePath string + OverriddenKeyFilesRootDir string + Owner bool + SystemName string + func GetGroup(groupName string) (group *Group, err error) + func (bg *Group) AddAccess(host, user, port, alias, comment string, db ...*gorm.DB) (ba *Access, err error) + func (bg *Group) DeleteAccess(host, user, port string, db ...*gorm.DB) (ba *Access, err error) + func (bg *Group) DisplayPubKeys(keyType string) (str string, keys []helpers.PublicKey, err error) + func (bg *Group) GetAccesses(db ...*gorm.DB) (accesses *AccessesByKeys, err error) + func (bg *Group) GetMembers(memberType string) (members []string, err error) + func (bg *Group) GetSSHKeyPairs() (kp []*helpers.SSHKeyPair, err error) + func (bg *Group) OverrideDatabaseAccessFilePath(path string) + func (bg *Group) OverrideKeyFilesRootDir(path string) + type Info struct + Accesses []*Access + Authorized bool + KeyFilepathes []string + Sources []*Source + type Log struct + Allowed bool + Arguments string + BastionHost string + BastionIP string + BastionPort string + Command string + Comment string + Databases []string + HostFrom string + HostTo string + IPFrom string + LocalUsername string + PortFrom string + PortTo string + SessionEndDate time.Time + SessionStartDate time.Time + UniqID string + UserTo string + func NewLog(username string, databases []string, arguments []string) (log *Log) + func (l *Log) PushReplication(new bool) (err error) + func (l *Log) Replicate(new bool) (err error) + func (l *Log) Save() (err error) + func (l *Log) SetAllowed(allowed bool) error + func (l *Log) SetCommand(command string) error + func (l *Log) SetTargetAccess(ba *Access) error + type Replication struct + Action string + CreationDate time.Time + Data string + Instance string + UniqID string + func GetNextReplicationEntryToPush(db *gorm.DB) (entry Replication, err error) + func NewReplicationEntry(action string, data ReplicationData) (repl *Replication, err error) + func (r *Replication) BeforeCreate(tx *gorm.DB) (err error) + func (r *Replication) Delete(db *gorm.DB) (err error) + func (r *Replication) Save(db *gorm.DB) (err error) + type ReplicationData map[string]string + func DecryptReplicationData(encryptedPayload string) (data ReplicationData, err error) + type Right uint32 + const GroupACLKeeper + const GroupGateKeeper + const GroupMember + const GroupOwner + const HasAccess + const Private + const Public + const SBOwner + type Source struct + Group string + Type string + func (s *Source) String() (str string) + type User struct + Groups map[string]*Group + OverriddenAuthorizedKeysFilePath string + OverriddenDatabaseAccessFilePath string + User *osuser.User + func LoadCurrentUser() (bu *User, err error) + func LoadUser(username string) (bu *User, err error) + func (bu *User) AddAccess(host, user, port, alias, comment string, db ...*gorm.DB) (ba *Access, err error) + func (bu *User) AddIngressKey(publicKey string) (err error) + func (bu *User) BuildGroupsMembership(groupNames []string) + func (bu *User) DeleteAccess(host, user, port string, db ...*gorm.DB) (ba *Access, err error) + func (bu *User) DeletePubKey(keyType string, pk helpers.PublicKey) (err error) + func (bu *User) DisplayPubKeys(keyType string) (str string, keys []helpers.PublicKey, err error) + func (bu *User) GetAccesses(db ...*gorm.DB) (accesses []*AccessesByKeys, err error) + func (bu *User) GetAllGroups() (map[string]*Group, error) + func (bu *User) GetKnownHostsFilepath() string + func (bu *User) GetLastSSHSessions(limit int) ([]*helpers.SSHSession, error) + func (bu *User) GetLocalLogDatabasePath() string + func (bu *User) GetSSHKeyPairs() (kp []*helpers.SSHKeyPair, err error) + func (bu *User) GetSelfAccesses(db ...*gorm.DB) (accesses *AccessesByKeys, err error) + func (bu *User) GetTOTP() (enabled bool, secret string, emergencyPasswords []string) + func (bu *User) GetTOTPFilepath() string + func (bu *User) GetTtyrecDirectory() string + func (bu *User) HasAccess(ba *Access, db ...*gorm.DB) (accessInfo *Info, err error) + func (bu *User) IsACLKeeperOfGroup(groupName string) bool + func (bu *User) IsGateKeeperOfGroup(groupName string) bool + func (bu *User) IsMemberOfGroup(groupName string) bool + func (bu *User) IsOwnerOfGroup(groupName string) bool + func (bu *User) OverrideAuthorizedKeysFilePath(path string) error + func (bu *User) OverrideDatabaseAccessFilePath(path string) error + func (bu *User) RemoveTOTPSecret() (err error) + func (bu *User) SetTOTPSecret(secret string, emergencyCodes []string) error + func (bu *User) ShortString() string