From a1a0c6ff6372053f0eea317a8405f7c5e0381518 Mon Sep 17 00:00:00 2001 From: Dmitry <124861781+ada-dmitry@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:14:28 +0300 Subject: [PATCH] =?UTF-8?q?feat(configs):=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8?= =?UTF-8?q?=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8=D0=B9=20Privoxy=20=D0=B8?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B6=D0=B5=D1=81=D1=82=D0=BA=D0=BE=D0=B3=D0=BE=20=D0=BE?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?SSH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .stow-local-ignore | 4 +- configs/99-hardening.conf | 65 ++++++++++++++++++++ awg_exclude.json => configs/awg_exclude.json | 0 privoxy_config => configs/privoxy_config | 0 ssh/.ssh/config.d/40-proxy.conf | 2 +- 5 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 configs/99-hardening.conf rename awg_exclude.json => configs/awg_exclude.json (100%) rename privoxy_config => configs/privoxy_config (100%) diff --git a/.stow-local-ignore b/.stow-local-ignore index 98f05a2..f63792d 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -1,6 +1,4 @@ ^/README\.md ^/\.git ^/\.gitignore -^/\archive -privoxy_config -awg_exclude.json \ No newline at end of file +^/configs$ diff --git a/configs/99-hardening.conf b/configs/99-hardening.conf new file mode 100644 index 0000000..c8752da --- /dev/null +++ b/configs/99-hardening.conf @@ -0,0 +1,65 @@ +# sshd_config.d/99-hardening.conf +# Консервативное ужесточение для серверов общего назначения (Debian). + +Protocol 2 + # Разрешить только протокол SSH v2. + +# Authentication +PermitRootLogin no + # Запретить прямой вход под root. +PasswordAuthentication no + # Отключить вход по паролю. +KbdInteractiveAuthentication no + # Отключить keyboard-interactive (часто это OTP/пароль). +ChallengeResponseAuthentication no + # Отключить challenge-response аутентификацию. +AuthenticationMethods publickey + # Требовать аутентификацию по ключу. +PubkeyAuthentication yes + # Разрешить аутентификацию по ключу. +PermitEmptyPasswords no + # Запретить пустые пароли, даже если пароли где-то включены. +UsePAM yes + # Оставить PAM для управления аккаунтом и сессией. + +# Session and access controls +LoginGraceTime 30 + # Дать 30 секунд на аутентификацию. +MaxAuthTries 3 + # Ограничить число неудачных попыток на соединение. +MaxSessions 2 + # Ограничить число сессий в одном соединении. +MaxStartups 10:30:60 + # Дросселировать неаутентифицированные подключения под нагрузкой. +ClientAliveInterval 300 + # Отправлять keepalive каждые 5 минут. +ClientAliveCountMax 2 + # Рвать соединение после 2 пропущенных keepalive. +TCPKeepAlive no + # Отключить TCP keepalive, чтобы не зависали старые сессии. + +# Reduce legacy or risky features +IgnoreRhosts yes + # Игнорировать доверенные файлы .rhosts и .shosts. +HostbasedAuthentication no + # Отключить аутентификацию по хосту. +PermitUserEnvironment no + # Запретить пользователям задавать окружение через ~/.ssh/environment. +X11Forwarding no + # Отключить X11-форвардинг. +AllowAgentForwarding no + # Запретить форвардинг агента. +AllowTcpForwarding local + # Разрешить только локальный форвардинг портов (без remote/dynamic). +AllowStreamLocalForwarding no + # Отключить форвардинг Unix-сокетов. +PermitTunnel no + # Отключить форвардинг туннелей tun/tap. + +# Misc +UseDNS no + # Пропустить обратный DNS для ускорения входа. +Compression no + # Отключить сжатие, чтобы уменьшить поверхность атаки. +PrintMotd no + # Не печатать MOTD (обычно делает PAM). diff --git a/awg_exclude.json b/configs/awg_exclude.json similarity index 100% rename from awg_exclude.json rename to configs/awg_exclude.json diff --git a/privoxy_config b/configs/privoxy_config similarity index 100% rename from privoxy_config rename to configs/privoxy_config diff --git a/ssh/.ssh/config.d/40-proxy.conf b/ssh/.ssh/config.d/40-proxy.conf index f17bc64..c669997 100644 --- a/ssh/.ssh/config.d/40-proxy.conf +++ b/ssh/.ssh/config.d/40-proxy.conf @@ -1,7 +1,7 @@ Host ru-vps HostName 157.22.231.198 User ada - IdentityFile ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_ed25519_homelab ServerAliveInterval 30 ServerAliveCountMax 3