Last active 1 month ago

nuno revised this gist 1 month ago. Go to revision

1 file changed, 48 insertions

gistfile1.txt(file created)

@@ -0,0 +1,48 @@
1 + # ======================================================
2 + # Hardcoded Fallbacks
3 + # Mirror of policies.json built-in policies.
4 + # Used when policies.json lookup fails.
5 + # ======================================================
6 +
7 + declare -gA _POLICY_TUNNEL_MODE=(
8 + [default]="split"
9 + [guest]="split"
10 + [trusted]="split"
11 + [server]="split"
12 + [iot]="split"
13 + )
14 +
15 + declare -gA _POLICY_DEFAULT_RULE=(
16 + [default]=""
17 + [guest]="guest"
18 + [trusted]=""
19 + [server]=""
20 + [iot]=""
21 + )
22 +
23 + declare -gA _POLICY_STRICT_RULE=(
24 + [default]="false"
25 + [guest]="true"
26 + [trusted]="false"
27 + [server]="false"
28 + [iot]="false"
29 + )
30 +
31 + declare -gA _POLICY_AUTO_APPLY=(
32 + [default]="true"
33 + [guest]="true"
34 + [trusted]="true"
35 + [server]="true"
36 + [iot]="true"
37 + )
38 +
39 + function policy::_hardcoded_field() {
40 + local name="${1:-}" field="${2:-}"
41 + case "$field" in
42 + tunnel_mode) echo "${_POLICY_TUNNEL_MODE[$name]:-split}" ;;
43 + default_rule) echo "${_POLICY_DEFAULT_RULE[$name]:-}" ;;
44 + strict_rule) echo "${_POLICY_STRICT_RULE[$name]:-false}" ;;
45 + auto_apply) echo "${_POLICY_AUTO_APPLY[$name]:-true}" ;;
46 + *) echo "" ;;
47 + esac
48 + }
Newer Older