From 1e3def5c7832572877a0f41432bab5655ea4f6bf Mon Sep 17 00:00:00 2001 From: seraphim <18ycm9tx@anonaddy.me> Date: Sat, 8 Aug 2026 17:21:01 +0700 Subject: upd --- nixos/modules/features/cli-tools/default.nix | 2 + nixos/modules/features/vpn-utils/default.nix | 32 +++---- nixos/modules/system/services/default.nix | 7 ++ nixos/modules/system/users/default.nix | 25 +++++- nixos/result | 1 - nixos/vpn-port-22-log.md | 125 --------------------------- 6 files changed, 47 insertions(+), 145 deletions(-) delete mode 120000 nixos/result delete mode 100644 nixos/vpn-port-22-log.md (limited to 'nixos') diff --git a/nixos/modules/features/cli-tools/default.nix b/nixos/modules/features/cli-tools/default.nix index 054ddc1..ef13ddd 100644 --- a/nixos/modules/features/cli-tools/default.nix +++ b/nixos/modules/features/cli-tools/default.nix @@ -16,6 +16,8 @@ caligula fetch smartmontools + amneziawg-tools + amneziawg-go ]; # Cross-shell prompt; its config lives in the dotfiles repo, not NixOS. diff --git a/nixos/modules/features/vpn-utils/default.nix b/nixos/modules/features/vpn-utils/default.nix index 89b92e4..91f2594 100644 --- a/nixos/modules/features/vpn-utils/default.nix +++ b/nixos/modules/features/vpn-utils/default.nix @@ -8,24 +8,24 @@ programs.amnezia-vpn.enable = true; - networking.wireguard.enable = true; - - boot.kernelModules = [ "wireguard" ]; - environment.systemPackages = with pkgs; [ wireguard-tools ]; - systemd.services.wireguard-client = { - description = "WireGuard client tunnel (wg)"; - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - ExecStart = "${pkgs.wireguard-tools}/bin/wg-quick up wg"; - ExecStop = "${pkgs.wireguard-tools}/bin/wg-quick down wg"; - }; - }; + # Throne's sing-box core resolves its underlying DNS by running + # `resolvectl -i dns` and fails to parse the empty + # per-link output (enp42s0 has no per-link DNS; ours is global Mullvad + # in services.resolved). Push the same Mullvad servers per-link so the + # resolvectl parse succeeds and proxy hostnames can be looked up. + networking.networkmanager.dispatcherScripts = [ + { + type = "basic"; + source = pkgs.writeText "link-dns.sh" '' + #!/bin/sh + if [ "$1" = "enp42s0" ] && { [ "$2" = "up" ] || [ "$2" = "dhcp4-change" ]; }; then + ${pkgs.systemd}/bin/resolvectl dns enp42s0 194.242.2.2 194.242.2.4 || true + fi + ''; + } + ]; } \ No newline at end of file diff --git a/nixos/modules/system/services/default.nix b/nixos/modules/system/services/default.nix index 74ac531..571ae3a 100644 --- a/nixos/modules/system/services/default.nix +++ b/nixos/modules/system/services/default.nix @@ -14,4 +14,11 @@ SystemMaxUse=50M MaxRetentionSec=1month ''; + + # Cap core dumps so a crashing app can't fill the root partition with + # multi-GB crash dumps (e.g. java/electron segfaults). + systemd.coredump.settings.Coredump = { + ProcessSizeMax = "512M"; + Storage = "external"; + }; } diff --git a/nixos/modules/system/users/default.nix b/nixos/modules/system/users/default.nix index d795a64..d9ac254 100644 --- a/nixos/modules/system/users/default.nix +++ b/nixos/modules/system/users/default.nix @@ -24,7 +24,13 @@ ]; }; - # ZSH + completion, oh-my-zsh, autosuggestions, and fzf key bindings. + # fzf -- proper key bindings + completion for zsh. + programs.fzf = { + fuzzyCompletion = true; + keybindings = true; + }; + + # ZSH + completion, oh-my-zsh, autosuggestions. programs.zsh = { enable = true; enableCompletion = true; @@ -35,8 +41,21 @@ strategy = [ "history" "completion" ]; }; interactiveShellInit = '' - source ${pkgs.fzf}/share/fzf/key-bindings.zsh - source ${pkgs.fzf}/share/fzf/completion.zsh + # Fish-style full-screen Ctrl+R history search. + export FZF_CTRL_R_OPTS=" + --layout=reverse + --scheme=history + --height=100% + --border=sharp + --border-label=' Ctrl+R ' + --highlight-line + --pointer=→ + --info=inline-right + --header-first + --header='enter: accept · ctrl-/ : toggle preview' + --preview='echo {}' --preview-window=down:3:hidden:wrap + --bind=ctrl-/:toggle-preview + " ''; shellAliases = { ls = "eza -al --icons=auto"; diff --git a/nixos/result b/nixos/result deleted file mode 120000 index 9748ece..0000000 --- a/nixos/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/i7vgmy988fpdbmxzsp6j0hg5aiz1mjdk-nixos-system-opus-26.11.20260730.1559d3d \ No newline at end of file diff --git a/nixos/vpn-port-22-log.md b/nixos/vpn-port-22-log.md deleted file mode 100644 index 1466296..0000000 --- a/nixos/vpn-port-22-log.md +++ /dev/null @@ -1,125 +0,0 @@ -# Лог диагностики: исходящий порт 22 заблокирован - -> Отчёт о том, почему `git push` не работает ни с VPN, ни без него. -> Чувствительные данные (ключи, preshared-key) удалены. - -## Вывод - -- **Без VPN:** российский провайдер режет исходящий порт 22 → `Network is unreachable`. -- **С VPN (WireGuard):** сам провайдер VPN-сервиса **в целом запрещает исходящий порт 22** - (порт 22 к `github.com`, `gitlab.com` и `git.sr.ht` — timeout, при этом порт 443 открыт ко всем). - -Итог: git по SSH (использует порт 22) не может соединиться ни в одном состоянии. - ---- - -## 1. Конфигурация интерфейса WireGuard (без секретов) - -Из `/etc/wireguard/wg.conf`: - -```ini -[Interface] -PrivateKey = [Скрыто] -Address = 10.233.10.237/32 -DNS = 1.1.1.1, 8.8.4.4 -MTU = 1380 - -[Peer] -PublicKey = +ickp+Ceu/QcMW7pTA1is4ZcUSzglHuyuBRq0QeQ5D0= -PresharedKey = [Скрыто] -AllowedIPs = 0.0.0.0/0, ::/0 -PersistentKeepalive = 25 -Endpoint = nl01w-dp.kcufwfgnkr.net:62233 -``` - -`AllowedIPs = 0.0.0.0/0` → туннель должен заворачивать весь трафик (все маршруты в таблице 52219). - ---- - -## 2. Состояние туннеля - -Интерфейс `wg` поднят, адрес и DNS настроены, маршрут по умолчанию через туннель существует: - -```text -$ ip -brief addr -enp42s0 UP 192.168.1.40/24 fd55:69a6:a86:0:.../64 ... -throne-tun DOWN ... -wg UP 10.233.10.237/32 - -# специфичная для wg-QUICK таблица маршрутов: -$ ip route show table 52219 -default dev wg proto static scope link metric 50 - -# DNS на туннеле: -$ resolvectl status wg -Link 18 (wg) Current DNS Server: 1.1.1.1 DNS Servers: 1.1.1.1 8.8.4.4 Default Route: yes -``` - -IP-адрес в туннеле: `10.233.10.237/32`. - ---- - -## 3. Туннель работает (проверка `ping` через VPN) - -```text -$ ping -c 2 1.1.1.1 -2 пакета передано, 2 получено, 0% потерь -rtt min/avg/max/mdev = 114/115/118 ms ← задержка самого VPN -``` - ---- - -## 4. Порт 443 открыт (HTTPS работает) - -```text -$ ssh -vv -p 443 git@git.sr.ht (только проверка соединения) -Connecting to git.sr.ht [46.23.81.155] port 443 -banner: HTTP/1.1 400 Bad Request / Server: nginx -→ порт 443 доступен (это обычный HTTPS/nginx, никакого SSH-сервиса на 443 у git.sr.ht нет) -``` - ---- - -## 5. Порт 22 заблокирова - -### 5.1 Без VPN — `Network is unreachable` - -```text -$ ssh -p 22 git@git.sr.ht -ssh: connect to host git.sr.ht port 22: Network is unreachable -``` - -### 5.2 С VPN — таймаут на исходящем 22 - -```text -$ /dev/tcp/46.23.81.155/22 → FAIL (connection timed out) -$ ssh -4 -p 22 git@46.23.81.155 → Connection timed out -$ /dev/tcp/140.82.121.4/22 (github.com:22) → FAILED -$ /dev/tcp/172.65.251.78/22 (gitlab.com:22) → FAILED -``` - -Порт 22 таймаутится ко **всем** хостам через туннель, а порт 443 — открыт: - -```text -$ /dev/tcp/172.65.251.78/443 (gitlab.com:443) → OPEN -``` - -### 5.3 DNS (спойлер: отвечал IPv6 без маршрута) - -```text -$ getent hosts git.sr.ht -2a03:6000:1813:1337::155 (IPv6 — без глобального маршрута) -46.23.81.155 (IPv4 — нужный адрес) -``` - ---- - -## 6. Итоговая таблица - -| Состояние | git.sr.ht:22 | git.sr.ht:443 | Вердикт | -|-----------|--------------|---------------|---------| -| Без VPN | недоступен (ISP) | — | порт 22 режется провайдером | -| С VPN | таймаут (VPN) | открыт | VPN-сервис запрещает исходящий 22 | - -**Причина:** VPN-сервис на стороне выхода `nl01w-dp.kcufwfgnkr.net` -запрещает исходящие соединения по порту 22. Поэтому git-по-SSH не работает. -- cgit v1.2.3