nuno a révisé ce gist 1 month ago. Aller à la révision
1 file changed, 22 insertions
gistfile1.txt(fichier créé)
| @@ -0,0 +1,22 @@ | |||
| 1 | + | sed -n '295,315p' /etc/wireguard/wgctl/modules/identity.module.sh | |
| 2 | + | result=$(json::get_nested "$id_file" "rule_flags" "$flag" 2>/dev/null) || true | |
| 3 | + | ||
| 4 | + | if [[ -n "$result" ]]; then | |
| 5 | + | echo "$result" | |
| 6 | + | return 0 | |
| 7 | + | fi | |
| 8 | + | ||
| 9 | + | # Fall back to policy value | |
| 10 | + | local policy_name | |
| 11 | + | policy_name=$(identity::policy "$identity_name") | |
| 12 | + | policy::get "$policy_name" "$flag" | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | # identity::set_rule_flag <identity_name> <flag> <value> | |
| 16 | + | # Sets a rule_flag directly on the identity file. | |
| 17 | + | function identity::set_rule_flag() { | |
| 18 | + | local identity_name="${1:-}" flag="${2:-}" value="${3:-}" | |
| 19 | + | local id_file | |
| 20 | + | id_file=$(ctx::identity::path "${identity_name}.identity") | |
| 21 | + | if [[ ! -f "$id_file" ]]; then | |
| 22 | + | log::error "Identity '${identity_name}' not found" | |
Plus récent
Plus ancien