From 663a5a2aae88752aa80d3e95ab5d288f10a28b8a Mon Sep 17 00:00:00 2001 From: anten-ka Date: Fri, 10 Apr 2026 12:16:45 +0300 Subject: [PATCH] fix(install): restart telemt if already running so new config is applied start_telemt() was a no-op when the service was already active, so regenerating /etc/telemt/config.toml (e.g. reinstalling with a different mask domain or switching lite<->pro) left the daemon running with the OLD in-memory config. This caused the reported "lite-mode key does not work" issue: after a fresh lite install over an existing pro install, telemt kept tls_domain=anten-ka.com and dropped SNI=google.com clients with unknown_sni_action=Drop even though /etc/telemt/config.toml said tls_domain=google.com. Fix: start_telemt now uses systemctl restart when the service is already active, guaranteeing the fresh config is loaded. --- lib/telemt.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/telemt.sh b/lib/telemt.sh index 938759f..3af9484 100755 --- a/lib/telemt.sh +++ b/lib/telemt.sh @@ -187,8 +187,20 @@ EOF } # ── Управление сервисом ────────────────────────────────────────────────────── +# start_telemt ensures telemt is running with the CURRENT on-disk config. +# If the service is already active we must restart (not plain start) — otherwise +# the running process keeps its old in-memory config and the freshly generated +# /etc/telemt/config.toml is silently ignored. This was the root cause of the +# "lite-mode key doesn't work after reinstall" bug: telemt had loaded the +# previous Pro config (tls_domain=anten-ka.com) and was rejecting SNI=google.com +# clients with unknown_sni_action=Drop even though the on-disk config said +# tls_domain=google.com. start_telemt() { - systemctl start "$TELEMT_SERVICE" 2>/dev/null + if systemctl is-active --quiet "$TELEMT_SERVICE" 2>/dev/null; then + systemctl restart "$TELEMT_SERVICE" 2>/dev/null + else + systemctl start "$TELEMT_SERVICE" 2>/dev/null + fi sleep 2 if systemctl is-active --quiet "$TELEMT_SERVICE"; then log_success "telemt запущен"