Documentation ¶
Index ¶
- func AddAccountInGroup(groupName string, account string, membershipType string) (err error)
- func AddGroup(groupname string, ownerAccount string) (err error)
- func AddUser(homedir, username, shellPath string) (err error)
- func ArchiveHomeSkelleton(homedir, suffix string) (err error)
- func BcryptPbkdfKey(password, salt []byte, rounds, keyLen int) ([]byte, error)
- func ChmodFile(filePath, owner, permissions string) (err error)
- func CreateHomeSkeleton(homedir string, username string, homeType string) (err error)
- func DecryptFile(filepathIn, filepathOut, decryptionKey string) (err error)
- func DeleteAccount(username, archiveSuffix string) (err error)
- func DeleteGroup(groupname, archiveSuffix string) (err error)
- func EncryptFile(filepathIn, filepathOut, replicationEncryptionKey string) (err error)
- func FillUserAuthorizedKeysFile(sshdir string, username string, pk string) (err error)
- func GenerateNewEgressGroupKey(algo string, size string, passphrase string, groupname string) (...)
- func GenerateNewEgressKey(algo string, size string, passphrase string, username string) (...)
- func GetEtcGroupFilePath() string
- func GetEtcPasswdFilePath() string
- func GetGroupSudoersTemplateOwners(binaryPath, sbUser string) (str string)
- func GetHostname() (hostname string, err error)
- func GetRandomStrings(quantity int, length int) (rdm []string)
- func GetScpScript(user, host, port string) (str string)
- func GetSystemGroups() (groups [][]string, err error)
- func GetSystemUsers() (groups [][]string, err error)
- func GetSystemdServiceFile(binaryPath, sbHomeDirectory string) (str string)
- func GetTOTPFile(secret string, emergencyCodes []string) (str string)
- func MarshalPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error)
- func MarshalPrivateKeyWithPassphrase(key crypto.PrivateKey, comment string, passphrase []byte) (*pem.Block, error)
- func ParseArguments(clArgs []string) (c string, ca []string, ba map[string]bool, rest []string, err error)
- func ParseArgumentsNew(clArgs []string) (c string, ca []string, rest []string, err error)
- func ParseCommandLine(cmd string) ([]string, error)
- func RegroupCommandArguments(clArgs []string) (args []string)
- func RemoveAccountFromGroup(groupName string, account string, membershipType string) (err error)
- func RemoveHostKey(username, knownHostsFilePath, hostkey string) (err error)
- func SetEtcGroupFilePath(path string)
- func SetEtcPasswdFilePath(path string)
- func WriteGroupPrivateKey(privateKey, privateKeyFile, owner string) (err error)
- func WritePrivateKey(privateKey, privateKeyFile, owner string) (err error)
- func WritePublicKey(publicKey, publicKeyFile, owner string) (err error)
- func WriteSelfPrivateKey(privateKey, privateKeyFile, owner string) (err error)
- func WriteSelfPublicKey(publicKey, publicKeyFile, owner string) (err error)
- type Helper
- type PublicKey
- type SSHDConfigParser
- type SSHKeyPair
- type SSHSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAccountInGroup ¶
AddAccountInGroup adds an account in a group's membership group
func ArchiveHomeSkelleton ¶
ArchiveHomeSkelleton moves user home to home.bak
func BcryptPbkdfKey ¶
Bcrypt_pbkdfKey derives a key from the password, salt and rounds count, returning a []byte of length keyLen that can be used as cryptographic key.
func CreateHomeSkeleton ¶
CreateHomeSkeleton creates user home
func DecryptFile ¶
func DeleteAccount ¶
DeleteAccount deletes a group from the system
func DeleteGroup ¶
DeleteGroup deletes a group from the system
func EncryptFile ¶
func FillUserAuthorizedKeysFile ¶
FillUserAuthorizedKeysFile creates the .ssh directory, put the public key in the authorized_keys file and chmods everything
func GenerateNewEgressKey ¶
func GetEtcGroupFilePath ¶
func GetEtcGroupFilePath() string
GetEtcGroupFilePath returns /etc/group or an other specifically set filepath
func GetEtcPasswdFilePath ¶
func GetEtcPasswdFilePath() string
GetEtcPasswdFilePath returns /etc/passwd or an other specifically set filepath
func GetHostname ¶
func GetRandomStrings ¶
GetRandomStrings returns x random strings of y characters
func GetScpScript ¶
GetScpScript returns the user's SCP script
func GetSystemGroups ¶
GetSystemGroups returns the content of /etc/group
func GetSystemUsers ¶
GetSystemGroups returns the content of /etc/passwd
func GetSystemdServiceFile ¶
func GetTOTPFile ¶
GetTOTPFile returns the user's TOTP file
func MarshalPrivateKey ¶
MarshalPrivateKey returns a PEM block with the private key serialized in the OpenSSH format.
func MarshalPrivateKeyWithPassphrase ¶
func MarshalPrivateKeyWithPassphrase(key crypto.PrivateKey, comment string, passphrase []byte) (*pem.Block, error)
MarshalPrivateKeyWithPassphrase returns an encrypted PEM block with the private key serialized in the OpenSSH format.
func ParseArguments ¶
func ParseArguments(clArgs []string) (c string, ca []string, ba map[string]bool, rest []string, err error)
ParseArguments parses the os.Args arguments
func ParseArgumentsNew ¶
ParseArguments parses the os.Args arguments
func ParseCommandLine ¶
ParseCommandLine parses the string passed to us by SSH to an array of args
func RegroupCommandArguments ¶
func RemoveAccountFromGroup ¶
RemoveAccountFromGroup adds an account in a group's membership group
func RemoveHostKey ¶
func SetEtcGroupFilePath ¶
func SetEtcGroupFilePath(path string)
SetEtcGroupFilePath sets a specific filepath to oveerride /etc/group (mainly for tests purposes)
func SetEtcPasswdFilePath ¶
func SetEtcPasswdFilePath(path string)
SetEtcPasswdFilePath sets a specific filepath to oveerride /etc/passwd (mainly for tests purposes)
func WriteGroupPrivateKey ¶
func WritePrivateKey ¶
func WritePublicKey ¶
func WriteSelfPrivateKey ¶
func WriteSelfPublicKey ¶
Types ¶
type PublicKey ¶
PublicKey describes the basic properties of a sb PublicKey type
func CheckStringPK ¶
CheckStringPK checks if the provided public key is valid and not already present in the optional keys slice
type SSHDConfigParser ¶
type SSHDConfigParser struct {
// contains filtered or unexported fields
}
func ParseSSHDConfig ¶
func ParseSSHDConfig(content io.Reader) (p *SSHDConfigParser, err error)
func ParseSSHDConfigFile ¶
func ParseSSHDConfigFile(path string) (p *SSHDConfigParser, err error)
func (*SSHDConfigParser) Dump ¶
func (p *SSHDConfigParser) Dump() (content string)
func (*SSHDConfigParser) GetParam ¶
func (p *SSHDConfigParser) GetParam(key string) (value string)
func (*SSHDConfigParser) SetParam ¶
func (p *SSHDConfigParser) SetParam(key, value string)
func (*SSHDConfigParser) WriteToFile ¶
func (p *SSHDConfigParser) WriteToFile(path string) (err error)
type SSHKeyPair ¶
SSHKeyPair describes an SSH key pair
type SSHSession ¶
type SSHSession struct { UniqID string StartDate time.Time EndDate time.Time UserFrom string IPFrom string PortFrom string HostFrom string HostTo string PortTo string UserTo string Allowed bool }
SSHSession represents an SSH session
func (*SSHSession) String ¶
func (s *SSHSession) String() (str string)