araalictl

package
v0.0.0-...-4fecb06 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ONE_DAY = 24 * 60 * time.Minute

Constants

Variables

View Source
var ActlPath = "/opt/araali/bin/araalictl"

Araalictl path

View Source
var CommandDebug = false

CommandDebug - logs every command that is executed

Functions

func Authorize

func Authorize(emailid, token string, asRoot bool) (string, error)

Authorize araalictl

func DeAuthorize

func DeAuthorize(asRoot bool) (string, error)

DeAuthorize araalictl

func FileExists

func FileExists(filename string) bool

FileExists - check if file exists

func FortifyK8sCluster

func FortifyK8sCluster(tenant, clusterName string, force bool) (string, error)

FortifyK8sCluster - for tenant

func RunAs

func RunAs(cmdstr, user string, pipeInput string) (string, error)

RunAs - Run cmdstr as user

func RunCmd

func RunCmd(cmdstr string) (string, error)

RunCmd - Run cmdstr and collect/return output

func RunCmdWithInput

func RunCmdWithInput(cmdstr string, pipeInput string) (string, error)

func RunControl

func RunControl(cmdArgs []string, user string, exitOnFailure bool, pipeInput string) (string, error)

RunControl takes a command and runs it, control is for whether to exit

func RunControlOut

func RunControlOut(cmdArgs []string, user string, exitOnFailure bool, out *bytes.Buffer, in *bytes.Buffer) error

RunControlOut takes a command and runs it, control is for whether to exit, allows output to go to stdout

func RunStrControl

func RunStrControl(cmdstr, user string, exitOnFailure bool, pipeInput string) (string, error)

RunStrControl takes a command string and runs it, control is for whether to exit

func SetAraalictlPath

func SetAraalictlPath(newPath string)

Reset araalictl path to new value

func TenantAddUser

func TenantAddUser(tenantID, userEmail, userName string) (string, error)

TenantAddUser - to add a user to a tenant

func TenantCreate

func TenantCreate(userEmail, tenantName, UserName string) (string, error)

TenantCreate - to create a tenant

func TenantDelete

func TenantDelete(tenantID string) (string, error)

TenantDelete - to delete a tenant

func TenantDeleteUser

func TenantDeleteUser(tenantID, userEmail, userName string) (string, error)

TenantDeleteUser - to delete a user from a tenant

func UpdateLinks(zone, app, tenant string, links []Link) (string, error)

UpdateLinks - update links for an app

Types

type AlertCard

type AlertCard struct {
	TotalAlerts  uint64 `yaml:"alert_summary"`
	AlertDetails []Zone `yaml:"alert_details,omitempty"`
}

func GetAlertCard

func GetAlertCard(tenant string) (AlertCard, error)

GetAlertCard - get AlertCard for tenant.

type AlertInfo

type AlertInfo struct {
	CommunicationAlertType string `yaml:"communication_alert_type,omitempty"`
	ProcessAlertType       string `yaml:"process_alert_type,omitempty"`
	ReOpenCount            uint32 `yaml:"reopen_count,omitempty"`
	Status                 string `yaml:"status,omitempty"`
}

AlertInfo object

type AlertPage

type AlertPage struct {
	PagingToken string
	Alerts      []Link
	// contains filtered or unexported fields
}

AlertPage

func GetAlerts

func GetAlerts(tenant string, startTime, endTime int64, count int32, fetchAll bool) (AlertPage, error)

GetAlerts - get all alerts for a tenant between specified time. tenant: this is optional can be set to emtpy. startTime: is optional, should be epoch expressed in seconds. If 0 will be set to currentTime - 1 day. endTime: is optional, should be epoch expressed in seconds. If 0 will be set to currentTime. count: is optional, should be number of alerts we want to fetch at a time. If 0 will be defaulted 100. Sample usage: startTime := time.Now().Add(-(3 * araalictl.ONE_DAY)).Unix() alertPage := araalictl.GetAlerts("", startTime, 0, 25) fmt.Printf("Fetched %d alerts.\n", len(alertPage.Alerts))

for {
	if !alertPage.HasNext() {
		fmt.Println("Done fetching!")
		break
	}
	alertPage.NextPage()
	fmt.Printf("Fetched %d alerts.\n", len(alertPage.Alerts))
}

func (*AlertPage) HasNext

func (alertPage *AlertPage) HasNext() bool

func (*AlertPage) NextPage

func (alertPage *AlertPage) NextPage() ([]Link, error)

type App

type App struct {
	ZoneName      string
	AppName       string          `yaml:"app_name"`
	Links         []Link          `yaml:"links,omitempty"`
	DefinedCounts DirectionCounts `yaml:"defined_policies,omitempty"`
	DeniedCounts  DirectionCounts `yaml:"denied_policies,omitempty"`
	AlertCounts   DirectionCounts `yaml:"alerts,omitempty"`
	ServiceCounts DirectionCounts `yaml:"services,omitempty"`
	ComputeCounts ComputeCount    `yaml:"compute,omitempty"`
	AraaliUrl     string          `yaml:"araali_url,omitempty"`
}

func (*App) Commit

func (app *App) Commit() (string, error)

func (*App) Refresh

func (app *App) Refresh() error

type Compute

type Compute struct {
	Name                string          `yaml:"name"`
	IpAddress           string          `yaml:"ip_address"`
	Uuid                string          `yaml:"uuid"`
	Image               string          `yaml:"image"`
	Zone                string          `yaml:"zone"`
	Apps                []App           `yaml:"apps"`
	Processes           []string        `yaml:"processes"`
	State               string          `yaml:"state"`
	AssetType           string          `yaml:"asset_type"`
	ProcessCapabilities []string        `yaml:"process_capabilities"`
	IpAddresses         []string        `yaml:"ip_addresses"`
	OriginalUuid        string          `yaml:"original_uuid`
	Vulnerabilities     []Vulnerability `yaml:"vulnerabilities"`
	Mode                string          `yaml:"mode"`
	OsName              string          `yaml:"os_name"`
}

func GetCompute

func GetCompute(zone, app, tenant string) ([]Compute, error)

GetCompute - return VMs and containers for given zone/app with vulnerability info

type ComputeCount

type ComputeCount struct {
	VirtualMachines uint32 `yaml:"virtual_machines,omitempty"`
	Containers      uint32 `yaml:"containers,omitempty"`
}

type DirectionCounts

type DirectionCounts struct {
	Total            uint64 `yaml:"total,omitempty"`
	Ingress          uint64 `yaml:"ingress,omitempty"`
	PerimeterIngress uint64 `yaml:"perimeter_ingress,omitempty"`
	Internal         uint64 `yaml:"internal,omitempty"`
	Egress           uint64 `yaml:"egress,omitempty"`
	PerimeterEgress  uint64 `yaml:"perimeter_egress,omitempty"`
}

type EndPoint

type EndPoint struct {
	Zone string `yaml:"zone,omitempty"`
	App  string `yaml:"app,omitempty"`

	Process       string `yaml:"process,omitempty"`
	BinaryName    string `yaml:"binary_name,omitempty"`
	ParentProcess string `yaml:"parent_process,omitempty"`
	DnsPattern    string `yaml:"dns_pattern,omitempty"`
	Subnet        string `yaml:"subnet,omitempty"`
	NetMask       uint32 `yaml:"netmask,omitempty"`
	DstPort       uint32 `yaml:"dst_port,omitempty"`

	OrigZone          string `yaml:"orig_zone,omitempty"`
	OrigApp           string `yaml:"orig_app,omitempty"`
	OrigProcess       string `yaml:"orig_process,omitempty"`
	OrigBinaryName    string `yaml:"orig_binary_name,omitempty"`
	OrigParentProcess string `yaml:"orig_parent_process,omitempty"`
	OrigDnsPattern    string `yaml:"orig_dns_pattern,omitempty"`
	OrigSubnet        string `yaml:"orig_subnet,omitempty"`
	OrigNetMask       uint32 `yaml:"orig_netmask,omitempty"`
	OrigDstPort       uint32 `yaml:"orig_dst_port,omitempty"`
	// contains filtered or unexported fields
}

Endpoint Object

type FortifyHelmValues

type FortifyHelmValues struct {
	WorkloadId   string `yaml:"workload_id"`
	ClusterName  string `yaml:"cluster_name"`
	Fog          string `yaml:"fog"`
	Zone         string `yaml:"zone"`
	App          string `yaml:"app"`
	Enforce      bool   `yaml:"enforce"`
	Upgrade      bool   `yaml:"upgrade"`
	AutoK8SImage string `yaml:"autok8s_image"`
	FwImage      string `yaml:"fw_image"`
	FwInitImage  string `yaml:"fw_init_image"`
}

FortifyHelmValues

func FortifyK8SGenerateHelm

func FortifyK8SGenerateHelm(tenantID, clusterName string) (*FortifyHelmValues, error)

FortifyK8SGenerateHelm - Generates values.yaml for araali fortification helm chart

type Insight

type Insight struct {
	InsightType string `yaml:"insighttype"`
	Url         string `yaml:"url,omitempty"`
	Count       int    `yaml:"count"`
}

InsightCounts

func GetInsights

func GetInsights(tenantID string) ([]Insight, error)
type Link struct {
	Client      EndPoint
	Server      EndPoint
	Type        string
	Speculative bool
	State       string
	Timestamp   uint64
	UniqueId    string    `yaml:"unique_id"`
	NewState    string    `yaml:"new_state,omitempty"`
	PagingToken string    `yaml:"paging_token,omitempty"`
	AlertInfo   AlertInfo `yaml:"alert_info,omitempty"`
}

Link Object

func GetLinks(zone, app, tenant string) ([]Link, error)

GetLinks - get links for zone, app for tenant

func (*Link) Accept

func (link *Link) Accept()

func (*Link) Deny

func (link *Link) Deny()

func (*Link) Snooze

func (link *Link) Snooze()

type Vulnerability

type Vulnerability struct {
	PackageName string   `yaml:"package_name"`
	CveId       []string `yaml:"cve_id"`
	Severity    string   `yaml:"severity"`
}

type Zone

type Zone struct {
	ZoneName string `yaml:"zone_name"`
	Apps     []App
}

func GetZones

func GetZones(full bool, tenant string) ([]Zone, error)

GetZones - return zones and apps, use tenant="" by default

Jump to

Keyboard shortcuts

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