Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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 ¶
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.