relay: address the account by phone number and pass the message via -m

signal-cli 0.14.7 parses an all-digit -a value as a phone number (the
numeric account name never resolves), and the message is a -m option,
not a positional (a positional is parsed as a second recipient).
Verified live: corrected invocation returns type SUCCESS.
This commit is contained in:
Frank
2026-09-17 18:28:20 -07:00
parent f73a7e80a1
commit 698759c61e
3 changed files with 12 additions and 5 deletions
+8 -3
View File
@@ -33,8 +33,12 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
# podman bridge subnet (10.89.0.0/16) only, keeping the unauthenticated
# endpoint off the rest of the LAN.
LISTEN_ADDR = ("192.168.0.143", 18093)
SIGNAL_CLI = "/usr/local/bin/signal-cli"
SIGNAL_ACCOUNT = "318311"
# The account is addressed by phone number: signal-cli 0.14.7's -a flag
# parses an all-digit value as a phone number and never falls back to the
# accounts.json name (the numeric name 318311 dies with "Invalid account
# (phone number)"). The number is a number, not a credential — the
# credential is the account state under ~/.local/share/signal-cli.
SIGNAL_ACCOUNT = "+12062476336"
SIGNAL_TO = "+12062476336"
# The relay is a safety net, not the rate limiter: Alertmanager already
@@ -86,7 +90,8 @@ def send_signal(text):
return False
try:
proc = subprocess.run(
[SIGNAL_CLI, "-a", SIGNAL_ACCOUNT, "-o", "json", "send", SIGNAL_TO, text],
[SIGNAL_CLI, "-a", SIGNAL_ACCOUNT, "-o", "json", "send", SIGNAL_TO,
"-m", text],
capture_output=True, text=True, timeout=30,
)
except subprocess.TimeoutExpired:
@@ -28,7 +28,7 @@ The Signal relay is a host-side process, and the address it must bind is the one
- POST `/alertmanager` — the Alertmanager webhook handler; formats the group and sends it.
- GET `/health` — liveness for the deployer's health wait.
- Dedupes per group for 15 minutes, so a stuck alert cannot out-repeat the 4 h `repeat_interval` during a relay hiccup.
- Sends through `/usr/local/bin/signal-cli -a 318311 send +12062476336` — Frank's existing account; the credential is the account state under `~/.local/share/signal-cli`, and the account/phone are numbers, not secrets.
- Sends through `/usr/local/bin/signal-cli -a +12062476336 -o json send +12062476336 -m <text>` — Frank's existing account (state dir `318311`); the credential is the account state under `~/.local/share/signal-cli`, and the account/phone are numbers, not secrets.
## Deployment
@@ -43,6 +43,8 @@ The Signal relay is a host-side process, and the address it must bind is the one
- The webhook URL and the relay's listen port are a **cross-file contract**: the relay moves ports and the webhook string does not move with it, and every alert is then dropped with no error anywhere. `tests/observability_quadlet.bats` pins both halves.
- The container address is `alertmanager:9093`, never the published port: Prometheus is in a container and the port is loopback-only.
- signal-cli account state is on the host, not in the container — a wiped `~/.local/share/signal-cli` silences delivery while every status page stays green.
- signal-cli 0.14.7's `-a` flag parses an all-digit value as a **phone number** and never falls back to the `accounts.json` name: the account's numeric name (`318311`) dies with `Invalid account (phone number)`, while `-a +12062476336` works. The message goes via `-m`, not a positional — a positional message is parsed as a second recipient (`Invalid phone number '…'`).
- A failed send is **not** marked in the dedupe map, so the next Alertmanager repeat retries it — but the relay returns 200 to the webhook regardless (a relay bug must not 500 Alertmanager), so a dead signal-cli shows up only in the relay's journal, not in Alertmanager's.
## See Also
+1 -1
View File
@@ -473,7 +473,7 @@ assert any('ALERTS' in e for e in exprs), exprs
local handler="$REPO_ROOT/scripts/deploy-remote.sh"
grep -q 'signal-cli' "$relay"
grep -q 'SIGNAL_CLI = "/usr/local/bin/signal-cli"' "$relay"
grep -q 'SIGNAL_ACCOUNT = "318311"' "$relay"
grep -q 'SIGNAL_ACCOUNT = "+12062476336"' "$relay"
grep -q 'LISTEN_ADDR = ("192.168.0.143", 18093)' "$relay"
grep -q -- '--dport 18093 -s 127.0.0.1 -j ACCEPT' "$handler"
grep -q -- '--dport 18093 -s 192.168.0.143 -j ACCEPT' "$handler"