pub struct AccessSecurityConfig {
pub uag: HashMap<String, Vec<String>>,
pub hag: HashMap<String, Vec<String>>,
pub hag_raw: HashMap<String, Vec<String>>,
pub asg: HashMap<String, AccessSecurityGroup>,
pub unknown_access: AccessLevel,
}Expand description
Access Security Configuration parsed from an ACF file.
Fields§
§uag: HashMap<String, Vec<String>>§hag: HashMap<String, Vec<String>>§hag_raw: HashMap<String, Vec<String>>The HAG members exactly as spelled in the ACF, keyed like hag.
hag stores hag_members resolution output (dotted quads
under asCheckClientIP), which cannot be re-resolved after a
DNS change; Self::with_refreshed_hags re-runs the resolution
from these raw spellings (epics-base#863 / UI-107).
asg: HashMap<String, AccessSecurityGroup>§unknown_access: AccessLevelImplementations§
Source§impl AccessSecurityConfig
impl AccessSecurityConfig
Sourcepub fn with_refreshed_hags(&self) -> Option<Self>
pub fn with_refreshed_hags(&self) -> Option<Self>
Re-run hag_members — the single resolution owner — over the
raw HAG spellings and return the refreshed config when any
stored member changed, None when resolution is unchanged.
Only meaningful under asCheckClientIP (the default string
mode stores lowercased literals that no DNS change can move);
callers gate on as_check_client_ip before paying for
resolution. C freezes HAG IPs at ACF load until a manual
asInit (epics-base#863; its PR #862 moves upstream toward
refresh) — this is the sibling of the CA-side refresh_dns
deviation that closed the client half of that issue.
Sourcepub fn dump_report(&self) -> String
pub fn dump_report(&self) -> String
Render the parsed ACF (UAG/HAG/ASG with their INP* links and
RULEs) in C asDumpFP shape, as a String.
This is the single owner of the dump format: the asdbdump iocsh
command and the CA gateway’s R3 access-security report both render
through here, so the two cannot drift. UAG, HAG, and ASG names are
emitted in sorted order so the dump is stable across HashMap
iteration order.
The verbose member/client listing of C’s
asDumpFP(fp, NULL, NULL, verbose=TRUE) is intentionally not
included: this crate models no live AS-member/client registry (see
the aspmem iocsh command, which derives membership by scanning
records rather than from an asgMemberList). The dump therefore
covers the parsed configuration structures only.
Sourcepub fn fmt_asg(&self, name: &str, out: &mut String)
pub fn fmt_asg(&self, name: &str, out: &mut String)
Append one ASG’s INP* links and RULEs to out, in C asDumpFP
shape. Shared by Self::dump_report and the asprules iocsh
command’s per-ASG renderer so the rule format has one owner.
Sourcepub fn check_access(
&self,
asg_name: &str,
host: &str,
user: &str,
) -> AccessLevel
pub fn check_access( &self, asg_name: &str, host: &str, user: &str, ) -> AccessLevel
Check access for a given ASG, hostname, and username.
Convenience that omits the ASL gate (treats every rule as
applicable). Equivalent to check_access_asl(..., 0) with
rules typically declared at level 0/1. New code should call
Self::check_access_asl so a per-record ASL can correctly
disable a rule whose level is below the record’s ASL.
Sourcepub fn check_access_method(
&self,
asg_name: &str,
host: &str,
user: &str,
record_asl: u8,
method: &str,
authority: &str,
) -> AccessLevel
pub fn check_access_method( &self, asg_name: &str, host: &str, user: &str, record_asl: u8, method: &str, authority: &str, ) -> AccessLevel
Method/authority-aware access check. Mirrors epics-base PR
#563 (METHOD/AUTHORITY) and PR #618 (cert-based ACF). When
method and authority are provided, rules with non-empty
method/authority lists are gated on a literal match.
Rules with empty method/authority ignore those scopes
(legacy behaviour preserved).
Sourcepub fn compute_for_name(
&self,
asg_name: &str,
host: &str,
user: &str,
roles: &[String],
record_asl: u8,
method: &str,
authority: &str,
inputs: Option<&AsgInputs>,
) -> (AccessLevel, bool)
pub fn compute_for_name( &self, asg_name: &str, host: &str, user: &str, roles: &[String], record_asl: u8, method: &str, authority: &str, inputs: Option<&AsgInputs>, ) -> (AccessLevel, bool)
Method/authority-aware access check that also returns the write-trap mask of the rule that resolved the access level.
Mirrors C asComputePvt (asLibRoutines.c:983-1048): the
function tracks trapMask alongside access, and on every
rule that raises the access level it copies that rule’s
trapMask (asLibRoutines.c:1041-1042). The final
pasgclient->trapMask (:1048) is therefore the trap flag of
the last rule that set the granted access — exactly the value
asTrapWriteWithData (rsrv/camessage.c:799-802) consults to
decide whether to invoke put-logging listeners.
Returns (level, rule_was_trap). rule_was_trap is false
when access stays NoAccess (no rule matched), when the
matching rule carried NOTRAPWRITE, and when it carried no
trap option at all.
Resolve asg_name (falling back to DEFAULT) and evaluate its
rules with the given roles and the ASG’s resolved INP* values.
The single entry every CALC-aware caller uses — the CA server and
AccessGate::check_with_roles alike.
pub fn check_access_method_trap( &self, asg_name: &str, host: &str, user: &str, record_asl: u8, method: &str, authority: &str, ) -> (AccessLevel, bool)
Sourcepub fn resolve_asg_inputs(
&self,
asg_name: &str,
resolve: &dyn Fn(&str) -> Option<f64>,
) -> AsgInputs
pub fn resolve_asg_inputs( &self, asg_name: &str, resolve: &dyn Fn(&str) -> Option<f64>, ) -> AsgInputs
Walk asg_name’s declared INP(A..U) links (falling back to
DEFAULT, as every other lookup here does) and resolve each with
resolve, returning C’s per-ASG input state. This is asCa.c’s job
done on demand: the port has no standing CA monitor per link, so the
values are read when the rules are evaluated.
An unknown ASG with no DEFAULT yields empty inputs — no links, so no
bad bits, and a CALC rule then evaluates against zeros exactly as C
does for an ASG that declares none.
Sourcepub fn inp_link_targets(&self) -> Vec<(String, String)>
pub fn inp_link_targets(&self) -> Vec<(String, String)>
Every distinct (record, field) an INP* link in this policy names,
across all ASGs — the set a re-evaluation trigger must watch. C builds
the same set one CA channel at a time in asCaStart.
Sourcepub fn check_access_asl(
&self,
asg_name: &str,
host: &str,
user: &str,
record_asl: u8,
) -> AccessLevel
pub fn check_access_asl( &self, asg_name: &str, host: &str, user: &str, record_asl: u8, ) -> AccessLevel
Check access taking the per-record ASL into account.
Per epics-base asLibRoutines.c::asCompute: a rule with
RULE(N, …) only applies when the record’s ASL ≤ N. The
canonical example is RULE(0, READ) RULE(1, WRITE) — every
record is readable, but only records with ASL ≥ 1 are
writable. Without this gate, a low-ASL record’s protection
is silently equivalent to ASL 0.
Trait Implementations§
Source§impl Clone for AccessSecurityConfig
impl Clone for AccessSecurityConfig
Source§fn clone(&self) -> AccessSecurityConfig
fn clone(&self) -> AccessSecurityConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more