gistfile1.txt
· 1.1 KiB · Text
Ham
# ======================================================
# Hardcoded Fallbacks
# Mirror of policies.json built-in policies.
# Used when policies.json lookup fails.
# ======================================================
declare -gA _POLICY_TUNNEL_MODE=(
[default]="split"
[guest]="split"
[trusted]="split"
[server]="split"
[iot]="split"
)
declare -gA _POLICY_DEFAULT_RULE=(
[default]=""
[guest]="guest"
[trusted]=""
[server]=""
[iot]=""
)
declare -gA _POLICY_STRICT_RULE=(
[default]="false"
[guest]="true"
[trusted]="false"
[server]="false"
[iot]="false"
)
declare -gA _POLICY_AUTO_APPLY=(
[default]="true"
[guest]="true"
[trusted]="true"
[server]="true"
[iot]="true"
)
function policy::_hardcoded_field() {
local name="${1:-}" field="${2:-}"
case "$field" in
tunnel_mode) echo "${_POLICY_TUNNEL_MODE[$name]:-split}" ;;
default_rule) echo "${_POLICY_DEFAULT_RULE[$name]:-}" ;;
strict_rule) echo "${_POLICY_STRICT_RULE[$name]:-false}" ;;
auto_apply) echo "${_POLICY_AUTO_APPLY[$name]:-true}" ;;
*) echo "" ;;
esac
}
| 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 | } |