ssh

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureAuth

func ConfigureAuth(config SSHAuthConfig) error

ConfigureAuth 配置SSH认证方式

func DebugSSHConfig

func DebugSSHConfig() string

DebugSSHConfig 显示SSH配置信息

func GetPasswordAuthStatus

func GetPasswordAuthStatus() (bool, error)

GetPasswordAuthStatus 获取密码登录的状态

func GetPubKeyAuthStatus

func GetPubKeyAuthStatus() (bool, error)

GetPubKeyAuthStatus 获取密钥认证状态

func GetSSHPort

func GetSSHPort() (int, error)

GetSSHPort 获取当前SSH端口

func NewCommand

func NewCommand() *cobra.Command

Types

type KeyType

type KeyType string

KeyType 定义SSH密钥类型

const (
	// KeyTypeEd25519 使用Ed25519算法(推荐)
	KeyTypeEd25519 KeyType = "ed25519"
	// KeyTypeRSA 使用RSA算法(用于兼容旧系统)
	KeyTypeRSA KeyType = "rsa"
)

type KeyTypeConfig

type KeyTypeConfig struct {
	Type KeyType
	Bits int // RSA密钥长度
}

KeyTypeConfig 定义密钥生成的配置

func DefaultKeyConfig

func DefaultKeyConfig() KeyTypeConfig

DefaultKeyConfig 返回推荐的密钥配置

type SSHAuthConfig

type SSHAuthConfig struct {
	KeyType         KeyTypeConfig // 密钥类型配置
	DisablePassword bool          // 是否禁用密码登录
}

SSHAuthConfig SSH认证配置

func DefaultAuthConfig

func DefaultAuthConfig() SSHAuthConfig

DefaultAuthConfig 返回默认的SSH认证配置

Jump to

Keyboard shortcuts

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