Files
lg-smtv-mcp/deploy/lg-smtv-mcp.service
T
kiskaadee 0bf2923edb
Core Architecture & Invariant CI / validate (pull_request) Successful in 16s
chore(deploy): harden systemd unit sandboxing and add automated verify test
- flake.nix: add pkgs.systemd to testTools (nativeCheckInputs and devShell
  packages) so systemd-analyze is hermetically available in both local dev
  and isolated Nix sandbox CI (Defect 1 / CR-03)
- deploy/lg-smtv-mcp.service: add StartLimitIntervalSec=60s and StartLimitBurst=5
  in [Unit] to prevent unbounded restart loops (CR-02); add safe sandboxing
  baseline in [Service] (NoNewPrivileges, PrivateTmp, UMask=0077, ProtectSystem=full,
  kernel/bus isolation directives, CapabilityBoundingSet=) dropping offline exposure
  score from 9.0 UNSAFE to 4.9 OK (CR-02, Issue #17)
- tests/test_deploy.py: add unit tests verifying template placeholders, directive
  presence, systemd-analyze verify exit code, and security exposure score reduction
  under 5.0 (CR-03)
- README.md: document adopted hardening baseline, score reduction (9.0 -> 4.9),
  and technical compatibility constraints that ruled out ProtectHome, ProtectSystem=strict,
  and PrivateNetwork (AC1, AC4)
2026-11-17 03:07:49 -05:00

36 lines
815 B
Desktop File

[Unit]
Description=LG webOS Smart TV MCP server
Wants=network-online.target
After=network-online.target
StartLimitIntervalSec=60s
StartLimitBurst=5
[Service]
Type=simple
User=<User>
WorkingDirectory=<WorkingDirectory>
EnvironmentFile=<WorkingDirectory>/.env
Environment="PATH=<NixBinDir>:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/usr/bin/env nix develop --command python -m lg_smtv_mcp serve
Restart=on-failure
RestartSec=5s
# Sandboxing baseline (Issue #17)
NoNewPrivileges=yes
PrivateTmp=yes
UMask=0077
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectKernelLogs=yes
ProtectClock=yes
ProtectHostname=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
CapabilityBoundingSet=
[Install]
WantedBy=multi-user.target