Documentation
¶
Overview ¶
package deploy provides functionality for connecting to remote hosts via SSH and managing their authorized_keys files. This file contains the Unix-specific implementation for locating the SSH agent.
package deploy provides functionality for connecting to remote hosts via SSH and managing their authorized_keys files. This file contains the logic for generating the content of an authorized_keys file from database records.
package deploy provides functionality for connecting to remote hosts via SSH and managing their authorized_keys files. This file contains the logic for importing public keys from a remote host's authorized_keys file into the Keymaster database.
package deploy provides functionality for connecting to remote hosts via SSH and managing their authorized_keys files. This file contains the core SSH and SFTP client logic for connecting, authenticating, and transferring files.
Index ¶
Constants ¶
const SystemKeyRestrictions = "command=\"internal-sftp\",no-port-forwarding,no-x11-forwarding,no-agent-forwarding,no-pty"
SystemKeyRestrictions defines the SSH options applied to the Keymaster system key. These restrictions limit the key to only allow SFTP access for file management, enhancing security by preventing shell access, port forwarding, etc.
Variables ¶
var ErrHostKeySuccessfullyRetrieved = errors.New("keymaster: successfully retrieved host key")
ErrHostKeySuccessfullyRetrieved is a sentinel error used to gracefully stop the SSH handshake in GetRemoteHostKey once the host key has been captured.
Functions ¶
func GenerateKeysContent ¶
GenerateKeysContent constructs the authorized_keys file content for a given account. It combines the active system key, global user keys, and account-specific keys.
func GetRemoteHostKey ¶
GetRemoteHostKey connects to a host just to retrieve its public key.
Types ¶
type Deployer ¶
type Deployer struct {
// contains filtered or unexported fields
}
Deployer handles the connection and deployment to a remote host.
func NewDeployer ¶
NewDeployer creates a new SSH connection and returns a Deployer.
func (*Deployer) Close ¶
func (d *Deployer) Close()
Close closes the underlying SSH and SFTP clients.
func (*Deployer) DeployAuthorizedKeys ¶
DeployAuthorizedKeys uploads the new authorized_keys content and moves it into place. This function uses a pure-SFTP method to be compatible with restricted keys (e.g., command="internal-sftp"). It uses a backup-and-rename strategy for compatibility with SFTP servers that don't support atomic overwrites (e.g., on Windows).
func (*Deployer) GetAuthorizedKeys ¶
GetAuthorizedKeys reads and returns the content of the remote authorized_keys file.