Przeglądaj źródła

deploy slweb 0.0.0.0

Johan Le Baut 1 tydzień temu
rodzic
commit
82a6cd461e

+ 3 - 1
README.md

@@ -147,7 +147,9 @@ Remove the service with `./scripts/deploy.sh uninstall sooperlooper`.
 
 ### SooperLooper Web interface (SLWeb)
 
-`install slweb` downloads the `tools/` directory from the SooperLooper source archive declared by `deployment.sooperlooper.source_url` and `.tag`; it does not compile or replace either SooperLooper binary. The installed tree is kept at `~/.local/share/rigforge/sooperlooper-slweb/`, including the web assets. Its user unit requires and starts after `rigforge-sooperlooper.service`, and follows that service's stop/restart lifecycle. The Python server sends OSC to `127.0.0.1:9951` and binds HTTP only to `127.0.0.1:8080`; open `http://127.0.0.1:8080/` on the Pi itself. It is not exposed to the LAN.
+`install slweb` downloads the `tools/` directory from the SooperLooper source archive declared by `deployment.sooperlooper.source_url` and `.tag`; it does not compile or replace either SooperLooper binary. The installed tree is kept at `~/.local/share/rigforge/sooperlooper-slweb/`, including the web assets. Its user unit requires and starts after `rigforge-sooperlooper.service`, and follows that service's stop/restart lifecycle. The Python server sends OSC to `127.0.0.1:9951` and binds HTTP to `0.0.0.0:8080`; open `http://<rigforge-LAN-IP>:8080/` from a device on the network.
+
+**Security:** SLWeb has no authentication. Any client that can reach port 8080 can control SooperLooper, including recording, overdubbing, muting, loading, or removing loops. Use only on a trusted, restricted network; do not forward this port to the Internet. To return to local-only access, change `deployment.slweb.http_host` to `127.0.0.1` and update validation before reinstalling.
 
 ```sh
 ./scripts/deploy.sh install slweb

+ 1 - 1
config/desired-state.yaml

@@ -79,7 +79,7 @@ deployment:
     service_destination: .config/systemd/user/rigforge-slweb.service
     user_service: rigforge-slweb.service
     python_path: /usr/bin/python3
-    http_host: 127.0.0.1
+    http_host: 0.0.0.0
     http_port: 8080
   mod_host:
     source_url: https://github.com/mod-audio/mod-host

+ 4 - 1
scripts/validate_desired_state.py

@@ -607,11 +607,14 @@ def validate_state(state):
                 ("service_destination", ".config/systemd/user/rigforge-slweb.service"),
                 ("user_service", "rigforge-slweb.service"),
                 ("python_path", "/usr/bin/python3"),
-                ("http_host", "127.0.0.1"),
                 ("http_port", 8080),
             ):
                 if slweb.get(key) != expected:
                     errors.append(f"deployment.slweb.{key} must be {expected}")
+            if slweb.get("http_host") not in ("127.0.0.1", "0.0.0.0"):
+                errors.append(
+                    "deployment.slweb.http_host must be 127.0.0.1 or 0.0.0.0"
+                )
 
         mod_host = deployment.get("mod_host")
         if not isinstance(mod_host, dict):

+ 1 - 1
tests/test_deploy.py

@@ -603,7 +603,7 @@ class DeploymentTests(unittest.TestCase):
         self.assertNotIn(f'WorkingDirectory="{installed_dir}"', unit)
         self.assertIn(
             f'ExecStart="/usr/bin/python3" tools/slweb.py --osc-host 127.0.0.1 '
-            f'--osc-port {sooperlooper["osc"]["port"]} --http-host 127.0.0.1 --http-port 8080',
+            f'--osc-port {sooperlooper["osc"]["port"]} --http-host 0.0.0.0 --http-port 8080',
             unit,
         )
         self.assertEqual(

+ 5 - 2
tests/test_desired_state.py

@@ -198,8 +198,11 @@ class DesiredStateValidationTests(unittest.TestCase):
         self.assertTrue(any("source_url must match" in error for error in validate_state(state)))
 
         state = copy.deepcopy(self.state)
-        state["deployment"]["slweb"]["http_host"] = "0.0.0.0"
-        self.assertIn("deployment.slweb.http_host must be 127.0.0.1", validate_state(state))
+        state["deployment"]["slweb"]["http_host"] = "192.168.1.42"
+        self.assertIn(
+            "deployment.slweb.http_host must be 127.0.0.1 or 0.0.0.0",
+            validate_state(state),
+        )
 
         state = copy.deepcopy(self.state)
         state["deployment"]["slweb"]["http_port"] = 8081