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

All gists

Recently created
Least recently created
Recently updated
Least recently updated

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 ── Client ──────────────────────────────────
2 Name: phone-test
3 IP: 10.1.3.5
4 Type: phone
5 Rule: user ↳ (no-proxmox, dns-restricted)
6 Status: offline (restricted)
7 Endpoint: —
8 Last seen: —
9 AllowedIPs: 10.1.0.0/16, 10.0.0.0/24
10 Public key: DBlzGyW0Zr6U/qLCa9nOphIFZk6lr0jTJ1q50OGSOko=

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 ── Rule: user ──────────────────────────────────
2
3 ↳ no-proxmox
4 - 10.0.0.101/32 → npm
5 - 10.0.0.100/32
6
7 ↳ dns-restricted
8 + 10.0.0.103:53:udp → pihole:dns-udp
9 + 10.0.0.103:53:tcp → pihole:dns-tcp
10 - 10.0.0.103/32 → pihole

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 /etc/wireguard/wgctl/commands/block.command.sh:function cmd::block::help() {
2 /etc/wireguard/wgctl/commands/block.command.sh- cat <<EOF
3 /etc/wireguard/wgctl/commands/block.command.sh-Usage: wgctl block --name <name> [options]
4 /etc/wireguard/wgctl/commands/block.command.sh-
5 /etc/wireguard/wgctl/commands/block.command.sh-Block a client entirely or restrict access to specific IPs/ports/subnets.
6 /etc/wireguard/wgctl/commands/block.command.sh-Block rules are persisted and restored on WireGuard restart.
7 /etc/wireguard/wgctl/commands/block.command.sh-
8 /etc/wireguard/wgctl/commands/block.command.sh-Options:
9 /etc/wireguard/wgctl/commands/block.command.sh- --name <name> Client name (e.g. phone-nuno)
10 /etc/wireguard/wgctl/commands/block.command.sh- --type <type> Device type (optional, combines with --name)

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 function cmd::audit::on_load() {
4 flag::register --fix
5 flag::register --peer
6 flag::register --type
7 }
8
9 function cmd::audit::help() {
10 cat <<EOF

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function fw::has_rule() {
2 # Generic rule existence check
3 # fw::has_rule <target> <client_ip> <dest> [port] [proto]
4 local action="${1:-DROP}" client_ip="${2:-}" target="${3:-}" \
5 port="${4:-}" proto="${5:-}"
6 if [[ -n "$port" ]]; then
7 fw::_forward_exists -s "$client_ip" -d "$target" \
8 -p "$proto" --dport "$port" -j "$action"
9 else
10 fw::_forward_exists -s "$client_ip" -d "$target" -j "$action"

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Lifecycle
5 # ============================================
6
7 function cmd::block::on_load() {
8 flag::register --name
9 flag::register --type
10 flag::register --force

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 WGCTL_BINARY="$(command -v wgctl)"
4
5 # ============================================
6 # Lifecycle
7 # ============================================
8
9 function cmd::test::on_load() {
10 flag::register --destructive

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::unblock::run() {
2 local name=""
3 local type=""
4 local ips=()
5 local subnets=()
6 local ports=()
7 local all=false
8 local quiet=false
9
10 while [[ $# -gt 0 ]]; do

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function fw::block_ip() {
2 local client_ip="${1:-}" target_ip="${2:-}"
3
4 fw::_forward_exists -s "$client_ip" -d "$target_ip" -j DROP \
5 || iptables -I FORWARD 1 -s "$client_ip" -d "$target_ip" -j DROP
6
7 fw::_forward_exists -s "$client_ip" -d "$target_ip" -j NFLOG --nflog-group 1 --nflog-prefix "wgctl-drop:" \
8 || iptables -I FORWARD 1 -s "$client_ip" -d "$target_ip" -j NFLOG --nflog-group 1 --nflog-prefix "wgctl-drop:"
9 }

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::list::_precompute_block_status() {
2 local -n _blocked="$1"
3 local -n _restricted="$2"
4
5 local wg_peers
6 wg_peers=$(wg show "$(config::interface)" peers 2>/dev/null)
7
8 while IFS= read -r name; do
9 if block::has_specific_rules "$name" 2>/dev/null; then
10 _restricted["$name"]=true
Newer Older

Powered by Opengist ⋅ Load: 137ms⋅

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