config

package
v0.0.0-...-6a41818 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigurationName = "config.yaml"
	DownloadDirName   = "downloads"
	LogsDirName       = "session_logs"
	PrivateKeyName    = "private_key"
	RootFSName        = "root_fs.tar.gz"
	AppLogName        = "app.log"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Motd             string `json:"motd"`
	SSHPort          int    `json:"ssh_port" validate:"gte=0,lte=65535"`
	SSHBanner        string `json:"ssh_banner"`
	AllowAnyPassword bool   `json:"allow_any_password"`

	GlobalPasswords []string `json:"global_passwords"`

	OS OS `json:"os"`

	Users []User `json:"users" validate:"unique=Username"`

	Uname Uname `json:"uname"`
	// contains filtered or unexported fields
}

func Initialize

func Initialize(path string, logger *log.Logger) (*Configuration, error)

Initialize creates the honeypot configuartion in the given directory.

func Load

func Load(path string) (*Configuration, error)

Load loads the configuration from the directory.

func (*Configuration) CreateDownload

func (c *Configuration) CreateDownload(name string) (afero.File, error)

Create a download with the given name.

func (*Configuration) CreateSessionLog

func (c *Configuration) CreateSessionLog(name string) (afero.File, error)

func (*Configuration) GetPasswords

func (c *Configuration) GetPasswords(username string) []string

GetPasswords returns allowable passwords for the given username.

func (*Configuration) OpenAppLog

func (c *Configuration) OpenAppLog() (afero.File, error)

OpenAppLog opens the application log in an append only state.

func (*Configuration) OpenFilesystemTarGz

func (c *Configuration) OpenFilesystemTarGz() (afero.File, error)

OpenFilesystemTarGz opens the backing filesystem .tar.gz file.

func (*Configuration) PrivateKeyPem

func (c *Configuration) PrivateKeyPem() ([]byte, error)

PrivateKeyPem returns the bytes of the private key.

func (*Configuration) ReadAppLog

func (c *Configuration) ReadAppLog() (afero.File, error)

func (*Configuration) Validate

func (c *Configuration) Validate() error

Validate the configuration for basic semantic errors.

type OS

type OS struct {
	DefaultShell string `json:"default_shell" validate:"required"`
	DefaultPath  string `json:"default_path" validate:"required"`
}

type Uname

type Uname struct {
	KernelName       string `json:"kernel_name" validate:"required"`               // Kernel Name name e.g. "Linux".
	Nodename         string `json:"nodename" validate:"required,hostname_rfc1123"` // Hostname of the machine on one of its networks.
	KernelRelease    string `json:"kernel_release" validate:"required"`            // OS release e.g. "4.15.0-147-generic"
	KernelVersion    string `json:"kernel_version" validate:"required"`            // OS version e.g. "#151-Ubuntu SMP Fri Jun 18 19:21:19 UTC 2021"
	HardwarePlatform string `json:"hardware_platform" validate:"required"`         // Machnine name e.g. "x86_64"
	Domainname       string `json:"domainname" validate:""`                        // NIS or YP domain name.
}

type User

type User struct {
	Username  string   `json:"username" validate:"required"`
	UID       int      `json:"uid" validate:"gte=0"`
	GID       int      `json:"gid" validate:"gte=0"`
	Home      string   `json:"home" validate:"required"`
	Shell     string   `json:"shell" validate:"required"`
	Passwords []string `json:"passwords" validate:"unique"`
}

Jump to

Keyboard shortcuts

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