sshd

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lookup

func Lookup(configPath string, key string) ([]string, error)

Lookup key in the effective SSHD config. This doesn't search the config path. Instead it uses sshd -T to get the values of default paramters too.

Types

type Modifier

type Modifier struct {
	ConfigPath string
	// contains filtered or unexported fields
}

Modifier provides a safe wrapper to modify SSHD configuration. Changes are verified before being commited. If verification fails, the original file is restored.

func (*Modifier) Commit

func (s *Modifier) Commit() error

Commit is a function to apply the SSHD config modifications made by Set to config file and test whether the resulting file is valid. The check is performed with 'sshd -t'. If the check fails, then the file is reverted to the original before returning the error.

func (*Modifier) Set

func (s *Modifier) Set(key, value string)

Set adds a key value pair to the SSHD config. It will leave other config lines with the same key and only replace a line if it is exactly the same. Calling this function does not apply the change until Commit is called.

func (*Modifier) SetUnique

func (s *Modifier) SetUnique(key, value string)

SetUnique sets a unique key in the SSHD config. This means that any other use of the key, even with a different value will be replaced. SetUnique expects that there is at most 1 use of the key in the SSHD config (i.e. the key is unique in the existing SSHD config). Calling this function does not apply the change until Commit is called.

Jump to

Keyboard shortcuts

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