Documentation
¶
Index ¶
- Variables
- type ACL
- type APIResponse
- type Account
- type AccountAccess
- type BoolFromInt
- type Client
- func (c *Client) AccountGrantCommand(account, command string) error
- func (c *Client) AccountInfo(name string) (*Account, error)
- func (c *Client) AccountListAccesses(account string) ([]*AccountAccess, error)
- func (c *Client) AccountRevokeCommand(account, command string) error
- func (c *Client) AccountSetPIVGrace(account string, ttl int) error
- func (c *Client) AccountSetPIVPolicy(account string, policy PIVPolicy) error
- func (c *Client) CreateAccount(name string, uidOpt UIDOpt, createOpts *CreateAccountOptions) error
- func (c *Client) CreateGroup(name, owner string, keyAlgo KeyAlgo) (*Group, error)
- func (c *Client) DeleteAccount(name string) error
- func (c *Client) DeleteGroup(name string) error
- func (c *Client) DestroyGroup(name string) error
- func (c *Client) GroupAddACLKeeper(group, account string) error
- func (c *Client) GroupAddGatekeeper(group, account string) error
- func (c *Client) GroupAddGuestAccess(group, account, host, port, user string, options *GroupAddGuestAccessOptions) error
- func (c *Client) GroupAddMember(group, account string) error
- func (c *Client) GroupAddOwner(group, account string) error
- func (c *Client) GroupAddServer(group, host, port, user string, options *GroupAddServerOptions) (*GroupServer, error)
- func (c *Client) GroupDelGuestAccess(group, account, host, port, user, protocol string, proxyOpts *ProxyOptions, ...) error
- func (c *Client) GroupDelServer(group, host, port, user, protocol string, proxyOpts *ProxyOptions, ...) error
- func (c *Client) GroupInfo(name string) (*Group, error)
- func (c *Client) GroupListGuestAccesses(group, account string) ([]*GroupGuestAccess, error)
- func (c *Client) GroupListServers(name string) ([]*GroupServer, error)
- func (c *Client) GroupRemoveACLKeeper(group, account string) error
- func (c *Client) GroupRemoveGatekeeper(group, account string) error
- func (c *Client) GroupRemoveMember(group, account string) error
- func (c *Client) GroupRemoveOwner(group, account string) error
- func (c *Client) GroupTransmitOwnership(group, account string) error
- func (c *Client) ModifyAccount(name string, modifyOpts *ModifyAccountOptions) error
- func (c *Client) ModifyGroup(name string, modifyOpts *GroupModifyOptions) error
- func (c *Client) SelfListAccesses() ([]*AccountAccess, error)
- type Config
- type CreateAccountOptions
- type CreationInformation
- type EgressStrictHostKeyCheckingPolicy
- type Group
- type GroupAddGuestAccessOptions
- type GroupAddServerOptions
- type GroupGuestAccess
- type GroupModifyOptions
- type GroupServer
- type IngressPIVGrace
- type Key
- type KeyAlgo
- type KeyboardInteractiveChallenge
- type LastActivity
- type MFARequiredPolicy
- type ModifyAccountOptions
- type PIVPolicy
- type Port
- type ProxyOptions
- type SSHAuthMethod
- func WithKeyboardInteractiveAuth(challenge KeyboardInteractiveChallenge) SSHAuthMethod
- func WithPrivateKeyAuth(privateKey string) SSHAuthMethod
- func WithPrivateKeyAuthWithPassphrase(privateKey string, passphrase string) SSHAuthMethod
- func WithPrivateKeyAuthWithPassphraseWithSignedCert(privateKey string, passphrase string, cert string) SSHAuthMethod
- func WithPrivateKeyAuthWithPassphraseWithSignedCertFile(privateKey string, passphrase string, certPath string) SSHAuthMethod
- func WithPrivateKeyAuthWithSignedCert(privateKey string, cert string) SSHAuthMethod
- func WithPrivateKeyAuthWithSignedCertFile(privateKey string, certPath string) SSHAuthMethod
- func WithPrivateKeyFileAuth(keyPath string) SSHAuthMethod
- func WithPrivateKeyFileAuthWithPassphrase(keyPath string, passphrase string) SSHAuthMethod
- func WithPrivateKeyFileAuthWithPassphraseWithSignedCert(keyPath string, passphrase string, cert string) SSHAuthMethod
- func WithPrivateKeyFileAuthWithPassphraseWithSignedCertFile(keyPath string, passphrase string, certPath string) SSHAuthMethod
- func WithSSHAgentAuth() SSHAuthMethod
- type UIDOpt
- type UIDOptions
- type YesNoBypass
- type YesNoDefault
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoAuthMethodsProvided = errors.New("no authentication method provided") ErrMissingConfig = errors.New("missing configuration") ErrHostRequired = errors.New("host is required") ErrInvalidPort = errors.New("invalid port") ErrUsernameRequired = errors.New("username is required") ErrProxyMissingHost = errors.New("proxy host is required") ErrProxyMissingPort = errors.New("proxy port is required") ErrProxyMissingUser = errors.New("proxy user is required") )
Functions ¶
This section is empty.
Types ¶
type ACL ¶
type ACL struct {
IP string `json:"ip"`
Port *Port `json:"port"`
User *string `json:"user"`
ProxyIP *string `json:"proxyIp"`
ProxyPort *Port `json:"proxyPort"`
ProxyUser *string `json:"proxyUser"`
Comment *string `json:"comment"`
UserComment *string `json:"userComment"`
ForcePassword *string `json:"forcePassword"`
ForceKey *string `json:"forceKey"`
Protocol *string `json:"protocol"`
ReverseDNS *string `json:"reverseDns"`
AddedBy string `json:"addedBy"`
AddedDate string `json:"addedDate"`
Expiry *int `json:"expiry"`
RemotePort *Port `json:"remotePort"`
LocalPort *Port `json:"localPort"`
}
type APIResponse ¶
type APIResponse struct {
Command string `json:"command"`
ErrorCode string `json:"error_code"`
ErrorMessage string `json:"error_message"`
Value any `json:"value"`
}
APIResponse represents the standard API response from The Bastion.
func (*APIResponse) Error ¶
func (e *APIResponse) Error() string
Error implements the error interface for APIResponse.
type Account ¶
type Account struct {
Account string `json:"account"`
MFATOTPBypass BoolFromInt `json:"mfa_totp_bypass"`
MFATOTPRequired BoolFromInt `json:"mfa_totp_required"`
MFATOTPConfigured BoolFromInt `json:"mfa_totp_configured"`
MFAPasswordBypass BoolFromInt `json:"mfa_password_bypass"`
MFAPasswordRequired BoolFromInt `json:"mfa_password_required"`
MFAPasswordConfigured BoolFromInt `json:"mfa_password_configured"`
GlobalIngressPolicy BoolFromInt `json:"global_ingress_policy"`
IsExpired BoolFromInt `json:"is_expired"`
PersonalEgressMFARequired MFARequiredPolicy `json:"personal_egress_mfa_required"`
CreationInformation CreationInformation `json:"creation_information"`
AllowedCommands []string `json:"allowed_commands"`
IngressPIVPolicy PIVPolicy `json:"ingress_piv_policy"`
IngressPIVEnforced BoolFromInt `json:"ingress_piv_enforced"`
IngressPIVGrace IngressPIVGrace `json:"ingress_piv_grace"`
CanConnect BoolFromInt `json:"can_connect"`
AlreadySeenBefore BoolFromInt `json:"already_seen_before"`
IsActive BoolFromInt `json:"is_active"`
AlwaysActive BoolFromInt `json:"always_active"`
MaxInactiveDays string `json:"max_inactive_days"`
IsFrozen BoolFromInt `json:"is_frozen"`
OshOnly BoolFromInt `json:"osh_only"`
IsAdmin BoolFromInt `json:"is_admin"`
IsSuperOwner BoolFromInt `json:"is_super_owner"`
IsAuditor BoolFromInt `json:"is_auditor"`
IsTTLSet BoolFromInt `json:"is_ttl_set"`
IsTTLExpired BoolFromInt `json:"is_ttl_expired"`
TTTLTimestamp int `json:"ttl_timestamp"`
IdleIgnore BoolFromInt `json:"idle_ignore"`
PamAuthBypass BoolFromInt `json:"pam_auth_bypass"`
}
Account represents a Bastion account.
type AccountAccess ¶
type BoolFromInt ¶
type BoolFromInt bool
BoolFromInt is simple and works like this 1 => true, 0 => false.
func (BoolFromInt) Bool ¶
func (b BoolFromInt) Bool() bool
func (BoolFromInt) MarshalJSON ¶
func (b BoolFromInt) MarshalJSON() ([]byte, error)
func (*BoolFromInt) UnmarshalJSON ¶
func (b *BoolFromInt) UnmarshalJSON(data []byte) error
type Client ¶
func (*Client) AccountGrantCommand ¶
AccuntGrantCommand grants a command to a Bastion account.
func (*Client) AccountListAccesses ¶
func (c *Client) AccountListAccesses(account string) ([]*AccountAccess, error)
AccountListAccesses lists all accesses for an account.
func (*Client) AccountRevokeCommand ¶
AccountRevokeCommand revokes a command from a Bastion account.
func (*Client) AccountSetPIVGrace ¶
AccountSetPIVGrace sets the PIV grace policy for an account with a TTL. The ttl parameter is in seconds.
func (*Client) AccountSetPIVPolicy ¶
AccountSetPIVPolicy sets the PIV policy for an account.
func (*Client) CreateAccount ¶
func (c *Client) CreateAccount(name string, uidOpt UIDOpt, createOpts *CreateAccountOptions) error
CreateAccount creates a new Bastion account.
func (*Client) CreateGroup ¶
CreateGroup creates a new Bastion group.
func (*Client) DeleteAccount ¶
DeleteAccount deletes a Bastion account.
func (*Client) DeleteGroup ¶
DeleteGroup deletes a Bastion group. This is a restricted command that allows deletion of any group.
func (*Client) DestroyGroup ¶
DestroyGroup deletes a Bastion group. This command can be used by group owners to delete their own groups.
func (*Client) GroupAddACLKeeper ¶
GroupAddACLKeeper adds an ACL keeper to a Bastion group.
func (*Client) GroupAddGatekeeper ¶
GroupAddGatekeeper adds a gatekeeper to a Bastion group.
func (*Client) GroupAddGuestAccess ¶
func (c *Client) GroupAddGuestAccess(group, account, host, port, user string, options *GroupAddGuestAccessOptions) error
GroupAddGuestAccess adds a guest access to a group.
func (*Client) GroupAddMember ¶
GroupAddMember adds a member to a Bastion group.
func (*Client) GroupAddOwner ¶
GroupAddOwner adds an owner to a Bastion group.
func (*Client) GroupAddServer ¶
func (c *Client) GroupAddServer(group, host, port, user string, options *GroupAddServerOptions) (*GroupServer, error)
GroupAddServer adds a server access to a group.
func (*Client) GroupDelGuestAccess ¶
func (c *Client) GroupDelGuestAccess(group, account, host, port, user, protocol string, proxyOpts *ProxyOptions, remotePort *int64) error
GroupDelGuestAccess removes a guest access from a group.
func (*Client) GroupDelServer ¶
func (c *Client) GroupDelServer(group, host, port, user, protocol string, proxyOpts *ProxyOptions, remotePort *int64) error
GroupDelServer removes a server access from a group.
func (*Client) GroupListGuestAccesses ¶
func (c *Client) GroupListGuestAccesses(group, account string) ([]*GroupGuestAccess, error)
GroupListGuestAccesses lists all guest accesses from a group.
func (*Client) GroupListServers ¶
func (c *Client) GroupListServers(name string) ([]*GroupServer, error)
GroupListServers lists all accesses from a group.
func (*Client) GroupRemoveACLKeeper ¶
GroupRemoveACLKeeper removes an ACL keeper from a Bastion group.
func (*Client) GroupRemoveGatekeeper ¶
GroupRemoveGatekeeper removes a gatekeeper from a Bastion group.
func (*Client) GroupRemoveMember ¶
GroupRemoveMember removes a member from a Bastion group.
func (*Client) GroupRemoveOwner ¶
GroupRemoveOwner removes an owner from a Bastion group.
func (*Client) GroupTransmitOwnership ¶
GroupTransmitOwnership transmits ownership of a Bastion group to another account. This method must be called by an explicit owner of the group.
func (*Client) ModifyAccount ¶
func (c *Client) ModifyAccount(name string, modifyOpts *ModifyAccountOptions) error
ModifyAccount modifies an existing Bastion account.
func (*Client) ModifyGroup ¶
func (c *Client) ModifyGroup(name string, modifyOpts *GroupModifyOptions) error
ModifyGroup modifies a Bastion group.
func (*Client) SelfListAccesses ¶ added in v0.2.0
func (c *Client) SelfListAccesses() ([]*AccountAccess, error)
SelfListAccesses lists all the accesses for the authenticated account.
type CreateAccountOptions ¶
type CreateAccountOptions struct {
AlwaysActive bool
OshOnly bool
MaxInactiveDays uint
ImmutableKey bool
Comment string
PublicKey string
NoKey bool
TTL int
}
CreateAccountOptions holds options for creating a Bastion account.
type CreationInformation ¶
type EgressStrictHostKeyCheckingPolicy ¶
type EgressStrictHostKeyCheckingPolicy string
EgressStrictHostKeyCheckingPolicy represents the egress strict host key checking policies.
const ( EgressStrictHostKeyCheckingYes EgressStrictHostKeyCheckingPolicy = "yes" EgressStricHostKeyCheckingAcceptNew EgressStrictHostKeyCheckingPolicy = "accept-new" EgressStrictHostKeyCheckingNo EgressStrictHostKeyCheckingPolicy = "no" EgressStrictHostKeyCheckingAsk EgressStrictHostKeyCheckingPolicy = "ask" EgressStrictHostKeyCheckingDefault EgressStrictHostKeyCheckingPolicy = "default" EgressStrictHostKeyCheckingBypass EgressStrictHostKeyCheckingPolicy = "bypass" )
type Group ¶
type Group struct {
Group string `json:"group"`
Inactive []string `json:"inactive"`
Guests []string `json:"guests"`
Owners []string `json:"owners"`
Members []string `json:"members"`
Gatekeepers []string `json:"gatekeepers"`
ACLKeepers []string `json:"aclkeepers"`
GuestAccesses []string `json:"guest_accesses"`
Keys map[string]Key `json:"keys"`
MFARequired *MFARequiredPolicy `json:"mfa_required"`
IdleLockTimeout *string `json:"idle_lock_timeout"`
IdleKillTimeout *string `json:"idle_kill_timeout"`
GuestTtlLimit *string `json:"guest_ttl_limit"`
TryPersonalKeys *BoolFromInt `json:"try_personal_keys"`
}
Group represents a Bastion group.
type GroupAddGuestAccessOptions ¶
type GroupAddGuestAccessOptions struct {
TTL string
Comment string
Protocol string
ProxyOptions *ProxyOptions
RemotePort *int
}
GroupAddGuestAccessOptions represents options for adding a guest access to a group.
type GroupAddServerOptions ¶
type GroupAddServerOptions struct {
Force bool
ForceKey string
ForcePassword string
TTL string
Comment string
Protocol string
ProxyOptions *ProxyOptions
RemotePort *int
}
GroupAddServerOptions represents options for adding a server access to a group.
type GroupGuestAccess ¶
type GroupGuestAccess ACL
type GroupModifyOptions ¶
type GroupModifyOptions struct {
MFARequired *MFARequiredPolicy
IdleLockTimeout *string
IdleKillTimeout *string
GuestTtlLimit *string
TryPersonalKeys *bool
}
GroupModifyOptions holds options for modifying a Bastion group.
type IngressPIVGrace ¶
type IngressPIVGrace struct {
Enabled BoolFromInt `json:"enabled"`
ExpirationTimestamp int `json:"expiration_timestamp"`
SecondsRemaining int `json:"seconds_remaining"`
}
type Key ¶
type Key struct {
Prefix string `json:"prefix"`
ID string `json:"id"`
FromList []string `json:"fromList"`
Fingerprint string `json:"fingerprint"`
Typecode string `json:"typecode"`
Family string `json:"family"`
Filename string `json:"filename"`
Size int `json:"size"`
Mtime int `json:"mtime"`
Fullpath string `json:"fullpath"`
Comment string `json:"comment"`
Base64 string `json:"base64"`
Line string `json:"line"`
}
Key represents a Bastion SSH key.
type KeyAlgo ¶
type KeyAlgo string
KeyAlgo represents a Bastion SSH key algorithm.
func (KeyAlgo) AlgoAndSize ¶
type KeyboardInteractiveChallenge ¶ added in v0.3.0
type KeyboardInteractiveChallenge func(name, instruction string, questions []string, echos []bool) ([]string, error)
KeyboardInteractiveChallenge is a callback for answering SSH keyboard-interactive challenges. It receives the challenge name, instruction, questions, and echo flags, and returns answers.
type LastActivity ¶
type MFARequiredPolicy ¶
type MFARequiredPolicy string
MFARequiredPolicy represents an MFA policies.
const ( MFARequiredPassword MFARequiredPolicy = "password" MFARequiredTOTP MFARequiredPolicy = "totp" MFARequiredAny MFARequiredPolicy = "any" MFARequiredNone MFARequiredPolicy = "none" )
type ModifyAccountOptions ¶
type ModifyAccountOptions struct {
PamAuthBypass *bool
MFAPasswordRequired *YesNoBypass
MFATOTPRequired *YesNoBypass
EgressStrictHostKeyChecking *EgressStrictHostKeyCheckingPolicy
EgressSessionMultiplexing *YesNoDefault
PersonalEgressMFARequired *MFARequiredPolicy
AlwaysActive *bool
IdleIgnore *bool
MaxInactiveDays *int
OshOnly *bool
PubkeyAuthOptional *bool
}
ModifyAccountOptions holds options for modifying a Bastion account.
type PIVPolicy ¶
type PIVPolicy string
PIVPolicy represents the PIV policy for account ingress keys.
type Port ¶
type Port struct {
Number int
// contains filtered or unexported fields
}
Port is a helper to represent port which can be a string or int.
func (*Port) MarshalJSON ¶
func (*Port) UnmarshalJSON ¶
func (*Port) ValueString ¶
type ProxyOptions ¶
ProxyOptions respresents proxy options for adding an access.
type SSHAuthMethod ¶
type SSHAuthMethod func() (ssh.AuthMethod, error)
SSHAuthMethod defines a function that returns an SSH authentication method.
func WithKeyboardInteractiveAuth ¶ added in v0.3.0
func WithKeyboardInteractiveAuth(challenge KeyboardInteractiveChallenge) SSHAuthMethod
WithKeyboardInteractiveAuth returns a keyboard-interactive authentication method using the provided challenge callback.
func WithPrivateKeyAuth ¶
func WithPrivateKeyAuth(privateKey string) SSHAuthMethod
WithPrivateKeyAuth returns a private key authentication method.
func WithPrivateKeyAuthWithPassphrase ¶
func WithPrivateKeyAuthWithPassphrase(privateKey string, passphrase string) SSHAuthMethod
WithPrivateKeyAuthWithPassphrase returns a private key authentication method with passphrase support.
func WithPrivateKeyAuthWithPassphraseWithSignedCert ¶ added in v0.4.0
func WithPrivateKeyAuthWithPassphraseWithSignedCert(privateKey string, passphrase string, cert string) SSHAuthMethod
WithPrivateKeyAuthWithPassphraseWithSignedCert returns a private key authentication method with passphrase support and a signed certificate.
func WithPrivateKeyAuthWithPassphraseWithSignedCertFile ¶ added in v0.5.0
func WithPrivateKeyAuthWithPassphraseWithSignedCertFile(privateKey string, passphrase string, certPath string) SSHAuthMethod
WithPrivateKeyAuthWithPassphraseWithSignedCertFile returns a private key authentication method with passphrase support and a signed certificate read from a file.
func WithPrivateKeyAuthWithSignedCert ¶ added in v0.4.0
func WithPrivateKeyAuthWithSignedCert(privateKey string, cert string) SSHAuthMethod
WithPrivateKeyAuthWithSignedCert returns a private key authentication method with a signed certificate.
func WithPrivateKeyAuthWithSignedCertFile ¶ added in v0.5.0
func WithPrivateKeyAuthWithSignedCertFile(privateKey string, certPath string) SSHAuthMethod
WithPrivateKeyAuthWithSignedCertFile returns a private key authentication method with a signed certificate read from a file.
func WithPrivateKeyFileAuth ¶
func WithPrivateKeyFileAuth(keyPath string) SSHAuthMethod
WithPrivateKeyFileAuth returns a private key file authentication method.
func WithPrivateKeyFileAuthWithPassphrase ¶
func WithPrivateKeyFileAuthWithPassphrase(keyPath string, passphrase string) SSHAuthMethod
WithPrivateKeyFileAuthWithPassphrase returns a private key file authentication method with passphrase support.
func WithPrivateKeyFileAuthWithPassphraseWithSignedCert ¶ added in v0.4.0
func WithPrivateKeyFileAuthWithPassphraseWithSignedCert(keyPath string, passphrase string, cert string) SSHAuthMethod
WithPrivateKeyFileAuthWithPassphraseWithSignedCert returns a private key file authentication method with passphrase support and a signed certificate.
func WithPrivateKeyFileAuthWithPassphraseWithSignedCertFile ¶ added in v0.5.0
func WithPrivateKeyFileAuthWithPassphraseWithSignedCertFile(keyPath string, passphrase string, certPath string) SSHAuthMethod
WithPrivateKeyFileAuthWithPassphraseWithSignedCertFile returns a private key file authentication method with passphrase support and a signed certificate read from a file.
func WithSSHAgentAuth ¶
func WithSSHAgentAuth() SSHAuthMethod
WithSSHAgentAuth returns an SSH agent authentication method.
type UIDOpt ¶
type UIDOpt func(*UIDOptions)
UIDOpt defines a function type for setting UID options.
func WithAutoUID ¶
func WithAutoUID() UIDOpt
WithAutoUID sets the option to automatically assign a UID.
func WithSpecificUID ¶
WithSpecificUID sets a specific UID for the account.
type UIDOptions ¶
type UIDOptions struct {
// contains filtered or unexported fields
}
UIDOptions holds the uid options for creating an account.
type YesNoBypass ¶
type YesNoBypass string
YesNoBypass represents a three-state option: yes, no, or bypass.
const ( YesNoBypassYes YesNoBypass = "yes" YesNoBypassNo YesNoBypass = "no" YesNoBypassBypass YesNoBypass = "bypass" )
type YesNoDefault ¶
type YesNoDefault string
YesNoDefault represents a three-state option: yes, no, or default.
const ( YesNoDefaultYes YesNoDefault = "yes" YesNoDefaultNo YesNoDefault = "no" YesNoDefaultDefault YesNoDefault = "default" )