All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Register

Login

All New Register Login

nuno

Joined 4 months ago

Recently created
Least recently created
Recently updated
Least recently updated
All gists 582

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::block::run() {
2 local name=""
3 local type=""
4 local block_name=""
5 local ips=()
6 local subnets=()
7 local ports=()
8 local quiet=false
9 local services=()

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::inspect::_rule_info() {
2 local name="${1:-}"
3 local rule
4 rule=$(peers::get_meta "$name" "rule")
5 [[ -z "$rule" ]] && return 0
6 rule::exists "$rule" || return 0
7
8 cmd::inspect::_section "Rule: ${rule}"
9
10 local rule_file

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::rule::show() {
2 local name="" show_peers=true color=false show_resolved=false
3
4 while [[ $# -gt 0 ]]; do
5 case "$1" in
6 --name) util::require_flag "--name" "${2:-}" || return 1
7 name="$2"; shift 2 ;;
8 --no-peers) show_peers=false; shift ;;
9 --color) color=true; shift ;;
10 --resolved) show_resolved=true; shift ;;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::test::section_destructive() {
2 test::section "Destructive (modifying state)"
3
4 # Cleanup from any previous failed run
5 "$WGCTL_BINARY" remove --name phone-testunit --force > /dev/null 2>&1 || true
6 "$WGCTL_BINARY" group remove --name testgroup --force > /dev/null 2>&1 || true
7
8 # Add test peer
9 cmd::test::run_cmd "add phone peer" "added successfully" \
10 add --name testunit --type phone

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 grep -A 15 "function block::restore_peer" \
2 > /etc/wireguard/wgctl/modules/block.module.sh
3 function block::restore_peer() {
4 local name="${1:?}" client_ip="${2:?}"
5 fw::unblock_all "$client_ip"
6 fw::flush_peer "$client_ip"
7 monitor::unwatch_client "$name"
8 if ! peers::exists_in_server "$name"; then
9 local public_key
10 public_key=$(keys::public "$name") || return 1

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:~# wgctl inspect --name phone-test
2
3 ────────────────────────────────────────────────
4 Inspect: phone-test
5 ────────────────────────────────────────────────
6
7 ── Client ──────────────────────────────────
8 Name: phone-test
9 IP: 10.1.3.5
10 Type: phone

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::inspect::_blocks_info() {
2 local name="${1:-}"
3 local block_file
4 block_file="$(ctx::block::path "${name}.block")"
5 [[ ! -f "$block_file" ]] && return 0
6
7 local data
8 data=$(json::block_get "$block_file")
9 [[ -z "$data" ]] && return 0

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:~# wgctl group unblock --name test
2 => WARN: ⚠️ 🔒 phone-test — still blocked by other group(s), skipping
3 => DEBUG: 🔍 _unblock_peer: restoring phone-test1
4 => DEBUG: 🔍 Unblocked all traffic from: 10.1.3.6
5 => DEBUG: 🔍 flush_peer: starting for 10.1.3.6
6 => DEBUG: 🔍 flush_peer: removed 0 FORWARD rules for: 10.1.3.6
7 => DEBUG: 🔍 Unwatched client: phone-test1
8 => DEBUG: 🔍 Added peer to server config: phone-test1
9 => DEBUG: 🔍 WireGuard config reloaded
10 => DEBUG: 🔍 _unblock_peer: done

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 => INFO: 🟢 🔒 Restarting WireGuard...
2 => DEBUG: 🔍 rule::apply: peer_name=desktop-roboclean ip=10.1.1.3
3 => DEBUG: 🔍 Applied rule 'user' to: 10.1.1.3
4 => DEBUG: 🔍 rule::apply: peer_name=desktop-test ip=10.1.1.1
5 => DEBUG: 🔍 Applied rule 'user' to: 10.1.1.1
6 => DEBUG: 🔍 rule::apply: peer_name=desktop-test1 ip=10.1.1.2
7 => DEBUG: 🔍 Applied rule 'user' to: 10.1.1.2
8 => DEBUG: 🔍 rule::apply: peer_name=guest-test ip=10.1.103.1
9 => DEBUG: 🔍 Applied rule 'guest' to: 10.1.103.1
10 => DEBUG: 🔍 rule::apply: peer_name=guest-test2 ip=10.1.103.2

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:~# wgctl group unblock --name test
2 => DEBUG: 🔍 _unblock_peer: restoring phone-test
3 => DEBUG: 🔍 Unblocked all traffic from: 10.1.3.5
4 => DEBUG: 🔍 flush_peer: starting for 10.1.3.5
5 => DEBUG: 🔍 flush_peer: removed 0 FORWARD rules for: 10.1.3.5
6 => DEBUG: 🔍 Unwatched client: phone-test
7 => DEBUG: 🔍 Added peer to server config: phone-test
8 => DEBUG: 🔍 WireGuard config reloaded
9 => DEBUG: 🔍 _unblock_peer: done
10 => DEBUG: 🔍 _unblock_peer: restoring phone-test1
Newer Older

Powered by Opengist ⋅ Load: 124ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ KrilHub