feat(windows): WireGuard client, auto-VPN, IAM, tray enrichment, installer, CI
Second milestone of the Windows parity work (DESIGN-WINDOWS.md §13). WireGuard mesh client (signed, WSS-delivered): - wireguard_apply / wireguard_remove commands: Ed25519-verified, gated on a new wireguard capability. Linux applies via wg-quick up/down; Windows installs the peer config as a WireGuardTunnel service via wireguard.exe (/installtunnelservice, /uninstalltunnelservice) - state polling in the home monitor drives the blue tray icon and auto-VPN: connect when away from home + auto_vpn, disconnect on return (2m cooldown) - tray VPN toggle and the auto-VPN checkbox are now live; the preference persists to agent.yml (PersistAutoVPN) IAM on Windows (iam_windows.go): - allowed_login_groups -> net localgroup; ssh_keys -> per-profile authorized_keys + %ProgramData%\ssh\administrators_authorized_keys; revoke_users -> helper logs off all of the user's WTS sessions; sudo_rules logged as no direct equivalent Tray enrichment: - Open Config (opens agent.yml), Clear enrollment (re-enroll) menu items - set_auto_vpn persists; vpn_connect/vpn_disconnect/reinit/open_config commands handled by the daemon (tray_server.go) Packaging & release: - installer/windows/installer.iss: fully-offline Inno Setup bundle (agent, tray, helper, vendor-signed WireGuard MSI, OpenCredential CP, VC++ redist), /SILENT /SERVER_URL /JOIN_KEY parameters, SYSTEM service + HKLM Run tray autostart, Users-writable %ProgramData%\Theta42 for the IPC socket - .github/workflows/build-windows.yml: build + test, pinned vendor downloads, ISCC compile, Azure Trusted Signing (OIDC), SHA256SUMS, GH release attach, optional SSO resource publish - agent.yml.example documents auto_vpn, wireguard, service_name, desktop_helper, public_ip_detect Tests: - wireguard_apply/remove dispatch (allowed + capability-denied), PersistAutoVPN, ClearEnrollment; dispatch tests pin linuxPlatformOps with a temp WireGuard conf - end-to-end verified against a local mock SSO on Windows: join-key enrollment (token persisted, join key blanked), discovery/telemetry pushed, signed arbitrary_bash verified + executed via powershell -EncodedCommand; tray IPC socket binds %ProgramData%\Theta42; LDAP byte-pump binds 127.0.0.1:389; helper update swap verified Rebuilds all tracked dist binaries (v2.1.0).
This commit is contained in:
+49
-2
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -218,6 +219,47 @@ func TestHandleCommand(t *testing.T) {
|
||||
expectedStatus: "error",
|
||||
expectedCmd: nil,
|
||||
},
|
||||
{
|
||||
name: "wireguard_apply allowed",
|
||||
cfg: &Config{
|
||||
PublicKey: testPubKeyB64(),
|
||||
Capabilities: Capabilities{WireGuard: true},
|
||||
},
|
||||
msg: WSMessage{
|
||||
Type: "wireguard_apply",
|
||||
Payload: map[string]interface{}{
|
||||
"config": "[Interface]\nAddress = 10.0.0.2/32\n",
|
||||
},
|
||||
},
|
||||
signed: true,
|
||||
expectedStatus: "ok",
|
||||
expectedCmd: []string{"wg-quick", "up", "theta-mesh"},
|
||||
},
|
||||
{
|
||||
name: "wireguard_apply denied",
|
||||
cfg: &Config{
|
||||
PublicKey: testPubKeyB64(),
|
||||
Capabilities: Capabilities{WireGuard: false},
|
||||
},
|
||||
msg: WSMessage{
|
||||
Type: "wireguard_apply",
|
||||
Payload: map[string]interface{}{"config": "[Interface]\n"},
|
||||
},
|
||||
signed: true,
|
||||
expectedStatus: "error",
|
||||
expectedCmd: nil,
|
||||
},
|
||||
{
|
||||
name: "wireguard_remove allowed",
|
||||
cfg: &Config{
|
||||
PublicKey: testPubKeyB64(),
|
||||
Capabilities: Capabilities{WireGuard: true},
|
||||
},
|
||||
msg: WSMessage{Type: "wireguard_remove"},
|
||||
signed: true,
|
||||
expectedStatus: "ok",
|
||||
expectedCmd: []string{"wg-quick", "down", "theta-mesh"},
|
||||
},
|
||||
{
|
||||
name: "heartbeat_ack is silently ignored",
|
||||
cfg: &Config{
|
||||
@@ -248,9 +290,14 @@ func TestHandleCommand(t *testing.T) {
|
||||
|
||||
// The dispatch tests assert the exact command lines the Linux
|
||||
// executor produces; pin the platform ops so they behave the same
|
||||
// on any CI host (Windows included).
|
||||
// on any CI host (Windows included). A temp dir holds the WireGuard
|
||||
// config so wireguard_apply's persistence step is writable.
|
||||
prevOps := defaultPlatformOps
|
||||
defaultPlatformOps = &linuxPlatformOps{exec: mockExec}
|
||||
defaultPlatformOps = &linuxPlatformOps{
|
||||
exec: mockExec,
|
||||
tunnelName: "theta-mesh",
|
||||
confPath: filepath.Join(t.TempDir(), "theta-mesh.conf"),
|
||||
}
|
||||
defer func() { defaultPlatformOps = prevOps }()
|
||||
|
||||
msg := tc.msg
|
||||
|
||||
Reference in New Issue
Block a user