Documentation ¶
Index ¶
- Constants
- type Connection
- func (conn *Connection) Accept(reason string)
- func (conn *Connection) AddLink(link *Link)
- func (conn *Connection) AddReason(reason string)
- func (conn *Connection) Block(reason string)
- func (conn *Connection) Delete()
- func (conn *Connection) Deny(reason string)
- func (conn *Connection) Drop(reason string)
- func (conn *Connection) GetVerdict() Verdict
- func (conn *Connection) Process() *process.Process
- func (conn *Connection) RemoveLink()
- func (conn *Connection) Save() error
- func (conn *Connection) String() string
- func (conn *Connection) UpdateVerdict(newVerdict Verdict)
- type FirewallHandler
- type Link
- func (link *Link) Accept(reason string)
- func (link *Link) AddReason(reason string)
- func (link *Link) ApplyVerdict(pkt packet.Packet)
- func (link *Link) Block(reason string)
- func (link *Link) Connection() *Connection
- func (link *Link) Delete()
- func (link *Link) Deny(reason string)
- func (link *Link) Drop(reason string)
- func (link *Link) FirewallHandlerIsSet() bool
- func (link *Link) GetActiveInspectors() []bool
- func (link *Link) GetInspectorData() map[uint8]interface{}
- func (link *Link) GetVerdict() Verdict
- func (link *Link) HandlePacket(pkt packet.Packet)
- func (link *Link) RerouteToNameserver()
- func (link *Link) RerouteToTunnel(reason string)
- func (link *Link) Save() error
- func (link *Link) SetActiveInspectors(new []bool)
- func (link *Link) SetFirewallHandler(handler FirewallHandler)
- func (link *Link) SetInspectorData(new map[uint8]interface{})
- func (link *Link) StopFirewallHandler()
- func (link *Link) String() string
- func (link *Link) UpdateVerdict(newVerdict Verdict)
- type StorageInterface
- type Verdict
Constants ¶
const ( Inbound = true Outbound = false )
Packer Directions
const ( IncomingHost = "IH" IncomingLAN = "IL" IncomingInternet = "II" IncomingInvalid = "IX" PeerHost = "PH" PeerLAN = "PL" PeerInternet = "PI" PeerInvalid = "PX" )
Non-Domain Connections
const (
ReasonUnknownProcess = "unknown connection owner: process could not be found"
)
Static reasons
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection 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 }
Connection describes a connection between a process and a domain
func GetConnection ¶
func GetConnection(pid int, domain string) (conn *Connection, ok bool)
GetConnection fetches a connection object from the internal storage.
func GetConnectionByDNSRequest ¶
GetConnectionByDNSRequest returns the matching connection from the internal storage.
func GetConnectionByFirstPacket ¶
func GetConnectionByFirstPacket(pkt packet.Packet) (*Connection, error)
GetConnectionByFirstPacket returns the matching connection from the internal storage.
func GetUnknownConnection ¶
func GetUnknownConnection(pkt packet.Packet) (*Connection, error)
GetUnknownConnection returns the connection to a packet of unknown owner.
func (*Connection) Accept ¶
func (conn *Connection) Accept(reason string)
Accept accepts the connection and adds the given reason.
func (*Connection) AddLink ¶
func (conn *Connection) AddLink(link *Link)
AddLink applies the connection to the link and increases sets counter and timestamps.
func (*Connection) AddReason ¶
func (conn *Connection) AddReason(reason string)
AddReason adds a human readable string as to why a certain verdict was set in regard to this connection
func (*Connection) Block ¶
func (conn *Connection) Block(reason string)
Block blocks the connection and adds the given reason.
func (*Connection) Delete ¶
func (conn *Connection) Delete()
Delete deletes a connection from the storage and propagates the change.
func (*Connection) Deny ¶
func (conn *Connection) Deny(reason string)
Deny blocks or drops the connection depending on the connection direction and adds the given reason.
func (*Connection) Drop ¶
func (conn *Connection) Drop(reason string)
Drop drops the connection and adds the given reason.
func (*Connection) GetVerdict ¶
func (conn *Connection) GetVerdict() Verdict
GetVerdict returns the current verdict.
func (*Connection) Process ¶
func (conn *Connection) Process() *process.Process
Process returns the process that owns the connection.
func (*Connection) RemoveLink ¶
func (conn *Connection) RemoveLink()
RemoveLink lowers the link counter by one.
func (*Connection) Save ¶
func (conn *Connection) Save() error
Save saves the connection object in the storage and propagates the change.
func (*Connection) String ¶
func (conn *Connection) String() string
String returns a string representation of Connection.
func (*Connection) UpdateVerdict ¶
func (conn *Connection) UpdateVerdict(newVerdict Verdict)
UpdateVerdict sets a new verdict for this link, making sure it does not interfere with previous verdicts
type FirewallHandler ¶
FirewallHandler defines the function signature for a firewall handle function
type Link ¶
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 ¶
CreateLinkFromPacket creates a new Link based on Packet.
func GetOrCreateLinkByPacket ¶
GetOrCreateLinkByPacket returns the associated Link for a packet and a bool expressing if the Link was newly created
func (*Link) AddReason ¶
AddReason adds a human readable string as to why a certain verdict was set in regard to this link
func (*Link) ApplyVerdict ¶
ApplyVerdict appies the link verdict to a packet.
func (*Link) Connection ¶
func (link *Link) Connection() *Connection
Connection returns the Connection 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 ¶
Deny blocks or drops the link depending on the connection direction and adds the given reason.
func (*Link) FirewallHandlerIsSet ¶
FirewallHandlerIsSet returns whether a firewall handler is set or not
func (*Link) GetActiveInspectors ¶
GetActiveInspectors returns the list of active inspectors.
func (*Link) GetInspectorData ¶
GetInspectorData returns the list of inspector data.
func (*Link) GetVerdict ¶
GetVerdict returns the current verdict.
func (*Link) HandlePacket ¶
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 ¶
RerouteToTunnel reroutes the link to the tunnel entrypoint and adds the given reason for accepting the connection.
func (*Link) SetActiveInspectors ¶
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 ¶
SetInspectorData set the list of inspector data.
func (*Link) StopFirewallHandler ¶
func (link *Link) StopFirewallHandler()
StopFirewallHandler unsets the firewall handler
func (*Link) UpdateVerdict ¶
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.