config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2017 License: GPL-3.0 Imports: 9 Imported by: 122

Documentation

Index

Constants

View Source
const (
	// RedHat is
	RedHat = "redhat"

	// Debian is
	Debian = "debian"

	// Ubuntu is
	Ubuntu = "ubuntu"

	// CentOS is
	CentOS = "centos"

	// Fedora is
	Fedora = "fedora"

	// Amazon is
	Amazon = "amazon"

	// Oracle is
	Oracle = "oracle"

	// FreeBSD is
	FreeBSD = "freebsd"

	// Raspbian is
	Raspbian = "raspbian"

	// Windows is
	Windows = "windows"

	// OpenSUSE is
	OpenSUSE = "opensuse"

	// OpenSUSELeap is
	OpenSUSELeap = "opensuse.leap"

	// SUSEEnterpriseServer is
	SUSEEnterpriseServer = "suse.linux.enterprise.server"

	// SUSEEnterpriseDesktop is
	SUSEEnterpriseDesktop = "suse.linux.enterprise.desktop"

	// SUSEOpenstackCloud is
	SUSEOpenstackCloud = "suse.openstack.cloud"
)

Variables

View Source
var (
	// Colors has ansi color list
	Colors = []string{
		"\033[32m",
		"\033[33m",
		"\033[36m",
		"\033[35m",
		"\033[31m",
		"\033[34m",
	}
	// ResetColor is reset color
	ResetColor = "\033[0m"
)

Functions

func Load

func Load(path, keyPass string) error

Load loads configuration

Types

type Config

type Config struct {
	Debug    bool
	DebugSQL bool
	Lang     string

	EMail   SMTPConf
	Slack   SlackConf
	Default ServerInfo
	Servers map[string]ServerInfo

	CvssScoreOver      float64
	IgnoreUnscoredCves bool
	IgnoreUnfixed      bool

	SSHNative      bool
	ContainersOnly bool
	Deep           bool
	SkipBroken     bool

	HTTPProxy  string `valid:"url"`
	LogDir     string
	ResultsDir string

	CveDBType string
	CveDBPath string
	CveDBURL  string

	OvalDBType string
	OvalDBPath string
	OvalDBURL  string

	CacheDBPath string

	RefreshCve bool

	FormatXML         bool
	FormatJSON        bool
	FormatOneEMail    bool
	FormatOneLineText bool
	FormatShortText   bool
	FormatFullText    bool

	GZIP bool

	AwsProfile   string
	AwsRegion    string
	S3Bucket     string
	S3ResultsDir string

	AzureAccount   string
	AzureKey       string `json:"-"`
	AzureContainer string

	Pipe bool
	Diff bool
}

Config is struct of Configuration

var Conf Config

Conf has Configuration

func (Config) ValidateOnConfigtest added in v0.2.0

func (c Config) ValidateOnConfigtest() bool

ValidateOnConfigtest validates

func (Config) ValidateOnPrepare added in v0.2.0

func (c Config) ValidateOnPrepare() bool

ValidateOnPrepare validates configuration

func (Config) ValidateOnReport added in v0.2.0

func (c Config) ValidateOnReport() bool

ValidateOnReport validates configuration

func (Config) ValidateOnScan added in v0.2.0

func (c Config) ValidateOnScan() bool

ValidateOnScan validates configuration

func (Config) ValidateOnTui added in v0.2.0

func (c Config) ValidateOnTui() bool

ValidateOnTui validates configuration

type Container added in v0.1.4

type Container struct {
	ContainerID string
	Name        string
	Image       string
}

Container has Container information.

type Containers added in v0.3.0

type Containers struct {
	Type     string
	Includes []string
	Excludes []string
}

Containers has Containers information.

type Distro added in v0.1.6

type Distro struct {
	Family  string
	Release string
}

Distro has distribution info

func (Distro) MajorVersion added in v0.3.0

func (l Distro) MajorVersion() (ver int, err error)

MajorVersion returns Major version

func (Distro) String added in v0.1.6

func (l Distro) String() string

type JSONLoader

type JSONLoader struct {
}

JSONLoader loads configuration

func (JSONLoader) Load

func (c JSONLoader) Load(path, sudoPass, keyPass string) (err error)

Load load the configuraiton JSON file specified by path arg.

type Loader

type Loader interface {
	Load(string, string) error
}

Loader is interface of concrete loader

type SMTPConf added in v0.3.0

type SMTPConf struct {
	SMTPAddr string
	SMTPPort string `valid:"port"`

	User          string
	Password      string `json:"-"`
	From          string
	To            []string
	Cc            []string
	SubjectPrefix string

	UseThisTime bool
}

SMTPConf is smtp config

func (*SMTPConf) Validate added in v0.3.0

func (c *SMTPConf) Validate() (errs []error)

Validate SMTP configuration

type ServerInfo

type ServerInfo struct {
	ServerName  string
	User        string
	Host        string
	Port        string
	KeyPath     string
	KeyPassword string `json:"-"`

	CpeNames               []string
	DependencyCheckXMLPath string

	// Container Names or IDs
	Containers Containers

	IgnoreCves []string

	// Optional key-value set that will be outputted to JSON
	Optional [][]interface{}

	// For CentOS, RHEL, Amazon
	Enablerepo []string

	// used internal
	LogMsgAnsiColor string // DebugLog Color
	Container       Container
	Distro          Distro
}

ServerInfo has SSH Info, additional CPE packages to scan.

func (ServerInfo) GetServerName added in v0.1.7

func (s ServerInfo) GetServerName() string

GetServerName returns ServerName if this serverInfo is about host. If this serverInfo is abount a container, returns containerID@ServerName

func (ServerInfo) IsContainer added in v0.1.4

func (s ServerInfo) IsContainer() bool

IsContainer returns whether this ServerInfo is about container

func (*ServerInfo) SetContainer added in v0.1.4

func (s *ServerInfo) SetContainer(d Container)

SetContainer set container

type SlackConf

type SlackConf struct {
	HookURL   string `valid:"url" json:"-"`
	Channel   string `json:"channel"`
	IconEmoji string `json:"icon_emoji"`
	AuthUser  string `json:"username"`

	NotifyUsers []string
	Text        string `json:"text"`

	UseThisTime bool
}

SlackConf is slack config

func (*SlackConf) Validate

func (c *SlackConf) Validate() (errs []error)

Validate validates configuration

type TOMLLoader

type TOMLLoader struct {
}

TOMLLoader loads config

func (TOMLLoader) Load

func (c TOMLLoader) Load(pathToToml, keyPass string) error

Load load the configuraiton TOML file specified by path arg.

Jump to

Keyboard shortcuts

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