Skip to content

osal.ufw #

UFW OSAL

see crystallib/examples/osal/ufw.vsh for example.

fn allow_ssh #

fn allow_ssh() !

fn apply #

fn apply(ruleset RuleSet) !

fn apply_rule #

fn apply_rule(rule_ Rule) !

ufw allow proto tcp to any port 80

fn disable #

fn disable() !

fn enable #

fn enable() !

fn new #

fn new() RuleSet

fn play_ufw #

fn play_ufw(mut plbook playbook.PlayBook) !RuleSet

fn reset #

fn reset() !

fn ufw_status #

fn ufw_status() !UFWStatus

struct Rule #

struct Rule {
pub mut:
	ipv6  bool
	port  int
	from  string = 'any'
	tcp   bool
	udp   bool
	allow bool // if not then is denied
}

struct RuleArgs #

@[params]
struct RuleArgs {
pub mut:
	ipv6 bool
	port int
	from string = 'any'
	tcp  bool   = true
	udp  bool
}

struct RuleSet #

@[heap]
struct RuleSet {
pub mut:
	rules []Rule
	ssh   bool = true // leave this on, its your backdoor to get in the system
	reset bool = true
}

fn (RuleSet) allow #

fn (mut rs RuleSet) allow(args RuleArgs)

Allow incoming traffic to a specific port or service

fn (RuleSet) deny #

fn (mut rs RuleSet) deny(args RuleArgs)

Deny incoming traffic to a specific port or service

struct UFWStatus #

struct UFWStatus {
pub mut:
	active bool
	rules  []Rule
}