config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config handles loading and validating the miraged daemon configuration. Config is read from a YAML file, merged with defaults, and validated.

Index

Constants

View Source
const (
	DefaultHTTPSPort = 443
	DefaultDNSPort   = 53
	DefaultDataDir   = "/var/lib/mirage"
)

Default values for optional configuration fields.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACMEConfig

type ACMEConfig struct {
	Email        string `yaml:"email"`         // contact address for ACME account registration
	DirectoryURL string `yaml:"directory_url"` // ACME directory URL; defaults to Let's Encrypt production
}

ACMEConfig holds settings for automatic certificate provisioning via ACME (Let's Encrypt). Required when not using self-signed certificates.

type APIConfig

type APIConfig struct {
	// SecretHostname is the Host header value that routes traffic to the API.
	// Requests to any other hostname go through the normal phishing pipeline.
	// If empty, the API is disabled.
	SecretHostname string `yaml:"secret_hostname"`
}

APIConfig holds settings for the management REST API.

type Config

type Config struct {
	Domain       string              `yaml:"domain"`
	ExternalIPv4 string              `yaml:"external_ipv4"`
	BindAddress  string              `yaml:"bind_address"` // listen address; defaults to 0.0.0.0
	HTTPSPort    int                 `yaml:"https_port"`
	DNSPort      int                 `yaml:"dns_port"`
	SpoofURL     string              `yaml:"spoof_url"` // default spoof URL served to bots/blocked visitors; can be overridden per-lure
	DataDir      string              `yaml:"data_dir"`
	SelfSigned   bool                `yaml:"self_signed"`
	DNSProviders []DNSProviderConfig `yaml:"dns_providers"`
	API          APIConfig           `yaml:"api"`
	ACME         ACMEConfig          `yaml:"acme"`
	Obfuscator   ObfuscatorConfig    `yaml:"obfuscator"`
	Puppet       PuppetConfig        `yaml:"puppet"`
}

Config is the top-level configuration for miraged.

func Load

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

Load reads and parses the config file at path. Unknown fields in the YAML are rejected. Sensible defaults are applied for omitted optional fields.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks all required fields and constraints, returning all errors joined with semicolons so the operator can fix everything in one pass.

type DNSProviderConfig

type DNSProviderConfig struct {
	Alias    string            `yaml:"alias"`
	Provider string            `yaml:"provider"`
	Settings map[string]string `yaml:"settings"`
}

DNSProviderConfig holds the settings for one DNS provider integration.

type ObfuscatorConfig

type ObfuscatorConfig struct {
	Enabled        bool          `yaml:"enabled"`
	NodePath       string        `yaml:"node_path"`       // path to node binary; empty = search PATH
	SidecarDir     string        `yaml:"sidecar_dir"`     // dir containing package.json and index.js
	RequestTimeout time.Duration `yaml:"request_timeout"` // per-call timeout (default: 5s)
	MaxConcurrent  int           `yaml:"max_concurrent"`  // max parallel obfuscations (default: 4)
}

ObfuscatorConfig holds settings for the JavaScript obfuscation sidecar.

type PuppetConfig

type PuppetConfig struct {
	Enabled      bool          `yaml:"enabled"`
	ChromiumPath string        `yaml:"chromium_path"` // empty = search PATH
	UserAgent    string        `yaml:"user_agent"`    // empty = default Chrome UA
	MinInstances int           `yaml:"min_instances"` // default: 1
	MaxInstances int           `yaml:"max_instances"` // default: 3
	NavTimeout   time.Duration `yaml:"nav_timeout"`   // default: 30s
	CacheTTL     time.Duration `yaml:"cache_ttl"`     // default: 1h
}

PuppetConfig holds settings for the headless browser puppet service that collects real browser telemetry from target sites and injects overrides into victim responses so sessions appear indistinguishable from direct visits.

Jump to

Keyboard shortcuts

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