Documentation
¶
Index ¶
- func AddSshFlags(flags *pflag.FlagSet, sshConf *SshConfig)
- func DialSshRemote(ctx context.Context, conf *SshConfig, stopChan <-chan struct{}) (remote *ssh.Client, err error)
- func ExposeLocalPortToRemote(ctx context.Context, remoteSSHServer, remotePort, localPort netip.AddrPort) error
- func GetClient() (*client.Client, *command.DockerCli, error)
- func GetKrb5Path() string
- func JumpTo(ctx context.Context, bClient *ssh.Client, to SshConfig, ...) (client *ssh.Client, err error)
- func NewPrincipal(name types.PrincipalName, realm string) principal
- func PortMapUntil(ctx context.Context, conf *SshConfig, remote, local netip.AddrPort) error
- func PrintLine(f func(...any), msg ...string)
- func PullImage(ctx context.Context, platform *v1.Platform, cli *client.Client, ...) error
- func RemoteRun(client *ssh.Client, cmd string, env map[string]string) (output []byte, errOut []byte, err error)
- func SCP(client *ssh.Client, stdout, stderr io.Writer, filename, to string) error
- func SCPAndExec(stdout, stderr io.Writer, client *ssh.Client, filename, to string, ...) error
- func SshJump(ctx context.Context, conf *SshConfig, flags *pflag.FlagSet, print bool) (path string, err error)
- func SshJumpAndSetEnv(ctx context.Context, conf *SshConfig, flags *pflag.FlagSet, print bool) error
- func TransferImage(ctx context.Context, conf *SshConfig, imageSource, imageTarget string, ...) error
- type CCache
- func (c *CCache) AddCredential(cred *Credential)
- func (c *CCache) Contains(p types.PrincipalName) bool
- func (c *CCache) GetClientPrincipalName() types.PrincipalName
- func (c *CCache) GetClientRealm() string
- func (c *CCache) GetEntries() []*Credential
- func (c *CCache) GetEntry(p types.PrincipalName) (*Credential, bool)
- func (c *CCache) Marshal() ([]byte, error)
- func (c *CCache) SetDefaultPrincipal(d principal)
- func (c *CCache) Unmarshal(b []byte) error
- type Credential
- type Krb5ClientState
- type Krb5InitiatorClient
- func NewKrb5InitiatorClientWithCache(krb5Conf, cacheFile string) (kcl Krb5InitiatorClient, err error)
- func NewKrb5InitiatorClientWithKeytab(username string, krb5Conf, keytabConf string) (kcl Krb5InitiatorClient, err error)
- func NewKrb5InitiatorClientWithPassword(username, password, krb5Conf string) (kcl Krb5InitiatorClient, err error)
- type SshConfig
- func (config SshConfig) AliasRecursion(ctx context.Context, stopChan <-chan struct{}) (client *ssh.Client, err error)
- func (s SshConfig) Clone() SshConfig
- func (config SshConfig) Dial(ctx context.Context, stopChan <-chan struct{}) (client *ssh.Client, err error)
- func (config SshConfig) GetAuth() ([]ssh.AuthMethod, error)
- func (config *SshConfig) IsEmpty() bool
- func (config SshConfig) JumpRecursion(ctx context.Context, stopChan <-chan struct{}) (client *ssh.Client, err error)
- func (config *SshConfig) ToRPC() *rpc.SshJump
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSshFlags ¶
func DialSshRemote ¶
func DialSshRemote(ctx context.Context, conf *SshConfig, stopChan <-chan struct{}) (remote *ssh.Client, err error)
DialSshRemote https://github.com/golang/go/issues/21478
func ExposeLocalPortToRemote ¶ added in v2.3.10
func ExposeLocalPortToRemote(ctx context.Context, remoteSSHServer, remotePort, localPort netip.AddrPort) error
ExposeLocalPortToRemote remote forwarding port (on remote SSH server network) local service to be forwarded
func GetKrb5Path ¶
func GetKrb5Path() string
func NewPrincipal ¶
func NewPrincipal(name types.PrincipalName, realm string) principal
NewPrincipal returns a new principal
func PortMapUntil ¶
func PullImage ¶
func PullImage(ctx context.Context, platform *v1.Platform, cli *client.Client, dockerCli *command.DockerCli, img string, out io.Writer) error
PullImage image.RunPull(ctx, c, image.PullOptions{})
func SCPAndExec ¶
func SCPAndExec(stdout, stderr io.Writer, client *ssh.Client, filename, to string, commands ...string) error
SCPAndExec copy file to remote and exec command
func SshJumpAndSetEnv ¶
func TransferImage ¶
func TransferImage(ctx context.Context, conf *SshConfig, imageSource, imageTarget string, out io.Writer) error
TransferImage 1) if not special ssh config, just pull image and tag and push 2) if special ssh config, pull image, tag image, save image and scp image to remote, load image and push
Types ¶
type CCache ¶
type CCache struct { Version uint8 Header header DefaultPrincipal principal Credentials []*Credential Path string }
CCache is the file credentials cache as define here: https://web.mit.edu/kerberos/krb5-latest/doc/formats/ccache_file_format.html
func LoadCCache ¶
LoadCCache loads a credential cache file into a CCache type.
func NewV4CCache ¶
func NewV4CCache() *CCache
NewV4CCache creates a new Version 4 CCache with no credentials in it
func (*CCache) AddCredential ¶
func (c *CCache) AddCredential(cred *Credential)
AddCredential adds a credential to a CCache
func (*CCache) Contains ¶
func (c *CCache) Contains(p types.PrincipalName) bool
Contains tests if the cache contains a credential for the provided server PrincipalName
func (*CCache) GetClientPrincipalName ¶
func (c *CCache) GetClientPrincipalName() types.PrincipalName
GetClientPrincipalName returns a PrincipalName type for the client the credentials cache is for.
func (*CCache) GetClientRealm ¶
GetClientRealm returns the reals of the client the credentials cache is for.
func (*CCache) GetEntries ¶
func (c *CCache) GetEntries() []*Credential
GetEntries filters out configuration entries an returns a slice of credentials.
func (*CCache) GetEntry ¶
func (c *CCache) GetEntry(p types.PrincipalName) (*Credential, bool)
GetEntry returns a specific credential for the PrincipalName provided.
func (*CCache) SetDefaultPrincipal ¶
func (c *CCache) SetDefaultPrincipal(d principal)
SetDefaultPrincipal sets the default principal for a CCache
type Credential ¶
type Credential struct { Client principal Server principal Key types.EncryptionKey AuthTime time.Time StartTime time.Time EndTime time.Time RenewTill time.Time IsSKey bool TicketFlags asn1.BitString Addresses []types.HostAddress AuthData []types.AuthorizationDataEntry Ticket []byte SecondTicket []byte }
Credential holds a Kerberos client's ccache credential information.
type Krb5ClientState ¶
type Krb5ClientState int
const ( ContextFlagREADY = 128 /* initiator states */ InitiatorStart Krb5ClientState = iota InitiatorRestart InitiatorWaitForMutal InitiatorReady )
type Krb5InitiatorClient ¶
type Krb5InitiatorClient struct {
// contains filtered or unexported fields
}
func NewKrb5InitiatorClientWithCache ¶
func NewKrb5InitiatorClientWithCache(krb5Conf, cacheFile string) (kcl Krb5InitiatorClient, err error)
func NewKrb5InitiatorClientWithKeytab ¶
func NewKrb5InitiatorClientWithKeytab(username string, krb5Conf, keytabConf string) (kcl Krb5InitiatorClient, err error)
func NewKrb5InitiatorClientWithPassword ¶
func NewKrb5InitiatorClientWithPassword(username, password, krb5Conf string) (kcl Krb5InitiatorClient, err error)
func (*Krb5InitiatorClient) DeleteSecContext ¶
func (k *Krb5InitiatorClient) DeleteSecContext() error
func (*Krb5InitiatorClient) GetMIC ¶
func (k *Krb5InitiatorClient) GetMIC(micFiled []byte) ([]byte, error)
func (*Krb5InitiatorClient) InitSecContext ¶
type SshConfig ¶
type SshConfig struct { Addr string User string Password string Keyfile string Jump string ConfigAlias string RemoteKubeconfig string // GSSAPI GSSAPIKeytabConf string GSSAPIPassword string GSSAPICacheFile string }