CluPilotCloud/database/factories
nexxo 0d9b62eb50 feat(vpn): ownership, a Developer role, and password-gated config retrieval
Reworked after a design consultation with Codex, which pushed back on my first
proposal in three useful ways.

Ownership and rights:
- vpn.manage split into vpn.view.all and vpn.manage.all. Seeing an access is
  not managing it, and neither is holding its private key.
- Record-level rules live in VpnPeerPolicy, not in permissions: an access
  belongs to a person, and ownership is what grants sight of it. Every operator
  reaches the page, but sees only their own unless they may see all.
- Issuing an access is not self-service — it reaches the management network, so
  it needs vpn.manage.all even for oneself.
- New Developer role: sees everything, manages nothing. Writing code does not
  imply authority over other people's access.
- kind (staff|host|system) replaces a null user_id that had to mean two
  different things at once.

Config storage, opt-in per access:
- Downloading is owner-only — explicitly NOT for view.all or manage.all. An
  admin who needs access revokes this one and issues their own, which keeps the
  record of who holds what honest.
- The password is asked on EVERY retrieval, rate-limited. Laravel's
  password.confirm keeps a 15-minute session stamp, which would authorise
  unlimited later downloads from an unattended browser.
- Stored under VPN_CONFIG_KEY, not APP_KEY: a leaked application key must not
  also hand over the management network. Purged on revocation and when a staff
  member is revoked — console taken away, tunnel left open was the worst case.
- The plaintext never enters a Livewire snapshot (the page polls every five
  seconds); the component carries an opaque handle instead.

Also: copy button works without HTTPS again (navigator.clipboard only exists in
a secure context, so over http it silently did nothing), plus config download
as a file and a QR code for the mobile apps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 22:31:54 +02:00
..
CustomerFactory.php fix: seat limit + suspend guard per Codex; harden factory email uniqueness 2026-07-25 14:53:15 +02:00
DatacenterFactory.php test: widen DatacenterFactory code space (fix faker unique() pool exhaustion) 2026-07-25 14:23:49 +02:00
HostFactory.php fix(admin): confirm maintenance delivery via MessageSent (retryable until sent); guard resend/cancel on derived state; fix flaky non-unique host wg_ip 2026-07-25 16:14:01 +02:00
InstanceFactory.php feat(engine-b): customer domain models + migrations 2026-07-25 11:38:01 +02:00
MaintenanceWindowFactory.php feat(admin): maintenance windows — schedule once, assign many hosts, notify 2026-07-25 15:53:50 +02:00
OrderFactory.php feat(engine-b): customer domain models + migrations 2026-07-25 11:38:01 +02:00
ProvisioningRunFactory.php feat(engine): core provisioning data model + hosts 2026-07-25 09:49:43 +02:00
SeatFactory.php fix: seat limit + suspend guard per Codex; harden factory email uniqueness 2026-07-25 14:53:15 +02:00
UserFactory.php feat(admin): staff RBAC (spatie) + admin settings page 2026-07-25 15:47:42 +02:00
VpnPeerFactory.php feat(vpn): ownership, a Developer role, and password-gated config retrieval 2026-07-25 22:31:54 +02:00