junction: Wächter vor dem Routen — die Regel ist ein Skript
LiteLLM hat Guardrails als Katalog fertiger Dienste. Für diesen Router wäre das die
falsche Form: welche Inhalte durchgehen, weiß der Betreiber, nicht das Binary. Also
gibt es einen Haken und keine Meinung:
guard request cmd "/usr/local/share/junction/hooks/guard.sh"
Das Skript bekommt JUNCTION_PATH, JUNCTION_MODEL, JUNCTION_VKEY, JUNCTION_BODY_FILE
und JUNCTION_BODY_BYTES. Exit 0 lässt durch, alles andere lehnt mit 403 guard_refused
ab, und stdout wird die Begründung — im Rumpf und im Log. Schweigt das Skript, nennt
die Ablehnung seinen Exit-Code (guard_exit_3), statt eine leere Begründung zu erfinden.
Drei Entscheidungen, die Absicht sind:
- Der Rumpf liegt in einer Datei, nicht auf stdin. Ein Skript, das nur die erste Zeile
liest, hinge sonst beim Schreiben in eine volle Pipe — eine Datei kann nicht deadlocken.
- Der Wächter läuft VOR dem Routing: eine abgelehnte Anfrage belegt keinen Endpunkt,
keinen Warteschlangenplatz und kein Budget.
- Nur die Anfrage wird geprüft. Eine Antwort zu prüfen hieße, jeden Stream zu puffern —
genau das, was dieser Router nicht tut. Das steht so im README, statt es zu verschweigen.
Sichtbar: guard_pass/guard_refused im Log je Anfrage, guard_refused in /status,
junction_guard_refused_total in /metrics.
Tests (tests/guard.sh, Abschnitt 30): ein Skript, das ein Wort ablehnt (Begründung im
Rumpf, Zähler in /metrics, Logzeile), eines, das stumm mit 3 endet (Exit-Code wird zur
Begründung), und eine Anfrage, die durchgeht und als guard_pass geloggt wird.
make test: PASS, 186 Prüfungen. Live: Binary installiert, Dienst neu gestartet, kein
Wächter eingetragen — es gibt keine Regel von Konrad, und eine zu erfinden wäre genau
das, was dieses Feature nicht tut.
This commit is contained in:
1 parent
dceda32b28
commit
1e7c26b34c
8 files changed
+258
-7
No files matched your search
@@ -281,11 +281,41 @@ switch and a list of every client that currently calls without one (WebUI, Navig
|
||||
dashboard scripts), or half the fleet stops. Until then a limit only binds callers who
|
||||
were given a key.
|
||||
|
||||
## Guards — the policy is a script, not a keyword
|
||||
|
||||
junction refuses to pretend it knows what should be blocked. A guard is a command that
|
||||
sees the request and decides:
|
||||
|
||||
```conf
|
||||
guard request cmd "/usr/local/share/junction/hooks/guard.sh"
|
||||
```
|
||||
|
||||
```
|
||||
JUNCTION_PATH JUNCTION_MODEL JUNCTION_VKEY
|
||||
JUNCTION_BODY_FILE (the body, in a temp file)
|
||||
JUNCTION_BODY_BYTES
|
||||
```
|
||||
|
||||
Exit 0 lets the request through; anything else refuses it with `403 guard_refused`, and
|
||||
stdout becomes the reason in the body and in the log. If the script says nothing, the
|
||||
refusal names its exit code (`guard_exit_3`) instead of inventing an empty reason.
|
||||
|
||||
Three things that are deliberate:
|
||||
|
||||
- **The body is a file, not stdin.** A script that reads only the first line would hang
|
||||
the write into a full pipe; a file cannot deadlock.
|
||||
- **The guard runs before routing**, so a refused request occupies no endpoint, no queue
|
||||
slot and no upstream budget.
|
||||
- **Request side only.** Inspecting the answer would mean buffering every stream, which
|
||||
is the one thing this router is built not to do. When a guard is configured the guard
|
||||
line appears in every request's log (`guard_pass` / `guard_refused`), and
|
||||
`junction_guard_refused_total` counts the refusals.
|
||||
|
||||
## Keys
|
||||
|
||||
Global: `listen`, `connect_timeout_ms`, `offline_hold_s`, `max_body_bytes`,
|
||||
`log_prefix`, `cache_ttl`, `cache_entries`, `cache_bytes`, `max_inflight`,
|
||||
`queue_timeout`, `retry_num`, `retry_backoff`, `offline_wait`, `metrics`, `spend_log`.
|
||||
`queue_timeout`, `retry_num`, `retry_backoff`, `offline_wait`, `guard`, `metrics`, `spend_log`.
|
||||
|
||||
Endpoint:
|
||||
|
||||
@@ -445,14 +475,17 @@ opposite too: model traffic and `/admin` get a `404` there. For MCP the suite ch
|
||||
twelve things against two fake servers: the aggregated tool list, the call going to the
|
||||
right server with unchanged arguments, prompts bundled and un-prefixed on `prompts/get`,
|
||||
a resource URI un-prefixed on `resources/read`, an unknown prefix refused, and a dead
|
||||
server not taking the list down. The key limits have their own
|
||||
server not taking the list down. A guard script is tested from both sides: one that
|
||||
refuses a word it does not want (with its reason in the body and in `/metrics`), one
|
||||
that exits silently (the exit code becomes the reason), and a request that passes and is
|
||||
logged as `guard_pass`. The key limits have their own
|
||||
file: a `rpm 1` key is served once and then refused with `429` and a `Retry-After`, a key
|
||||
whose budget the ledger already used up is refused before it routes anything, and a
|
||||
priced request through a key shows up in the log file, in `/status` and in `/metrics`.
|
||||
The offline wait has its own section too: with the only endpoint missing the first
|
||||
request fails as before, and once the endpoint is back the next request waits out the
|
||||
offline hold (measured ~2 s) and is served instead of refused.
|
||||
Pass = `PASS` (178 checks), including two that would have caught the two mistakes this
|
||||
Pass = `PASS` (186 checks), including two that would have caught the two mistakes this
|
||||
design invites: a serial stub making a concurrent router look serialised, and a
|
||||
"waiting" comment leaking into a caller that never asked for a stream.
|
||||
|
||||
|
||||
@@ -31,6 +31,11 @@ retry_backoff 0.5
|
||||
# budget would be full again after every restart. Empty = no log.
|
||||
# spend_log /var/lib/junction/spend.jsonl
|
||||
|
||||
# A guard sees every request before it is routed and decides: exit 0 = pass, anything
|
||||
# else = 403 with the script's stdout as the reason. junction brings no policy of its
|
||||
# own. The body is handed over as a file (JUNCTION_BODY_FILE), not on stdin.
|
||||
# guard request cmd "/usr/local/share/junction/hooks/guard.sh"
|
||||
|
||||
# Response cache (memory only). ttl 0 disables it. Only complete, non-streamed 200
|
||||
# answers are stored, keyed on method + path + model + body.
|
||||
# Only /metrics, only read-only. A Prometheus in a container or on another host can
|
||||
|
||||
@@ -74,6 +74,18 @@ offline_wait 20
|
||||
metrics tcp 192.168.1.148:9180
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- Wächter
|
||||
#
|
||||
# Ein Kommando, das jede Anfrage sieht, bevor sie geroutet wird: exit 0 = durchlassen,
|
||||
# alles andere = 403 mit stdout als Begründung. junction bringt keine eigene Inhaltsregel
|
||||
# mit. Der Rumpf kommt als Datei (JUNCTION_BODY_FILE), nicht über stdin — ein Skript, das
|
||||
# nur einen Teil liest, würde sonst beim Schreiben in eine volle Pipe hängen.
|
||||
#
|
||||
# Nur die Anfrage wird geprüft. Eine Antwort zu prüfen hieße, jeden Stream zu puffern —
|
||||
# genau das, was dieser Router nicht tut.
|
||||
#
|
||||
# guard request cmd "/home/lotherk/.hermes/scripts/guard.sh"
|
||||
|
||||
# ---------------------------------------------------------------- Antwort-Cache
|
||||
#
|
||||
# Nur im Speicher, LRU, Schlüssel ist Methode + Pfad + Modell + Körper. Streams
|
||||
|
||||
@@ -384,6 +384,13 @@ static int global_kw(j_config *cfg, char **w, int n, int lineno, char *err, size
|
||||
cfg->vkey_count++;
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(k, "guard")) {
|
||||
/* guard request cmd "<kommando>" — genau ein Wort in Anführungszeichen,
|
||||
* wie bei `mcp … cmd`, damit Optionen und Kommando nicht verwechselt werden. */
|
||||
if (n != 4 || strcmp(w[1], "request") || strcmp(w[2], "cmd")) goto bad;
|
||||
snprintf(cfg->guard_cmd, sizeof cfg->guard_cmd, "%s", w[3]);
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(k, "spend_log")) {
|
||||
if (n != 2) goto bad;
|
||||
snprintf(cfg->spend_log, sizeof cfg->spend_log, "%s", w[1]);
|
||||
|
||||
@@ -283,6 +283,11 @@ typedef struct {
|
||||
* im Speicher, und jeder Neustart setzte ihn zurück. */
|
||||
char spend_log[J_PATH_MAX];
|
||||
|
||||
/* Wächter vor dem Weiterleiten: ein Kommando, das den Rumpf sieht und ihn
|
||||
* durchlässt (exit 0) oder ablehnt (exit != 0, stdout = Grund). junction bringt
|
||||
* keine eigene Regel mit — was durchgehen darf, entscheidet das Skript. */
|
||||
char guard_cmd[J_CMD_MAX];
|
||||
|
||||
int cache_deterministic_only; /* nur Anfragen mit Temperatur 0 zwischenspeichern */
|
||||
|
||||
int compress; /* J_COMPRESS_OFF | J_COMPRESS_TOOL */
|
||||
|
||||
+111
-3
@@ -537,6 +537,8 @@ static unsigned long g_compress_bytes_out;
|
||||
static unsigned long g_retries;
|
||||
/* Wie oft ein Request auf die Rückkehr der Kette gewartet hat, statt sofort zu scheitern. */
|
||||
static unsigned long g_offline_waits;
|
||||
/* Wie oft der Wächter eine Anfrage abgelehnt hat. */
|
||||
static unsigned long g_guard_refused;
|
||||
|
||||
/* ---------------------------------------------------------------- Spend-Log */
|
||||
/* Eine Zeile je bedienter Anfrage. Das ist die einzige Stelle, an der steht, wer
|
||||
@@ -728,12 +730,12 @@ static char *build_status(size_t *len_out)
|
||||
used += (size_t)snprintf(out + used, cap - used,
|
||||
"\"requests\":{\"ok\":%lu,\"fail\":%lu},"
|
||||
"\"retries\":{\"count\":%lu,\"num\":%d,\"backoff_s\":%.2f},"
|
||||
"\"offline_waits\":%lu,\"offline_wait_s\":%.0f,"
|
||||
"\"offline_waits\":%lu,\"offline_wait_s\":%.0f,\"guard_refused\":%lu,"
|
||||
"\"traffic\":{\"request_bytes\":%lu,\"response_bytes\":%lu},"
|
||||
"\"latency\":{\"avg_ms\":%.1f,\"samples\":%lu},"
|
||||
"\"uptime_s\":%.0f}",
|
||||
g_req_ok, g_req_fail, g_retries, CFG.retry_num, CFG.retry_backoff_s,
|
||||
g_offline_waits, CFG.offline_wait_s,
|
||||
g_offline_waits, CFG.offline_wait_s, g_guard_refused,
|
||||
g_req_bytes, g_resp_bytes,
|
||||
g_latency_n ? g_latency_ms_sum / (double)g_latency_n : -1.0, g_latency_n,
|
||||
t - g_started_at);
|
||||
@@ -791,6 +793,9 @@ static char *build_metrics(size_t *len_out)
|
||||
"# HELP junction_offline_waits_total Requests that waited for the chain to come back.\n"
|
||||
"# TYPE junction_offline_waits_total counter\n"
|
||||
"junction_offline_waits_total %lu\n"
|
||||
"# HELP junction_guard_refused_total Requests the guard script refused.\n"
|
||||
"# TYPE junction_guard_refused_total counter\n"
|
||||
"junction_guard_refused_total %lu\n"
|
||||
"# HELP junction_tokens_total Tokens reported by the upstream, by direction.\n"
|
||||
"# TYPE junction_tokens_total counter\n"
|
||||
"junction_tokens_total{direction=\"in\"} %lu\n"
|
||||
@@ -829,7 +834,7 @@ static char *build_metrics(size_t *len_out)
|
||||
"# TYPE junction_request_bytes_total counter\n"
|
||||
"junction_request_bytes_total %lu\n"
|
||||
"junction_response_bytes_total %lu\n",
|
||||
g_req_ok, g_req_fail, g_retries, g_offline_waits,
|
||||
g_req_ok, g_req_fail, g_retries, g_offline_waits, g_guard_refused,
|
||||
g_tokens_in, g_tokens_out, g_tokens_cached,
|
||||
g_cost_usd, g_cost_unknown,
|
||||
g_latency_n ? g_latency_ms_sum / (double)g_latency_n : -1.0, g_latency_n,
|
||||
@@ -1039,6 +1044,7 @@ void j_config_swap(j_config *fresh)
|
||||
memcpy(CFG.pools, fresh->pools, sizeof CFG.pools);
|
||||
CFG.balance = fresh->balance;
|
||||
snprintf(CFG.spend_log, sizeof CFG.spend_log, "%s", fresh->spend_log);
|
||||
snprintf(CFG.guard_cmd, sizeof CFG.guard_cmd, "%s", fresh->guard_cmd);
|
||||
CFG.retry_num = fresh->retry_num;
|
||||
CFG.retry_backoff_s = fresh->retry_backoff_s;
|
||||
CFG.offline_wait_s = fresh->offline_wait_s;
|
||||
@@ -1630,6 +1636,89 @@ static void send_limited(j_conn *c, int code, const char *reason, double retry_a
|
||||
(void)j_conn_write(c, body, strlen(body), err, sizeof err);
|
||||
}
|
||||
|
||||
/* Wächter: gibt den Rumpf an ein Skript und lässt es entscheiden. Der Rumpf liegt in
|
||||
* einer temporären Datei statt auf stdin — ein Skript, das nur einen Teil liest, würde
|
||||
* sonst beim Schreiben in eine volle Pipe hängen. Exit 0 = durchlassen; alles andere
|
||||
* ist eine Ablehnung, und was das Skript auf stdout sagt, ist der Grund. */
|
||||
static int guard_run(const char *cmd, const char *body, size_t len, const char *path,
|
||||
const char *model, const char *vkey, char *reason, size_t rlen)
|
||||
{
|
||||
char tmp[] = "/tmp/junction-guard-XXXXXX";
|
||||
int fd = mkstemp(tmp);
|
||||
if (fd < 0) {
|
||||
snprintf(reason, rlen, "guard_tempfile_failed");
|
||||
return -1;
|
||||
}
|
||||
size_t off = 0;
|
||||
while (off < len) {
|
||||
ssize_t w = write(fd, body + off, len - off);
|
||||
if (w <= 0) break;
|
||||
off += (size_t)w;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
int out[2];
|
||||
if (pipe(out) != 0) {
|
||||
unlink(tmp);
|
||||
snprintf(reason, rlen, "guard_pipe_failed");
|
||||
return -1;
|
||||
}
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
close(out[0]);
|
||||
close(out[1]);
|
||||
unlink(tmp);
|
||||
snprintf(reason, rlen, "guard_fork_failed");
|
||||
return -1;
|
||||
}
|
||||
if (pid == 0) {
|
||||
dup2(out[1], STDOUT_FILENO);
|
||||
dup2(out[1], STDERR_FILENO);
|
||||
close(out[0]);
|
||||
close(out[1]);
|
||||
char nbuf[32];
|
||||
setenv("JUNCTION_PATH", path ? path : "", 1);
|
||||
setenv("JUNCTION_MODEL", model ? model : "", 1);
|
||||
setenv("JUNCTION_VKEY", vkey ? vkey : "", 1);
|
||||
setenv("JUNCTION_BODY_FILE", tmp, 1);
|
||||
snprintf(nbuf, sizeof nbuf, "%zu", len);
|
||||
setenv("JUNCTION_BODY_BYTES", nbuf, 1);
|
||||
execl("/bin/sh", "sh", "-c", cmd, (char *)NULL);
|
||||
_exit(127);
|
||||
}
|
||||
close(out[1]);
|
||||
|
||||
if (rlen) reason[0] = '\0';
|
||||
size_t used = 0;
|
||||
double deadline = now_s() + 20.0;
|
||||
int status = 0;
|
||||
for (;;) {
|
||||
if (now_s() >= deadline) { kill(pid, SIGKILL); break; }
|
||||
struct pollfd p = { .fd = out[0], .events = POLLIN, .revents = 0 };
|
||||
if (poll(&p, 1, 100) > 0 && (p.revents & POLLIN)) {
|
||||
char tmpb[256];
|
||||
ssize_t n = read(out[0], tmpb, sizeof tmpb);
|
||||
if (n > 0 && rlen && used < rlen - 1) {
|
||||
size_t take = (size_t)n;
|
||||
if (take > rlen - 1 - used) take = rlen - 1 - used;
|
||||
memcpy(reason + used, tmpb, take);
|
||||
used += take;
|
||||
reason[used] = '\0';
|
||||
}
|
||||
}
|
||||
if (waitpid(pid, &status, WNOHANG) == pid) break;
|
||||
}
|
||||
close(out[0]);
|
||||
unlink(tmp);
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
|
||||
/* Leere Begründung ist keine: dann nennt junction den Exit-Code. */
|
||||
if (rlen && !reason[0])
|
||||
snprintf(reason, rlen, "guard_exit_%d", WIFEXITED(status) ? WEXITSTATUS(status) : -1);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wait_until_ready(j_endpoint *ep, const char *path, const char *model,
|
||||
long need, double retry_s, int use_hooks)
|
||||
{
|
||||
@@ -2462,6 +2551,25 @@ static void handle_client(j_conn *client)
|
||||
}
|
||||
}
|
||||
|
||||
/* Waechter vor dem Routen: was nicht durchgehen soll, soll auch keinen Endpunkt
|
||||
* belegen. Was durchgeht, entscheidet das Skript — junction bringt keine eigene
|
||||
* Inhaltsregel mit und tut auch nicht so, als haette es eine. */
|
||||
if (CFG.guard_cmd[0]) {
|
||||
char greason[512] = "";
|
||||
if (guard_run(CFG.guard_cmd, rq.body, rq.body_len, rq.path, model,
|
||||
vk ? vk->name : "", greason, sizeof greason) != 0) {
|
||||
char gbody[768], ger[512];
|
||||
json_escape(greason, ger, sizeof ger);
|
||||
snprintf(gbody, sizeof gbody,
|
||||
"{\"error\":\"guard_refused\",\"reason\":\"%s\"}", ger);
|
||||
g_guard_refused++;
|
||||
jlog("guard_refused", "path=%s model=%s reason=%s", rq.path, model, greason);
|
||||
send_simple(client, 403, "Forbidden", gbody);
|
||||
goto done;
|
||||
}
|
||||
jlog("guard_pass", "path=%s model=%s", rq.path, model);
|
||||
}
|
||||
|
||||
j_rule rule_copy;
|
||||
j_rule *rule = first_matching_rule(rq.path, model, need, ctx, has_image, &rule_copy)
|
||||
? &rule_copy : NULL;
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# Wächter vor dem Weiterleiten (guard request) — sourced von tests/run.sh.
|
||||
# Erwartet PORT, TMP, PIDS, P_GATED, contains, log_has, ok, bad, wait_port aus run.sh.
|
||||
|
||||
echo "== 30. Wächter vor dem Weiterleiten =="
|
||||
|
||||
# junction bringt keine Inhaltsregel mit: was durchgeht, entscheidet das Skript.
|
||||
# Der Rumpf liegt in einer Datei (kein stdin — ein Skript, das nur einen Teil liest,
|
||||
# würde sonst beim Schreiben in eine volle Pipe hängen).
|
||||
cat > "$TMP/guard.sh" <<'EOS'
|
||||
#!/bin/sh
|
||||
if grep -q VERBOTEN "$JUNCTION_BODY_FILE" 2>/dev/null; then
|
||||
echo "verbotenes wort im rumpf"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
EOS
|
||||
chmod +x "$TMP/guard.sh"
|
||||
|
||||
P_G=$((PORT+45))
|
||||
cat > "$TMP/guard.conf" <<CFG
|
||||
listen 127.0.0.1:$P_G
|
||||
guard request cmd $TMP/guard.sh
|
||||
endpoint gated {
|
||||
base http://127.0.0.1:$P_GATED/v1
|
||||
context 64000
|
||||
timeout 10
|
||||
idle_timeout 5
|
||||
}
|
||||
req for "*" check none pass gated
|
||||
CFG
|
||||
./junction --config "$TMP/guard.conf" > "$TMP/guard.log" 2>&1 &
|
||||
PIDS+=($!)
|
||||
wait_port $P_G 10
|
||||
|
||||
R1=$(curl -s -m 15 -X POST -H 'Content-Type: application/json' \
|
||||
-d '{"model":"m","messages":[{"role":"user","content":"das ist VERBOTEN"}]}' \
|
||||
"http://127.0.0.1:$P_G/v1/chat/completions")
|
||||
contains "$R1" "guard_refused" "the guard refuses a request it does not want"
|
||||
contains "$R1" "verbotenes wort im rumpf" "the refusal carries the script's reason"
|
||||
log_has "$TMP/guard.log" "guard_refused path=/v1/chat/completions" "the refusal is logged"
|
||||
|
||||
# Ein Skript ohne Ausgabe wird nicht als "abgelehnt, weil leer" gemeldet.
|
||||
cat > "$TMP/guard-silent.sh" <<'EOS'
|
||||
#!/bin/sh
|
||||
exit 3
|
||||
EOS
|
||||
chmod +x "$TMP/guard-silent.sh"
|
||||
P_G2=$((PORT+46))
|
||||
cat > "$TMP/guard2.conf" <<CFG
|
||||
listen 127.0.0.1:$P_G2
|
||||
guard request cmd $TMP/guard-silent.sh
|
||||
endpoint gated {
|
||||
base http://127.0.0.1:$P_GATED/v1
|
||||
context 64000
|
||||
timeout 10
|
||||
}
|
||||
req for "*" check none pass gated
|
||||
CFG
|
||||
./junction --config "$TMP/guard2.conf" > "$TMP/guard2.log" 2>&1 &
|
||||
PIDS+=($!)
|
||||
wait_port $P_G2 10
|
||||
R2=$(curl -s -m 15 -X POST -H 'Content-Type: application/json' \
|
||||
-d '{"model":"m","messages":[{"role":"user","content":"harmlos"}]}' \
|
||||
"http://127.0.0.1:$P_G2/v1/chat/completions")
|
||||
contains "$R2" "guard_exit_3" "silence is not a reason: the exit code is named"
|
||||
|
||||
# Und was durchgeht, geht durch — und wird als solches geloggt.
|
||||
R3=$(curl -s -m 15 -X POST -H 'Content-Type: application/json' \
|
||||
-d '{"model":"m","messages":[{"role":"user","content":"harmlos"}]}' \
|
||||
"http://127.0.0.1:$P_G/v1/chat/completions")
|
||||
contains "$R3" "served by GATED" "a request the guard allows is served"
|
||||
log_has "$TMP/guard.log" "guard_pass path=/v1/chat/completions" "the passed request is logged"
|
||||
|
||||
M=$(curl -s -m 5 "http://127.0.0.1:$P_G/metrics")
|
||||
contains "$M" "junction_guard_refused_total 1" "the refusal is counted in /metrics"
|
||||
S=$(curl -s -m 5 "http://127.0.0.1:$P_G/status")
|
||||
contains "$S" '"guard_refused":1' "/status counts the refusal"
|
||||
+5
-1
@@ -46,7 +46,7 @@ log_has() {
|
||||
# answer requests with somebody else's config), so fail loudly and early.
|
||||
# 8157 gehört auf dieser Maschine dem Hermes-Gateway — der Port wird von keinem
|
||||
# Test benutzt, also darf er die Suite nicht aufhalten.
|
||||
for port in 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8150 8151 8152 8153 8154 8155 8156 8158 8159 8165 8166 8167 8168 8170 8171 8172 8173 8175 8194 8176 8177 8185 8186 8187 8188 8189 8190 9443 9990 9991 9992 9993 9994 9995 9996; do
|
||||
for port in 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8150 8151 8152 8153 8154 8155 8156 8158 8159 8165 8166 8167 8168 8170 8171 8172 8173 8175 8180 8181 8194 8176 8177 8185 8186 8187 8188 8189 8190 9443 9990 9991 9992 9993 9994 9995 9996; do
|
||||
if ss -tln 2>/dev/null | grep -q ":$port "; then
|
||||
echo "port $port is busy — a leftover junction/stub is still running:"
|
||||
ss -tlnp 2>/dev/null | grep ":$port " | sed 's/^/ /'
|
||||
@@ -679,6 +679,10 @@ contains "$OUT" "bad arguments" "an impossible offpeak window is rejected"
|
||||
# shellcheck source=tests/offline-wait.sh
|
||||
. "$(dirname "$0")/offline-wait.sh"
|
||||
|
||||
# Wächter vor dem Weiterleiten.
|
||||
# shellcheck source=tests/guard.sh
|
||||
. "$(dirname "$0")/guard.sh"
|
||||
|
||||
# Kürzen von Werkzeugausgaben.
|
||||
# shellcheck source=tests/compress.sh
|
||||
. "$(dirname "$0")/compress.sh"
|
||||
|
||||
Reference in new issue
Block a user