config

package
v0.0.0-...-7f98e7a Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChkConfig

func ChkConfig(config *[]byte) (bool, error)

Types

type HostSsh

type HostSsh struct {
	Hostname string
	Rules    []SshMatchRule
}

type ListenAddr

type ListenAddr struct {
	Addr    string // hostname|address, hostname:port, IPv4_address:port, or [hostname|address]:port in conf string.
	Port    uint16
	RDomain string
}

ListenAddr is a parsed ListenAddress directive.

type MatchSsh

type MatchSsh struct {
	Criteria map[string]string
	Rules    []SshMatchRule
}

MatchSsh is an ssh_config Match block.

type MatchSshd

type MatchSshd struct {
	Criteria map[string]string
	Rules    []SshdMatchRule
}

MatchSshd is an sshd_config Match block.

type SshConf

type SshConf struct {
	AddKeysToAgent                  string      // *
	AddressFamily                   string      // .
	BatchMode                       sshBool     // .
	BindAddress                     string      // *
	BindInterface                   string      // *
	CanonicalDomains                []string    // *
	CanonicalizeFallbackLocal       sshBool     // *
	CanonicalizeHostname            sshBool     // *
	CanonicalizeMaxDots             uint8       // *
	CanonicalizePermittedCNAMEs     [][2]string // *
	CASignatureAlgorithms           []string    // *
	CertificateFile                 string      // *
	ChallengeResponseAuthentication sshBool     // *
	CheckHostIP                     sshBool     // .+
	Ciphers                         []string    // .+
	ClearAllForwardings             sshBool     // *
	Compression                     sshBool     // *
	ConnectionAttempts              uint16      // *
	ConnectTimeout                  uint16      // .
	ControlMaster                   string      // *
	ControlPath                     string      // *
	ControlPersist                  string      // *
	EnableSSHKeysign                sshBool     // *
	EscapeChar                      string      // .
	ExitOnForwardFailure            sshBool     // *
	FingerprintHash                 string      // *
	ForwardAgent                    string      // .
	ForwardXll                      sshBool     // .
	ForwardX11Timeout               string      // .
	ForwardX11Trusted               sshBool     // *
	GatewayPorts                    sshBool     // *
	GlobalKnownHostsFile            []string    // *
	GSSAPIAuthentication            sshBool     // .
	GSSAPIDelegateCredentials       sshBool     // .
	HashKnownHosts                  sshBool     // *+
	Host                            []HostSsh   // .
	HostbasedAuthentication         sshBool     // .
	HostbasedKeyTypes               []string    // *+
	HostKeyAlgorithms               []string    // *+
	HostKeyAlias                    string      // *
	Hostname                        string      // *
	IdentitiesOnly                  sshBool     // *
	IdentityAgent                   string      // *
	IdentityFile                    []string    // .
	IgnoreUnknown                   []string    // *
	Include                         string      // *
	IPQoS                           string      // *
	KbdInteractiveAuthentication    sshBool     // *
	KbdInteractiveDevices           []string    // *
	KexAlgorithms                   []string    // *
	LocalCommand                    string      // *
	LocalForward                    [2]string   // *
}

SshConf represents an /etc/ssh/ssh_config (or ~/.ssh/config) file

func (*SshConf) Validate

func (c *SshConf) Validate() (validConf bool, allErr []error)

Validate validates the actual struct of an SshConf itself, ensuring that certain list fields contain valid item(s). It collects all found issues in allErr.

type SshMatchRule

type SshMatchRule struct {
}

SshMatchRule is more or less a subset of SshConf. These are valid keywords for Match blocks in sshd_config.

type SshdConf

type SshdConf struct {
	SshdMatchRule
	AddressFamily                   string            // .
	CASignatureAlgorithms           []string          // *
	ChallengeResponseAuthentication sshBool           // .+
	Ciphers                         []string          // +*
	Compression                     string            // .
	DisableForwarding               sshBool           // *
	ExposeAuthInfo                  sshBool           // *
	FingerprintHash                 string            // *
	GSSAPICleanupCredentials        sshBool           // .
	GSSAPIStrictAcceptorCheck       sshBool           // *
	HostCertificate                 string            // *
	HostKeyAgent                    string            // *
	HostKeyAlgorithms               []string          // +*
	HostKey                         []string          // .+
	IgnoreUserKnownHosts            sshBool           // .
	KerberosGetAFSToken             sshBool           // .
	KerberosOrLocalPasswd           sshBool           // .
	KerberosTicketCleanup           sshBool           // .
	KexAlgorithms                   string            // +*
	ListenAddress                   ListenAddr        // .
	LoginGraceTime                  string            // .
	MACs                            []string          // +*
	Match                           map[string]string // .
	MaxStartups                     string            // .
	PermitUserEnvironment           sshBool           // .
	PidFile                         string            // .
	Port                            []uint16          // .
	PrintLastLog                    sshBool           // .+
	PrintMotd                       sshBool           // .
	Protocol                        int               // +*
	PubkeyAuthOptions               string            // *
	SecurityKeyProvider             string            // *
	StrictModes                     sshBool           // .+
	Subsystem                       string            // .
	SyslogFacility                  string            // .
	TCPKeepAlive                    sshBool           // .
	UseDNS                          sshBool           // .
	UsePAM                          sshBool           // .
	VersionAddendum                 string            // .
	X11UseLocalhost                 sshBool           // .
	XAuthLocation                   string            // *
}

SshdConf represents an /etc/ssh/sshd_config file's directives/values. Values in SshdMatchRule are not reproduced here.

func (*SshdConf) Validate

func (c *SshdConf) Validate() (validConf bool, allErr []error)

Validate validates the actual struct of an SshdConf itself, ensuring that certain list fields contain valid item(s). It collects all found issues in allErr.

type SshdMatchRule

type SshdMatchRule struct {
	AcceptEnv                       []string // *
	AllowAgentForwarding            sshBool  // .
	AllowGroups                     []string // *
	AllowStreamLocalForwarding      string   // *
	AllowTcpForwarding              string   // .
	AllowUsers                      []string // *
	AuthenticationMethods           []string // +*
	AuthorizedKeysCommand           string   // .
	AuthorizedKeysCommandUser       string   // .
	AuthorizedKeysFile              string   // .
	AuthorizedPrincipalsCommand     string   // *
	AuthorizedPrincipalsCommandUser string   // *
	AuthorizedPrincipalsFile        string   // .
	Banner                          string   // .
	ChrootDirectory                 string   // .
	ClientAliveCountMax             int      // .
	ClientAliveInterval             int      // .
	DenyGroups                      []string // *
	DenyUsers                       []string // *
	ForceCommand                    string   // *
	GatewayPorts                    string   // .
	GSSAPIAuthentication            sshBool  // .
	HostbasedAcceptedKeyTypes       []string // *+
	HostbasedAuthentication         sshBool  // .
	HostbasedUsesNameFromPacketOnly sshBool  // *
	IgnoreRhosts                    string   // .
	// Do we handle includes? Or just let sshd -T handle it?
	Include string // *
	// Accepts one or two. If two, first is interactive and second is non-interactive.
	IPQoS                        [2]string // *
	KbdInteractiveAuthentication sshBool   // *
	KerberosAuthentication       sshBool   // .
	LogLevel                     string    // .
	MaxAuthTries                 int       // .
	MaxSessions                  int       // .
	PasswordAuthentication       sshBool   // .+
	PermitEmptyPasswords         sshBool   // +
	PermitListen                 string    // *
	PermitOpen                   string    // *
	PermitRootLogin              string    // .+
	PermitTTY                    sshBool   // .
	PermitTunnel                 string    // .
	PermitUserRC                 sshBool   // *
	PubkeyAcceptedKeyTypes       []string  // *
	PubkeyAuthentication         sshBool   // .+
	RekeyLimit                   []string  // .
	RevokedKeys                  string    // *
	RDomain                      string    // *
	SetEnv                       sshEnv    // *
	// max is 4095, it goes in the config as an octal.
	StreamLocalBindMask   uint16  // *
	StreamLocalBindUnlink sshBool // *
	TrustedUserCAKeys     string  // *
	X11DisplayOffset      int     // .
	X11Forwarding         sshBool // .
}

SshdMatchRule is more or less a subset of SshdConf. These are valid keywords for Match blocks in sshd_config.

Jump to

Keyboard shortcuts

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