sshmonitor

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAMConfigFile   = "/etc/pam.d/sshd"
	HookBinaryPath  = "/usr/local/bin/pika-agent"
	HookCommand     = "ssh-login-hook"
	SSHDConfigFile  = "/etc/ssh/sshd_config"
	UsePAMDirective = "UsePAM yes"
)
View Source
const (
	DefaultSocketDir  = "/run/pika"
	DefaultSocketPath = "/run/pika/ssh_login.sock"
)

Variables

This section is empty.

Functions

func BuildEventFromEnv

func BuildEventFromEnv() protocol.SSHLoginEvent

BuildEventFromEnv 从 PAM 环境变量构建事件

func SendEvent

func SendEvent(event protocol.SSHLoginEvent) error

SendEvent 发送事件到本地 socket

func SendEventFromEnv

func SendEventFromEnv() error

SendEventFromEnv 从 PAM 环境变量构建并发送事件

Types

type HookManager

type HookManager struct{}

HookManager PAM Hook 管理器

func NewHookManager

func NewHookManager() *HookManager

NewHookManager 创建管理器

func (*HookManager) Install

func (h *HookManager) Install() error

Install 安装 PAM Hook

func (*HookManager) Uninstall

func (h *HookManager) Uninstall() error

Uninstall 卸载 PAM Hook

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor SSH登录监控器

func NewMonitor

func NewMonitor() *Monitor

NewMonitor 创建监控器

func (*Monitor) GetEvents

func (m *Monitor) GetEvents() <-chan protocol.SSHLoginEvent

GetEvents 获取事件通道

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context, config protocol.SSHLoginConfig) error

Start 启动监控(根据配置启用/禁用)

func (*Monitor) Stop

func (m *Monitor) Stop() error

Stop 停止监控

Jump to

Keyboard shortcuts

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