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.
This commit is contained in:
anten-ka
2026-04-10 12:16:45 +03:00
parent 32f204c871
commit 663a5a2aae

View File

@@ -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() { start_telemt() {
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 systemctl start "$TELEMT_SERVICE" 2>/dev/null
fi
sleep 2 sleep 2
if systemctl is-active --quiet "$TELEMT_SERVICE"; then if systemctl is-active --quiet "$TELEMT_SERVICE"; then
log_success "telemt запущен" log_success "telemt запущен"