network

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Inbound  = true
	Outbound = false
)

Packer Directions

View Source
const (
	IncomingHost     = "IH"
	IncomingLAN      = "IL"
	IncomingInternet = "II"
	IncomingInvalid  = "IX"
	PeerHost         = "PH"
	PeerLAN          = "PL"
	PeerInternet     = "PI"
	PeerInvalid      = "PX"
)

Non-Domain Connections

View Source
const (
	ReasonUnknownProcess = "unknown connection owner: process could not be found"
)

Static reasons

Variables

This section is empty.

Functions

This section is empty.

Types

type Communication added in v0.2.2

type Communication struct {
	record.Base
	sync.Mutex

	Domain    string
	Direction bool
	Intel     *intel.Intel

	Verdict Verdict
	Reason  string
	Inspect bool

	FirstLinkEstablished int64
	LastLinkEstablished  int64
	LinkCount            uint
	// contains filtered or unexported fields
}

Communication describes a logical connection between a process and a domain.

func GetCommunication added in v0.2.2

func GetCommunication(pid int, domain string) (comm *Communication, ok bool)

GetCommunication fetches a connection object from the internal storage.

func GetCommunicationByDNSRequest added in v0.2.2

func GetCommunicationByDNSRequest(ip net.IP, port uint16, fqdn string) (*Communication, error)

GetCommunicationByDNSRequest returns the matching communication from the internal storage.

func GetCommunicationByFirstPacket added in v0.2.2

func GetCommunicationByFirstPacket(pkt packet.Packet) (*Communication, error)

GetCommunicationByFirstPacket returns the matching communication from the internal storage.

func GetUnknownCommunication added in v0.2.2

func GetUnknownCommunication(pkt packet.Packet) (*Communication, error)

GetUnknownCommunication returns the connection to a packet of unknown owner.

func (*Communication) Accept added in v0.2.2

func (comm *Communication) Accept(reason string)

Accept accepts the communication and adds the given reason.

func (comm *Communication) AddLink(link *Link)

AddLink applies the Communication to the Link and increases sets counter and timestamps.

func (*Communication) AddReason added in v0.2.2

func (comm *Communication) AddReason(reason string)

AddReason adds a human readable string as to why a certain verdict was set in regard to this communication.

func (*Communication) Block added in v0.2.2

func (comm *Communication) Block(reason string)

Block blocks the communication and adds the given reason.

func (*Communication) Delete added in v0.2.2

func (comm *Communication) Delete()

Delete deletes a connection from the storage and propagates the change.

func (*Communication) Deny added in v0.2.2

func (comm *Communication) Deny(reason string)

Deny blocks or drops the communication depending on the connection direction and adds the given reason.

func (*Communication) Drop added in v0.2.2

func (comm *Communication) Drop(reason string)

Drop drops the communication and adds the given reason.

func (*Communication) GetVerdict added in v0.2.2

func (comm *Communication) GetVerdict() Verdict

GetVerdict returns the current verdict.

func (*Communication) NeedsReevaluation added in v0.2.2

func (comm *Communication) NeedsReevaluation() bool

NeedsReevaluation returns whether the decision on this communication should be re-evaluated.

func (*Communication) Process added in v0.2.2

func (comm *Communication) Process() *process.Process

Process returns the process that owns the connection.

func (comm *Communication) RemoveLink()

RemoveLink lowers the link counter by one.

func (*Communication) ResetVerdict added in v0.2.2

func (comm *Communication) ResetVerdict()

ResetVerdict resets the verdict to VerdictUndecided.

func (*Communication) Save added in v0.2.2

func (comm *Communication) Save() error

Save saves the connection object in the storage and propagates the change.

func (*Communication) String added in v0.2.2

func (comm *Communication) String() string

String returns a string representation of Communication.

func (*Communication) UpdateVerdict added in v0.2.2

func (comm *Communication) UpdateVerdict(newVerdict Verdict)

UpdateVerdict sets a new verdict for this link, making sure it does not interfere with previous verdicts.

type FirewallHandler

type FirewallHandler func(pkt packet.Packet, link *Link)

FirewallHandler defines the function signature for a firewall handle function

type Link struct {
	record.Base
	sync.Mutex

	ID string

	Verdict          Verdict
	Reason           string
	Tunneled         bool
	VerdictPermanent bool
	Inspect          bool
	Started          int64
	Ended            int64
	RemoteAddress    string
	// contains filtered or unexported fields
}

Link describes a distinct physical connection (e.g. TCP connection) - like an instance - of a Connection.

func CreateLinkFromPacket

func CreateLinkFromPacket(pkt packet.Packet) *Link

CreateLinkFromPacket creates a new Link based on Packet.

func GetLink(id string) (*Link, bool)

GetLink fetches a Link from the database from the default namespace for this object

func GetOrCreateLinkByPacket

func GetOrCreateLinkByPacket(pkt packet.Packet) (*Link, bool)

GetOrCreateLinkByPacket returns the associated Link for a packet and a bool expressing if the Link was newly created

func (*Link) Accept

func (link *Link) Accept(reason string)

Accept accepts the link and adds the given reason.

func (*Link) AddReason

func (link *Link) AddReason(reason string)

AddReason adds a human readable string as to why a certain verdict was set in regard to this link

func (*Link) ApplyVerdict

func (link *Link) ApplyVerdict(pkt packet.Packet)

ApplyVerdict appies the link verdict to a packet.

func (*Link) Block

func (link *Link) Block(reason string)

Block blocks the link and adds the given reason.

func (*Link) Communication added in v0.2.2

func (link *Link) Communication() *Communication

Communication returns the Communication the Link is part of

func (*Link) Delete

func (link *Link) Delete()

Delete deletes a link from the storage and propagates the change.

func (*Link) Deny

func (link *Link) Deny(reason string)

Deny blocks or drops the link depending on the connection direction and adds the given reason.

func (*Link) Drop

func (link *Link) Drop(reason string)

Drop drops the link and adds the given reason.

func (*Link) FirewallHandlerIsSet

func (link *Link) FirewallHandlerIsSet() bool

FirewallHandlerIsSet returns whether a firewall handler is set or not

func (*Link) GetActiveInspectors

func (link *Link) GetActiveInspectors() []bool

GetActiveInspectors returns the list of active inspectors.

func (*Link) GetInspectorData

func (link *Link) GetInspectorData() map[uint8]interface{}

GetInspectorData returns the list of inspector data.

func (*Link) GetVerdict

func (link *Link) GetVerdict() Verdict

GetVerdict returns the current verdict.

func (*Link) HandlePacket

func (link *Link) HandlePacket(pkt packet.Packet)

HandlePacket queues packet of Link for handling

func (*Link) RerouteToNameserver

func (link *Link) RerouteToNameserver()

RerouteToNameserver reroutes the link to the portmaster nameserver.

func (*Link) RerouteToTunnel

func (link *Link) RerouteToTunnel(reason string)

RerouteToTunnel reroutes the link to the tunnel entrypoint and adds the given reason for accepting the connection.

func (*Link) Save

func (link *Link) Save() error

Save saves the link object in the storage and propagates the change.

func (*Link) SetActiveInspectors

func (link *Link) SetActiveInspectors(new []bool)

SetActiveInspectors sets the list of active inspectors.

func (*Link) SetFirewallHandler

func (link *Link) SetFirewallHandler(handler FirewallHandler)

SetFirewallHandler sets the firewall handler for this link

func (*Link) SetInspectorData

func (link *Link) SetInspectorData(new map[uint8]interface{})

SetInspectorData set the list of inspector data.

func (*Link) StopFirewallHandler

func (link *Link) StopFirewallHandler()

StopFirewallHandler unsets the firewall handler

func (*Link) String

func (link *Link) String() string

String returns a string representation of Link.

func (*Link) UpdateVerdict

func (link *Link) UpdateVerdict(newVerdict Verdict)

UpdateVerdict sets a new verdict for this link, making sure it does not interfere with previous verdicts

type StorageInterface

type StorageInterface struct {
	storage.InjectBase
}

StorageInterface provices a storage.Interface to the configuration manager.

func (*StorageInterface) Get

func (s *StorageInterface) Get(key string) (record.Record, error)

Get returns a database record.

func (*StorageInterface) Query

func (s *StorageInterface) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error)

Query returns a an iterator for the supplied query.

type Verdict

type Verdict uint8

Verdict describes the decision made about a connection or link.

const (
	// UNDECIDED is the default status of new connections
	VerdictUndecided           Verdict = 0
	VerdictUndeterminable      Verdict = 1
	VerdictAccept              Verdict = 2
	VerdictBlock               Verdict = 3
	VerdictDrop                Verdict = 4
	VerdictRerouteToNameserver Verdict = 5
	VerdictRerouteToTunnel     Verdict = 6
)

List of values a Status can have

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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