config

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2021 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Overview

Package config provide the ssh_config(5) parser and getter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config contains mapping of host's patterns and its options from SSH configuration file.

func Load

func Load(file string) (cfg *Config, err error)

Load SSH configuration from file.

func (*Config) Get

func (cfg *Config) Get(s string) (section *Section)

Get the Host or Match configuration that match with the pattern "s".

func (*Config) Prepend

func (cfg *Config) Prepend(other *Config)

Prepend other Config's sections to this Config. The other's sections will be at the top of the list.

This function can be useful if we want to load another SSH config file without using Include directive.

type PermittedCNAMEs

type PermittedCNAMEs struct {
	// contains filtered or unexported fields
}

type Section

type Section struct {
	AddKeysToAgent              string
	AddressFamily               string
	BindAddress                 string
	BindInterface               string
	CanonicalDomains            []string
	CanonicalizeHostname        string
	CanonicalizeMaxDots         int
	CanonicalizePermittedCNAMEs *PermittedCNAMEs
	CASignatureAlgorithms       []string
	CertificateFile             []string
	ConnectionAttempts          int
	ConnectTimeout              int

	// Environments contains system environment variables that will be
	// passed to Execute().
	// The key and value is derived from "SendEnv" and "SetEnv".
	Environments map[string]string

	Hostname                          string
	IdentityFile                      []string
	Port                              string
	User                              string
	XAuthLocation                     string
	IsBatchMode                       bool
	IsCanonicalizeFallbackLocal       bool
	IsChallengeResponseAuthentication bool
	IsCheckHostIP                     bool
	IsClearAllForwardings             bool
	UseCompression                    bool
	UseVisualHostKey                  bool

	// List of SSH private keys.
	Signers []ssh.Signer

	// WorkingDir contains the directory where the SSH client started.
	// This value is required when client want to copy file from/to
	// remote.
	// This field is optional, default to current working directory from
	// os.Getwd() or user's home directory.
	WorkingDir string

	// The first IdentityFile that exist and valid.
	PrivateKeyFile string
	// contains filtered or unexported fields
}

Section is the type that represent SSH client Host and Match section in configuration.

func (*Section) GenerateSigners

func (section *Section) GenerateSigners(agentc agent.ExtendedAgent) (err error)

GenerateSigners convert the IdentityFile to ssh.Signer for authentication using PublicKey.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL