~/bend-docscommunity

eval.bend checks

raw source on the hub · import bend-osdev-apparmor@0.1.0.0/eval.bend as Eval

bend-osdev-apparmor: the access decision.

The rules of one kind that match a request each contribute a grant (perm.bend). Allow grants accumulate into the allowed set, deny grants into the denied set (rules accumulate as a union: apparmor.d(5), "order ... does not matter"); what is granted is allowed minus denied, so a deny rule always wins. A request is granted when every permission it asks for is. Then the profile mode decides (apparmor.d(5), "Profile Mode"; apparmor(7), "Complain mode"): enforce, prompt: granted -> allowed, else denied; kill: granted -> allowed, else denied and the task killed; complain: granted -> allowed, else allowed and logged, except that a request an explicit deny rule meets is denied (AaOptions.complain_deny); default_allow: allowed unless a deny rule meets the request; unconfined: allowed. Logging: an allowed request is audited when the profile has the audit flag or an audit rule grants a requested permission; a denial is logged unless every refused permission is quieted by a deny rule without audit.

12 imports
import Base
import ./perm.bend as P
import ./options.bend as O
import ./profile.bend as PR
import ./rule_file.bend as F
import ./rule_capability.bend as RC
import ./rule_network.bend as RN
import ./rule_signal.bend as RS
import ./rule_ptrace.bend as RP
import ./rule_mount.bend as RM
import ./rule_dbus.bend as RD
import ./rule_change_profile.bend as RX

Types

type AaDecision source · line 32 · raw

Data

type AaAcc source · line 72 · raw

Data

Definitions

def AaDecision.allowed source · line 44 · raw

@d:AaDecision -> Bool

def AaDecision.show source · line 57 · raw

@d:AaDecision -> String

def AaAcc.empty source · line 75 · raw

AaAcc

def AaAcc.join source · line 79 · raw

@a:AaAcc -> @b:AaAcc -> AaAcc

two accumulations together: each set the union

def AaAcc.single.go source · line 86 · raw

@audit:Bool -> @deny:Bool -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms -> AaAcc

what one grant contributes: allowed or denied; audited, or (for a denial without audit) quieted

def AaAcc.single source · line 101 · raw

@g:0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant -> AaAcc

def AaAcc.add source · line 106 · raw

@a:AaAcc -> @g:0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant -> AaAcc

def AaAcc.from source · line 109 · raw

@gs:List<&2, 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant> -> @a:AaAcc -> AaAcc

def AaAcc.of source · line 116 · raw

@gs:List<&2, 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant> -> AaAcc

def AaAcc.allow source · line 119 · raw

@a:AaAcc -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

def AaAcc.deny source · line 124 · raw

@a:AaAcc -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

def AaAcc.audit source · line 129 · raw

@a:AaAcc -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

def AaAcc.quiet source · line 134 · raw

@a:AaAcc -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

def AaAcc.granted source · line 140 · raw

@a:AaAcc -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

what the grants allow and do not deny

def AaEval.granted source · line 145 · raw

@gs:List<&2, 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant> -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

def AaEval.denied source · line 149 · raw

@gs:List<&2, 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant> -> 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms

what the grants deny

def AaEval.choose source · line 154 · raw

@c:Bool -> @a:AaDecision -> @b:AaDecision -> AaDecision

def AaEval.decide.mode source · line 163 · raw

@m:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaMode -> @cov:Bool -> @hit:Bool -> @cd:Bool -> @ok:AaDecision -> @no:AaDecision -> AaDecision

cov: the grants cover the request; hit: a deny rule meets it; cd: AaOptions.complain_deny; ok: the allowed outcome; no: the denied one

def AaEval.decide.acc source · line 178 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @flags:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaFlags -> @+req:0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms -> @a:AaAcc -> AaDecision

def AaEval.decide source · line 188 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @flags:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaFlags -> @+req:0x2b280a281d356b8e5cd7b338ab267df1/perm.AaPerms -> @gs:List<&2, 0x2b280a281d356b8e5cd7b338ab267df1/perm.AaGrant> -> AaDecision

the decision on a request for the permissions req, given the grants of the rules that match it, under a profile's flags

def AaEval.deny_applies source · line 193 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @m:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaMode -> Bool

whether a deny rule decides under these options and mode: every mode but unconfined, and complain only with complain_deny

def AaEval.file source · line 210 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_file.AaFileQuery -> AaDecision

def AaEval.capability source · line 215 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_capability.AaCapQuery -> AaDecision

def AaEval.network source · line 218 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_network.AaNetQuery -> AaDecision

def AaEval.signal source · line 221 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_signal.AaSignalQuery -> AaDecision

def AaEval.ptrace source · line 224 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_ptrace.AaPtraceQuery -> AaDecision

def AaEval.mount source · line 227 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_mount.AaMountQuery -> AaDecision

def AaEval.dbus source · line 230 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_dbus.AaDbusQuery -> AaDecision

def AaEval.change_profile source · line 233 · raw

@opts:0x2b280a281d356b8e5cd7b338ab267df1/options.AaOptions -> @+p:0x2b280a281d356b8e5cd7b338ab267df1/profile.AaProfile -> @+q:0x2b280a281d356b8e5cd7b338ab267df1/rule_change_profile.AaChangeQuery -> AaDecision