susops 3.0.0rc4.dev2__tar.gz → 3.0.0rc5.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/PKG-INFO +18 -6
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/README.md +17 -5
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/pyproject.toml +1 -1
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/client.py +24 -2
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/config.py +10 -18
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/pac.py +12 -2
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/services_daemon.py +8 -4
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/ssh.py +35 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/facade.py +237 -169
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/screens/dashboard.py +18 -2
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops.egg-info/PKG-INFO +18 -6
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_client.py +26 -6
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_config.py +37 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_facade.py +150 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_pac.py +24 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_services_daemon.py +50 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/LICENSE +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/setup.cfg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/__init__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icon.png +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/dark/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/dark/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/dark/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/dark/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/light/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/light/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/light/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_glasses/light/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/dark/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/dark/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/dark/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/dark/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/light/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/light/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/light/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/colored_s/light/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/dark/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/dark/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/dark/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/dark/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/light/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/light/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/light/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/gear/light/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/status/error.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/status/running.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/status/stopped.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/assets/icons/status/stopped_partially.svg +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/__init__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/browsers.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/log_style.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/ports.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/process.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/rpc_protocol.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/rpc_server.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/share.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/socat.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/ssh_config.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/status.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/core/types.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tray/__init__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tray/base.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tray/linux.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tray/mac.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/__init__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/__main__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/app.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/app.tcss +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/cli.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/screens/__init__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/screens/connections.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/screens/shares.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/widgets/__init__.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/tui/widgets/connection_card.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops/version.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops.egg-info/SOURCES.txt +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops.egg-info/dependency_links.txt +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops.egg-info/entry_points.txt +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops.egg-info/requires.txt +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/src/susops.egg-info/top_level.txt +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_bw_totals.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_cli.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_conftest_smoke.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_openapi.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_packaging.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_process.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_rpc_protocol.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_rpc_server.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_scripts.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_share.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_share_aiohttp.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_socat.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_ssh.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_status.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_update_homebrew_sha.py +0 -0
- {susops-3.0.0rc4.dev2 → susops-3.0.0rc5.dev1}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: susops
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0rc5.dev1
|
|
4
4
|
Summary: SusOps — SSH SOCKS5 proxy manager with PAC server, Textual TUI, and system tray apps
|
|
5
5
|
License: MIT
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -315,7 +315,7 @@ susops
|
|
|
315
315
|
|
|
316
316
|
### Screens
|
|
317
317
|
|
|
318
|
-
**Dashboard** (default) — split-pane view. Left sidebar shows all connections (status dot, SOCKS port, live throughput), PAC server status, and active file shares. Right panel is tabbed:
|
|
318
|
+
**Dashboard** (default) — split-pane view. Left sidebar shows all connections (status dot — `●` green running, `◐` orange pending, `○` dim stopped — SOCKS port, live throughput), PAC server status, and active file shares. Right panel is tabbed:
|
|
319
319
|
- **Stats** — CPU%, memory, active connections, PID for the selected connection
|
|
320
320
|
- **Bandwidth** — live RX and TX line charts (PlotextPlot, 60-sample rolling window, auto-scaled units)
|
|
321
321
|
- **Forwards** — DataTable of all port forwards (direction, local port, local bind, remote port, remote bind, label)
|
|
@@ -436,9 +436,11 @@ susops reset [--force] # Kill all processes, wipe ~/.susops workspace
|
|
|
436
436
|
|------|---------|
|
|
437
437
|
| `0` | Success / all running |
|
|
438
438
|
| `1` | Error |
|
|
439
|
-
| `2` | Partial (some services stopped) |
|
|
439
|
+
| `2` | Partial (some services stopped, or any connection pending) |
|
|
440
440
|
| `3` | All stopped |
|
|
441
441
|
|
|
442
|
+
A connection is **pending** when its SSH master is alive but the ControlMaster socket isn't up yet — typically while ssh-agent is waiting on a key unlock, or between reconnect attempts. `start` returns as soon as the master spawns; auth then completes asynchronously up to 60 s later. Slow agent prompts (Vaultwarden, 1Password, hardware keys) no longer freeze the UI.
|
|
443
|
+
|
|
442
444
|
---
|
|
443
445
|
|
|
444
446
|
## System Tray
|
|
@@ -461,7 +463,7 @@ susops-tray
|
|
|
461
463
|
|
|
462
464
|
Requires `rumps`: `pip install "susops[tray-mac]"`
|
|
463
465
|
|
|
464
|
-
The tray icon reflects the current state (running/partial/stopped). State changes arrive over the daemon's SSE `/events` stream. If the stream drops, the listener reconnects within at most 5 seconds. Both tray implementations support the same feature set via native dialogs:
|
|
466
|
+
The tray icon reflects the current state (running / partial-or-pending / stopped). State changes arrive over the daemon's SSE `/events` stream. If the stream drops, the listener reconnects within at most 5 seconds. When TUI + tray are both attached to the same daemon, quitting one keeps the other running — `stop_on_quit` is skipped if any other frontend is still connected. Both tray implementations support the same feature set via native dialogs:
|
|
465
467
|
|
|
466
468
|
- **Manage** — toggle connection/PAC host/forward enabled state; start, stop, or restart a specific connection
|
|
467
469
|
- **Start / Stop / Restart All** — bulk lifecycle operations across all connections
|
|
@@ -552,7 +554,11 @@ Both can be `true` simultaneously — susops will start an SSH slave for TCP and
|
|
|
552
554
|
|
|
553
555
|
### Port assignment
|
|
554
556
|
|
|
555
|
-
Ports default to `0` (auto-assign). SusOps picks a random free port from the ephemeral range (49152–65535) at start time and saves it back to `config.yaml`. Pass a specific port to `add-connection` or set it in the config to pin it.
|
|
557
|
+
Ports default to `0` (auto-assign). SusOps picks a random free port from the ephemeral range (49152–65535) at start time and saves it back to `config.yaml`. Pass a specific port to `add-connection` or set it in the config to pin it. Ports outside `1–65535` are rejected on `add`.
|
|
558
|
+
|
|
559
|
+
### Tag format
|
|
560
|
+
|
|
561
|
+
Connection tags must match `[A-Za-z0-9][A-Za-z0-9._-]{0,63}` (no slashes, no `..`, no leading punctuation). Tags appear in PID-file names, socket paths, log lines, and PAC keys, so the format is intentionally strict.
|
|
556
562
|
|
|
557
563
|
### Workspace
|
|
558
564
|
|
|
@@ -860,6 +866,12 @@ susops
|
|
|
860
866
|
# Run the CLI
|
|
861
867
|
susops ps
|
|
862
868
|
susops ls
|
|
869
|
+
|
|
870
|
+
# Build local pypi + brew artifacts (mirrors CI, no upload)
|
|
871
|
+
scripts/build-local.sh pypi # wheel + sdist
|
|
872
|
+
scripts/build-local.sh brew # SusOps.app + .dmg (macOS only)
|
|
873
|
+
scripts/build-local.sh install-pypi # install wheel into a throwaway venv
|
|
874
|
+
scripts/build-local.sh install-brew # copy SusOps.app to /Applications
|
|
863
875
|
```
|
|
864
876
|
|
|
865
877
|
### Project layout
|
|
@@ -937,7 +949,7 @@ brew tap mashb1t/susops
|
|
|
937
949
|
brew install susops
|
|
938
950
|
```
|
|
939
951
|
|
|
940
|
-
The formula at `packaging/homebrew/Formula/susops.rb` uses `virtualenv_install_with_resources` to create an isolated Python environment
|
|
952
|
+
The formula at `packaging/homebrew/Formula/susops.rb` uses `virtualenv_install_with_resources` to create an isolated Python environment for the CLI + TUI. The cask at `packaging/homebrew/Casks/susops.rb` installs `SusOps.app` (PyInstaller bundle) for the macOS tray — `brew install --cask susops`.
|
|
941
953
|
|
|
942
954
|
**Note:** Resource sha256 checksums in the formula must be updated for each release. Generate them with:
|
|
943
955
|
|
|
@@ -291,7 +291,7 @@ susops
|
|
|
291
291
|
|
|
292
292
|
### Screens
|
|
293
293
|
|
|
294
|
-
**Dashboard** (default) — split-pane view. Left sidebar shows all connections (status dot, SOCKS port, live throughput), PAC server status, and active file shares. Right panel is tabbed:
|
|
294
|
+
**Dashboard** (default) — split-pane view. Left sidebar shows all connections (status dot — `●` green running, `◐` orange pending, `○` dim stopped — SOCKS port, live throughput), PAC server status, and active file shares. Right panel is tabbed:
|
|
295
295
|
- **Stats** — CPU%, memory, active connections, PID for the selected connection
|
|
296
296
|
- **Bandwidth** — live RX and TX line charts (PlotextPlot, 60-sample rolling window, auto-scaled units)
|
|
297
297
|
- **Forwards** — DataTable of all port forwards (direction, local port, local bind, remote port, remote bind, label)
|
|
@@ -412,9 +412,11 @@ susops reset [--force] # Kill all processes, wipe ~/.susops workspace
|
|
|
412
412
|
|------|---------|
|
|
413
413
|
| `0` | Success / all running |
|
|
414
414
|
| `1` | Error |
|
|
415
|
-
| `2` | Partial (some services stopped) |
|
|
415
|
+
| `2` | Partial (some services stopped, or any connection pending) |
|
|
416
416
|
| `3` | All stopped |
|
|
417
417
|
|
|
418
|
+
A connection is **pending** when its SSH master is alive but the ControlMaster socket isn't up yet — typically while ssh-agent is waiting on a key unlock, or between reconnect attempts. `start` returns as soon as the master spawns; auth then completes asynchronously up to 60 s later. Slow agent prompts (Vaultwarden, 1Password, hardware keys) no longer freeze the UI.
|
|
419
|
+
|
|
418
420
|
---
|
|
419
421
|
|
|
420
422
|
## System Tray
|
|
@@ -437,7 +439,7 @@ susops-tray
|
|
|
437
439
|
|
|
438
440
|
Requires `rumps`: `pip install "susops[tray-mac]"`
|
|
439
441
|
|
|
440
|
-
The tray icon reflects the current state (running/partial/stopped). State changes arrive over the daemon's SSE `/events` stream. If the stream drops, the listener reconnects within at most 5 seconds. Both tray implementations support the same feature set via native dialogs:
|
|
442
|
+
The tray icon reflects the current state (running / partial-or-pending / stopped). State changes arrive over the daemon's SSE `/events` stream. If the stream drops, the listener reconnects within at most 5 seconds. When TUI + tray are both attached to the same daemon, quitting one keeps the other running — `stop_on_quit` is skipped if any other frontend is still connected. Both tray implementations support the same feature set via native dialogs:
|
|
441
443
|
|
|
442
444
|
- **Manage** — toggle connection/PAC host/forward enabled state; start, stop, or restart a specific connection
|
|
443
445
|
- **Start / Stop / Restart All** — bulk lifecycle operations across all connections
|
|
@@ -528,7 +530,11 @@ Both can be `true` simultaneously — susops will start an SSH slave for TCP and
|
|
|
528
530
|
|
|
529
531
|
### Port assignment
|
|
530
532
|
|
|
531
|
-
Ports default to `0` (auto-assign). SusOps picks a random free port from the ephemeral range (49152–65535) at start time and saves it back to `config.yaml`. Pass a specific port to `add-connection` or set it in the config to pin it.
|
|
533
|
+
Ports default to `0` (auto-assign). SusOps picks a random free port from the ephemeral range (49152–65535) at start time and saves it back to `config.yaml`. Pass a specific port to `add-connection` or set it in the config to pin it. Ports outside `1–65535` are rejected on `add`.
|
|
534
|
+
|
|
535
|
+
### Tag format
|
|
536
|
+
|
|
537
|
+
Connection tags must match `[A-Za-z0-9][A-Za-z0-9._-]{0,63}` (no slashes, no `..`, no leading punctuation). Tags appear in PID-file names, socket paths, log lines, and PAC keys, so the format is intentionally strict.
|
|
532
538
|
|
|
533
539
|
### Workspace
|
|
534
540
|
|
|
@@ -836,6 +842,12 @@ susops
|
|
|
836
842
|
# Run the CLI
|
|
837
843
|
susops ps
|
|
838
844
|
susops ls
|
|
845
|
+
|
|
846
|
+
# Build local pypi + brew artifacts (mirrors CI, no upload)
|
|
847
|
+
scripts/build-local.sh pypi # wheel + sdist
|
|
848
|
+
scripts/build-local.sh brew # SusOps.app + .dmg (macOS only)
|
|
849
|
+
scripts/build-local.sh install-pypi # install wheel into a throwaway venv
|
|
850
|
+
scripts/build-local.sh install-brew # copy SusOps.app to /Applications
|
|
839
851
|
```
|
|
840
852
|
|
|
841
853
|
### Project layout
|
|
@@ -913,7 +925,7 @@ brew tap mashb1t/susops
|
|
|
913
925
|
brew install susops
|
|
914
926
|
```
|
|
915
927
|
|
|
916
|
-
The formula at `packaging/homebrew/Formula/susops.rb` uses `virtualenv_install_with_resources` to create an isolated Python environment
|
|
928
|
+
The formula at `packaging/homebrew/Formula/susops.rb` uses `virtualenv_install_with_resources` to create an isolated Python environment for the CLI + TUI. The cask at `packaging/homebrew/Casks/susops.rb` installs `SusOps.app` (PyInstaller bundle) for the macOS tray — `brew install --cask susops`.
|
|
917
929
|
|
|
918
930
|
**Note:** Resource sha256 checksums in the formula must be updated for each release. Generate them with:
|
|
919
931
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "susops"
|
|
7
|
-
version = "3.0.0-
|
|
7
|
+
version = "3.0.0-rc5.dev1"
|
|
8
8
|
description = "SusOps — SSH SOCKS5 proxy manager with PAC server, Textual TUI, and system tray apps"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -60,16 +60,38 @@ def _read_port(workspace: Path) -> int | None:
|
|
|
60
60
|
return None
|
|
61
61
|
|
|
62
62
|
|
|
63
|
+
def _pid_is_susops_daemon(pid: int) -> bool:
|
|
64
|
+
"""True only if PID belongs to a live process whose cmdline matches a
|
|
65
|
+
services_daemon invocation. Defends against PID reuse: SIGKILLing the
|
|
66
|
+
daemon under load can let an ssh fork (or any other short-lived child)
|
|
67
|
+
inherit the freed PID, and a bare `os.kill(pid, 0)` liveness probe
|
|
68
|
+
would then falsely report the daemon as up.
|
|
69
|
+
"""
|
|
70
|
+
try:
|
|
71
|
+
import psutil
|
|
72
|
+
except ImportError:
|
|
73
|
+
try:
|
|
74
|
+
os.kill(pid, 0)
|
|
75
|
+
return True
|
|
76
|
+
except (OSError, ValueError):
|
|
77
|
+
return False
|
|
78
|
+
try:
|
|
79
|
+
proc = psutil.Process(pid)
|
|
80
|
+
cmdline = " ".join(proc.cmdline())
|
|
81
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
82
|
+
return False
|
|
83
|
+
return "susops.core.services_daemon" in cmdline or "susops-services" in cmdline
|
|
84
|
+
|
|
85
|
+
|
|
63
86
|
def _is_daemon_alive(workspace: Path) -> bool:
|
|
64
87
|
pid_file = _pid_path(workspace)
|
|
65
88
|
if not pid_file.exists():
|
|
66
89
|
return False
|
|
67
90
|
try:
|
|
68
91
|
pid = int(pid_file.read_text().strip())
|
|
69
|
-
os.kill(pid, 0) # signal 0 = liveness probe
|
|
70
|
-
return True
|
|
71
92
|
except (OSError, ValueError):
|
|
72
93
|
return False
|
|
94
|
+
return _pid_is_susops_daemon(pid)
|
|
73
95
|
|
|
74
96
|
|
|
75
97
|
def ensure_daemon_running(workspace: Path = _WORKSPACE_DEFAULT) -> int:
|
|
@@ -193,39 +193,32 @@ def save_config(config: SusOpsConfig, workspace: Path = WORKSPACE_DEFAULT) -> No
|
|
|
193
193
|
clicks.
|
|
194
194
|
"""
|
|
195
195
|
import os
|
|
196
|
+
import tempfile
|
|
196
197
|
path = get_config_path(workspace)
|
|
197
198
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
198
199
|
yaml = YAML()
|
|
199
200
|
yaml.default_flow_style = False
|
|
200
201
|
yaml.indent(mapping=2, sequence=4, offset=2)
|
|
201
|
-
# Convert to plain dict via model_dump, then save
|
|
202
202
|
data = config.model_dump(mode='python')
|
|
203
|
-
# Convert enums to their values for serialization
|
|
204
203
|
data['susops_app']['logo_style'] = config.susops_app.logo_style.value
|
|
205
|
-
# Compute the target mode BEFORE writing: preserve any user-set restrictive
|
|
206
|
-
# permissions (e.g. chmod 600 on a hardened install) since Path.replace()
|
|
207
|
-
# would otherwise clobber them with the temp file's umask-derived mode.
|
|
208
|
-
# New configs default to 0o600 — the file holds share passwords.
|
|
209
204
|
try:
|
|
210
205
|
target_mode = path.stat().st_mode & 0o777
|
|
211
206
|
except OSError:
|
|
212
207
|
target_mode = 0o600
|
|
213
|
-
#
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
|
|
208
|
+
# Unique tmp file per call so concurrent saves (rapid TUI start/stop runs
|
|
209
|
+
# each handler in its own executor thread) don't fight over the same name
|
|
210
|
+
# and crash on tmp.replace(path) after a peer already renamed it away.
|
|
211
|
+
fd, tmp_name = tempfile.mkstemp(
|
|
212
|
+
prefix=path.name + ".",
|
|
213
|
+
suffix=".tmp",
|
|
214
|
+
dir=str(path.parent),
|
|
215
|
+
)
|
|
216
|
+
tmp_path = Path(tmp_name)
|
|
217
217
|
try:
|
|
218
|
-
fd = os.open(
|
|
219
|
-
str(tmp_path),
|
|
220
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
|
|
221
|
-
target_mode,
|
|
222
|
-
)
|
|
223
218
|
try:
|
|
224
219
|
with os.fdopen(fd, 'w') as f:
|
|
225
220
|
yaml.dump(data, f)
|
|
226
221
|
except Exception:
|
|
227
|
-
# fdopen owns fd on success; on failure we may need to close it
|
|
228
|
-
# if fdopen never took ownership. Best-effort.
|
|
229
222
|
try:
|
|
230
223
|
os.close(fd)
|
|
231
224
|
except OSError:
|
|
@@ -235,7 +228,6 @@ def save_config(config: SusOpsConfig, workspace: Path = WORKSPACE_DEFAULT) -> No
|
|
|
235
228
|
os.chmod(tmp_path, target_mode)
|
|
236
229
|
tmp_path.replace(path)
|
|
237
230
|
except Exception:
|
|
238
|
-
# Best-effort cleanup of the temp file if writing failed.
|
|
239
231
|
try:
|
|
240
232
|
tmp_path.unlink(missing_ok=True)
|
|
241
233
|
except Exception:
|
|
@@ -134,10 +134,20 @@ class PacServer:
|
|
|
134
134
|
def start(self, port: int, pac_path: Path) -> None:
|
|
135
135
|
"""Start the PAC HTTP server on the given port.
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
No-op if already running on the same port (parallel start() callers
|
|
138
|
+
race here — facade's check-then-act on is_running() can let multiple
|
|
139
|
+
threads through). Raises RuntimeError if the port is in use by
|
|
140
|
+
something else.
|
|
138
141
|
"""
|
|
139
142
|
if self._server is not None:
|
|
140
|
-
|
|
143
|
+
if self._port == port:
|
|
144
|
+
# Same port + already up: caller's intent is already satisfied.
|
|
145
|
+
self._pac_path = pac_path
|
|
146
|
+
return
|
|
147
|
+
raise RuntimeError(
|
|
148
|
+
f"PAC server already running on port {self._port}, "
|
|
149
|
+
f"refusing to also bind {port}"
|
|
150
|
+
)
|
|
141
151
|
|
|
142
152
|
self._pac_path = pac_path
|
|
143
153
|
|
|
@@ -86,17 +86,21 @@ def _preflight(workspace: Path, log: "logging.Logger") -> None:
|
|
|
86
86
|
# Won the race uncontested.
|
|
87
87
|
pass
|
|
88
88
|
else:
|
|
89
|
-
# File exists. Is the holder alive?
|
|
89
|
+
# File exists. Is the holder alive AND actually our daemon?
|
|
90
|
+
# PID reuse (an ssh fork inheriting the freed PID after we kill -9
|
|
91
|
+
# the daemon) would otherwise wedge us in a refusal loop until the
|
|
92
|
+
# impostor exits. Reuse the same identity check the client does.
|
|
90
93
|
pid_file = _pid_path(workspace)
|
|
91
94
|
try:
|
|
92
95
|
existing_pid = int(pid_file.read_text().strip())
|
|
93
|
-
os.kill(existing_pid, 0) # liveness probe
|
|
94
96
|
except (OSError, ValueError):
|
|
95
|
-
|
|
97
|
+
existing_pid = None
|
|
98
|
+
from susops.client import _pid_is_susops_daemon
|
|
99
|
+
if existing_pid is None or not _pid_is_susops_daemon(existing_pid):
|
|
100
|
+
# Stale (or impostor) PID file. Remove + retry the atomic claim.
|
|
96
101
|
pid_file.unlink(missing_ok=True)
|
|
97
102
|
_port_path(workspace).unlink(missing_ok=True)
|
|
98
103
|
if not _claim_pid_file(workspace):
|
|
99
|
-
# Some other daemon claimed it between our cleanup and retry.
|
|
100
104
|
log.error(
|
|
101
105
|
"another susops-services daemon raced us to start. "
|
|
102
106
|
"Try again — or run "
|
|
@@ -8,6 +8,7 @@ Architecture:
|
|
|
8
8
|
"""
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
+
import os
|
|
11
12
|
import subprocess
|
|
12
13
|
import time
|
|
13
14
|
from pathlib import Path
|
|
@@ -249,9 +250,43 @@ def stop_tunnel(
|
|
|
249
250
|
except (subprocess.TimeoutExpired, FileNotFoundError, OSError):
|
|
250
251
|
pass
|
|
251
252
|
|
|
253
|
+
# Last-resort sweep for orphan masters bound to our socket path.
|
|
254
|
+
# Under parallel start/stop the PID file can race (start writes PID Y while
|
|
255
|
+
# stop reads stale PID X, or the reconnect monitor spawns M2 between the
|
|
256
|
+
# read and the kill), leaving an ssh -N -T -D ... ControlPath=...sock
|
|
257
|
+
# process alive until its own keepalive timeout fires ~60s later.
|
|
258
|
+
if workspace is not None:
|
|
259
|
+
_sweep_orphan_masters(tag, workspace)
|
|
260
|
+
|
|
252
261
|
return stopped
|
|
253
262
|
|
|
254
263
|
|
|
264
|
+
def _sweep_orphan_masters(tag: str, workspace: Path) -> None:
|
|
265
|
+
"""Kill any ssh process whose argv references our ControlPath socket but
|
|
266
|
+
that ProcessManager isn't tracking. No-op if psutil is unavailable.
|
|
267
|
+
"""
|
|
268
|
+
try:
|
|
269
|
+
import psutil
|
|
270
|
+
except ImportError:
|
|
271
|
+
return
|
|
272
|
+
sock_str = str(socket_path(tag, workspace))
|
|
273
|
+
try:
|
|
274
|
+
own_pid = os.getpid()
|
|
275
|
+
except Exception:
|
|
276
|
+
own_pid = -1
|
|
277
|
+
for proc in psutil.process_iter(["pid", "name", "cmdline"]):
|
|
278
|
+
try:
|
|
279
|
+
if proc.info["pid"] == own_pid:
|
|
280
|
+
continue
|
|
281
|
+
if proc.info.get("name") != "ssh":
|
|
282
|
+
continue
|
|
283
|
+
cmdline = proc.info.get("cmdline") or []
|
|
284
|
+
if any(sock_str in arg for arg in cmdline):
|
|
285
|
+
proc.kill()
|
|
286
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
287
|
+
continue
|
|
288
|
+
|
|
289
|
+
|
|
255
290
|
def is_tunnel_running(tag: str, process_mgr: ProcessManager) -> bool:
|
|
256
291
|
"""Return True if the ControlMaster SSH process for tag is currently running."""
|
|
257
292
|
return process_mgr.is_running(_master_name(tag))
|