Все Новый

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 / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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
Новее Позже

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

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