Все Новый

user:thomas фрагментов создано пользователем

title:mygist фрагментов с указанным заголовком

description:sync gists with given description

filename:myfile.txt фрагменты содержащие файлы с указанным именем

extension:yml фрагменты, содержащие файлы с указанным расширением

language:go фрагменты, содержащие файлы с указанным языком

topic:homelab фрагменты с заданной темой

all:systemctl search all fields

Регистрация

Войти

Все Новый Регистрация Войти

nuno

Зарегистрирован 2 months ago

Свежие сверху по дате создания
Свежие снизу по дате создания
Свежие сверху по дате обновления
Свежие снизу по дате обновления
Все фрагменты 570

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 function cmd::group::list() {
2 local groups_dir
3 groups_dir="$(ctx::groups)"
4
5 local groups=("${groups_dir}"/*.group)
6 if [[ ! -f "${groups[0]}" ]]; then
7 log::wg "No groups configured"
8 return 0
9 fi

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 root@wireguard:~# grep -rn "while IFS.*peers::all\|for conf in.*\.conf\|peers::get_meta\|json::get\|peers::get_ip" \
2 > /etc/wireguard/wgctl/commands/ | grep -v "list.command" | grep -v "\.git"
3 /etc/wireguard/wgctl/commands/rule.command.sh:119: peer_rule=$(peers::get_meta "$peer_name" "rule")
4 /etc/wireguard/wgctl/commands/rule.command.sh:132: name=$(json::get "$rule_file" "name")
5 /etc/wireguard/wgctl/commands/rule.command.sh:134: desc=$(json::get "$rule_file" "desc")
6 /etc/wireguard/wgctl/commands/rule.command.sh:137: n_allows=$(json::get "$rule_file" "allow_ips" | wc -l)
7 /etc/wireguard/wgctl/commands/rule.command.sh:138: n_allow_ports=$(json::get "$rule_file" "allow_ports" | wc -l)
8 /etc/wireguard/wgctl/commands/rule.command.sh:140: n_block_ips=$(json::get "$rule_file" "block_ips" | wc -l)
9 /etc/wireguard/wgctl/commands/rule.command.sh:141: n_block_ports=$(json::get "$rule_file" "block_ports" | wc -l)
10 /etc/wireguard/wgctl/commands/rule.command.sh:191: desc=$(json::get "$rule_file" "desc")

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Lifecycle
5 # ============================================
6
7 function cmd::list::on_load() {
8 flag::register --type
9 flag::register --online
10 flag::register --offline

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 #!/usr/bin/env bash
2 set -e
3
4 WGCTL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5 DATA_DIR="/etc/wireguard/.wgctl"
6
7 echo "Installing wgctl..."
8
9 install::dependencies
10 install::make_structure

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Lifecycle
5 # ============================================
6
7 function config::on_load() {
8 config::validate
9 }

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 Peer Rules
2 ──────────────────────────────────────────────────
3 ✅ desktop-roboclean rule=user fw: 6/6
4 ✅ desktop-test rule=user fw: 6/6
5 ✅ desktop-test1 rule=user fw: 6/6
6 ✅ guest-test rule=guest fw: 16/16
7 ✅ guest-test2 rule=guest fw: 16/16
8 ✅ guest-test3 rule=guest fw: 16/16
9 ✅ guest-test4 rule=guest fw: 16/16
10 ✅ guest-zephyr-test rule=moonlight-02 fw: 5/5

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 function cmd::fw::list() {
2 local peer="" type=""
3 local show_nflog=true show_accept=true show_drop=true
4
5 while [[ $# -gt 0 ]]; do
6 case "$1" in
7 --peer) peer="$2"; shift 2 ;;
8 --type) type="$2"; shift 2 ;;
9 --no-nflog) show_nflog=false; shift ;;
10 --no-accept) show_accept=false; shift ;;

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 function cmd::fw::list() {
2 local peer="" type=""
3 while [[ $# -gt 0 ]]; do
4 case "$1" in
5 --peer) peer="$2"; shift 2 ;;
6 --type) type="$2"; shift 2 ;;
7 *) shift ;;
8 esac
9 done

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 grep -r "firewall::" /etc/wireguard/wgctl/
2 /etc/wireguard/wgctl/commands/remove.command.sh: firewall::unblock_all "$client_ip"
3 /etc/wireguard/wgctl/commands/remove.command.sh: firewall::remove_block_file "$name" 2>/dev/null || true
4 /etc/wireguard/wgctl/commands/service.command.sh: firewall::restore_blocks
5 /etc/wireguard/wgctl/commands/service.command.sh: firewall::restore_blocks
6 /etc/wireguard/wgctl/commands/unblock.command.sh: firewall::unblock_all "$client_ip"
7 /etc/wireguard/wgctl/commands/unblock.command.sh: firewall::remove_block_file "$name"
8 /etc/wireguard/wgctl/commands/unblock.command.sh: firewall::unblock_ip "$client_ip" "$ip"
9 /etc/wireguard/wgctl/commands/unblock.command.sh: firewall::unblock_subnet "$client_ip" "$subnet"
10 /etc/wireguard/wgctl/commands/unblock.command.sh: firewall::unblock_port "$client_ip" "$target" "$port" "$proto"

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 function firewall::block_ip_logged() {
2 local client_ip="$1" target_ip="$2"
3
4 iptables -I FORWARD 1 -s "$client_ip" -d "$target_ip" -j LOG --log-prefix "wgctl-dropped: " --log-level 4
5 iptables -I FORWARD 1 -s "$client_ip" -d "$target_ip" -j DROP
6 log::wg_block "Blocked ${client_ip} → ${target_ip} (logged)"
7 }
8 function firewall::unblock_ip() {
9 local client_ip="$1" target_ip="$2"
Новее Позже

Работает на Opengist ⋅ Load: 119ms⋅

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