gateway

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Namespace         string `env:"NAMESPACE,required"`
	ExternalInterface string `env:"EXTERNAL_INTERFACE"  envDefault:"eth0"`
	InetBaseNetwork   string `env:"INET_BASE_NETWORK,required"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type IPTablesManager

type IPTablesManager struct {

	// IPv6Filtered is true when the egress filter was installed for IPv6 as well; false means the pod has no ip6tables
	// and forwards no IPv6 (the caller logs it).
	IPv6Filtered bool
	// contains filtered or unexported fields
}

func NewIPTablesManager

func NewIPTablesManager(extIface string) (*IPTablesManager, error)

func (*IPTablesManager) AddAntiSpoof

func (m *IPTablesManager) AddAntiSpoof(iface, labCIDR string) error

AddAntiSpoof makes the gateway drop what a lab sends with a source outside the lab's own subnet, so lab A cannot send a packet that looks like lab B's and have the reply sent back into lab B. The rule sits in LABSRC, which FORWARD consults before it accepts anything.

func (*IPTablesManager) AddMasquerade

func (m *IPTablesManager) AddMasquerade(labCIDR string) error

func (*IPTablesManager) AllowDHCP

func (m *IPTablesManager) AllowDHCP(iface string) error

AllowDHCP opens DHCP on one lab interface (the pod runs a DHCP server there); DenyDHCP closes it.

func (*IPTablesManager) AllowPing

func (m *IPTablesManager) AllowPing(iface, addr string) error

AllowPing lets the devices of a lab ping the pod's own address on that lab's interface (and no other address of the pod); DenyPing takes it away with the interface.

func (*IPTablesManager) BlockLab added in v1.1.0

func (m *IPTablesManager) BlockLab(iface string) error

BlockLab closes the physical leg before removing any old source guard. It stays closed through configuration failures; UnblockLab follows secured NAT.

func (*IPTablesManager) DelAntiSpoof

func (m *IPTablesManager) DelAntiSpoof(iface, labCIDR string)

func (*IPTablesManager) DelMasquerade

func (m *IPTablesManager) DelMasquerade(labCIDR string)

func (*IPTablesManager) DenyDHCP

func (m *IPTablesManager) DenyDHCP(iface string)

func (*IPTablesManager) DenyPing

func (m *IPTablesManager) DenyPing(iface, addr string)

func (*IPTablesManager) RemoveInput

func (m *IPTablesManager) RemoveInput()

RemoveInput takes the INPUT policy off (the pod is stopping).

func (*IPTablesManager) SetupFilter

func (m *IPTablesManager) SetupFilter() error

SetupFilter installs the whole forwarding filter, in the order that is never open: the policy is DROP, the egress filter and the anti-spoof chain come first in FORWARD, and only then the rules that accept lab traffic towards the outside. It is safe to run again in a pod whose network namespace outlives the process (a container restart): the old filter keeps working until the new one is in place, and the rule of earlier versions that accepted everything leaving is removed.

func (*IPTablesManager) UnblockLab added in v1.1.0

func (m *IPTablesManager) UnblockLab(iface string) error

type LabGatewayReconciler

type LabGatewayReconciler struct {
	client.Client
	DHCP     *dhcp.Manager
	IPT      *IPTablesManager
	Cfg      *Config
	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

func (*LabGatewayReconciler) Reconcile

func (r *LabGatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*LabGatewayReconciler) SetupWithManager

func (r *LabGatewayReconciler) SetupWithManager(mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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