Commit Graph

316 Commits

Author SHA1 Message Date
rcourtman
7926524a29 fix(build): use indexed arrays for POSIX shell compatibility
Replace bash associative arrays with parallel indexed arrays to ensure
the build script works on systems with older bash versions or when run
under /bin/sh.

Changes:
- Replace host_agent_builds associative array with host_agent_envs indexed array
- Replace builds associative array with build_envs indexed array
- Add array length validation to catch config mismatches early
- Use index-based iteration instead of key-based lookup
2026-02-01 23:26:51 +00:00
rcourtman
9b0fb527f5 feat(patrol): implement patrol findings, evaluation, and investigation logic
- Add core Patrol system for automated investigations
- Implement findings management and deduplication logic
- Add evaluation framework (patrol_eval) with quality assertions and scenarios
- Add patrol-specific tools and executor integration
- Add E2E test matrix script
2026-01-31 16:23:08 +00:00
rcourtman
ac97418159 chore: add evaluation scripts, CI workflow and dev tooling 2026-01-30 19:00:48 +00:00
rcourtman
17208cbf9d docs: update AI evaluation matrix and approval workflow documentation 2026-01-30 19:00:40 +00:00
rcourtman
6873913e64 fix: install script and docs improvements
- Fixed --disable-docker not being passed to systemd service file. Related to #1151
- Added init: true requirement to HTTPS/TLS docs for Docker. Related to #1166
2026-01-26 20:48:57 +00:00
rcourtman
4c19fa3c1b fix: resolve btrfs disk summing (#1158), podman disable flag (#1151), and diagnostics path (#1155) 2026-01-23 19:24:38 +00:00
rcourtman
66e8460196 chore: update dev scripts and mock configuration
- Improve hot-dev script
- Add sync-production-config script
- Update toggle-mock script
- Update mock environment
2026-01-22 22:32:45 +00:00
rcourtman
85f171290b Support: Add Kubernetes monitoring options to agent installers
- Added --kube-include-all-pods and --kube-include-all-deployments flags
- Added --help support to install.sh
- Moved root check in install.sh to allow viewing help as non-root
2026-01-22 16:41:40 +00:00
rcourtman
351bd0539e feat(dev): add file backup watcher status to dev-check 2026-01-22 14:27:14 +00:00
rcourtman
c743bd2c30 feat(dev): add optional file backup watcher to hot-dev
When scripts/watch-backup.sh exists (gitignored, local only), hot-dev
automatically starts a file watcher that backs up source files on every
save to ~/.pulse-backups/. Protects against accidental data loss from
git checkout or other mishaps, regardless of what tool makes the change.
2026-01-22 14:25:21 +00:00
rcourtman
2e0da42a81 chore: reliability and maintenance improvements
Host agent:
- Add SHA256 checksum verification for downloaded binaries
- Verify checksum file matches expected bundle filename

WebSocket:
- Add write failure tracking with graceful disconnection
- Increase write deadline to 30s for large state payloads
- Better handling for slow clients (Raspberry Pi, slow networks)

Monitoring:
- Remove unused temperature proxy imports
- Add monitor polling improvements
- Expand test coverage

Other:
- Update package.json dependencies
- Fix generate-release-notes.sh path handling
- Minor reporting engine cleanup
2026-01-22 00:45:04 +00:00
rcourtman
222c88f33c chore: Mac-compatible dev scripts
- hot-dev.sh: Fix hostname -I for macOS, use ifconfig instead
- hot-dev.sh: Fix PULSE_AUDIT_DIR for mock mode
- hot-dev.sh: Use PULSE_REPOS_DIR for Pro module detection
- dev-check.sh: Fix pgrep -c (not supported on macOS)
- dev-check.sh: Use /tmp/pulse-debug.log on macOS instead of journalctl
- Update internal/api docs to use env var paths
2026-01-22 00:30:15 +00:00
rcourtman
98d5a5684a chore(scripts): update build and install scripts
- build-release.sh: remove sensor proxy binary build
- install-docker.sh: simplify agent installation
- hot-dev.sh, cleanup.sh: remove proxy references
- validate-release.sh: update validation checks
2026-01-21 12:02:03 +00:00
rcourtman
d4a6c0d2e8 refactor: remove legacy pulse-sensor-proxy temperature monitoring
The sensor proxy approach for temperature monitoring has been superseded
by the unified agent architecture where host agents report temperature
data directly. This removes:

- cmd/pulse-sensor-proxy/ - standalone proxy daemon
- internal/tempproxy/ - client library
- internal/api/*temperature_proxy* - API handlers and tests
- internal/api/sensor_proxy_gate* - feature gate
- internal/monitoring/*proxy_test* - proxy-specific tests
- scripts/*sensor-proxy* - installation and management scripts
- security/apparmor/, security/seccomp/ - proxy security profiles

Temperature monitoring remains available via the unified agent approach.
2026-01-21 11:59:04 +00:00
rcourtman
56ea5d6493 feat: add verified bug fix detection to release notes
Finds commits referencing GitHub issues (#xxx) and verifies the
fix is still present in the final diff before including it.
This prevents mentioning features/fixes that were later reverted.
2026-01-20 22:29:05 +00:00
rcourtman
ce51b731d7 fix: auto-load Anthropic key from local secrets file 2026-01-20 22:19:09 +00:00
rcourtman
3cf96eb068 refactor: use code diffs instead of commit messages for release notes
The previous approach used commit messages which could include changes
that were later reverted. Now the script analyzes actual git diffs
between versions to identify user-facing changes.

Extracts diffs from:
- API handlers (new endpoints)
- Frontend components (new features)
- Config options (new settings)
- Alerts/notifications (webhook changes)
- Agent code (host/docker features)
- Install scripts

Passes structured diffs to LLM with instructions to write plain,
factual release notes without marketing language.
2026-01-20 22:13:38 +00:00
rcourtman
c48d15ccbd fix: Agent install URL case-sensitivity and nohup compatibility. Related to #1129, #1132
- Make URL validation case-insensitive to accept Http://, HTTP://, etc.
- Replace nohup with shell backgrounding for QNAP platform compatibility
- Add disown for SIGHUP protection where available

fix: AI chat mobile responsiveness. Related to #1131

- Use responsive width (full on mobile, 480px on larger screens)
- Add flex-wrap to header for better mobile layout
2026-01-20 21:36:14 +00:00
rcourtman
e5eb4517db fix: remove duplicate else in trigger-release.sh 2026-01-20 17:26:26 +00:00
rcourtman
fe3857f6ec chore(scripts): Remove OpenCode sidecar references from dev scripts
dev-check.sh:
- Remove OpenCode process detection and kill commands
- Remove MCP connection status checks
- OpenCode sidecar no longer used

hot-dev.sh:
- Remove pulse-sensor-proxy socket detection (deprecated)
- Remove OpenCode sidecar cleanup commands
- Remove PULSE_USE_OPENCODE environment variable
- Add self-restart check for script changes
- Simplify startup by removing sidecar dependencies

The native chat service (internal/ai/chat) handles AI directly
without needing an external OpenCode subprocess.
2026-01-19 19:22:25 +00:00
rcourtman
2c4d7edf58 feat(install): add watchdog restart loop for Unraid agents
Implements exponential backoff restart loop in the wrapper script
for Unraid/Slackware installations. When the agent exits unexpectedly,
it will automatically restart with increasing delays (5s -> 60s max).

This improves reliability for users who don't have systemd for
automatic service restarts.
2026-01-17 14:41:59 +00:00
rcourtman
035436ad6e fix: add mutex to prevent concurrent map writes in Docker agent CPU tracking
The agent was crashing with 'fatal error: concurrent map writes' when
handleCheckUpdatesCommand spawned a goroutine that called collectOnce
concurrently with the main collection loop. Both code paths access
a.prevContainerCPU without synchronization.

Added a.cpuMu mutex to protect all accesses to prevContainerCPU in:
- pruneStaleCPUSamples()
- collectContainer() delete operation
- calculateContainerCPUPercent()

Related to #1063
2026-01-15 21:10:55 +00:00
rcourtman
8c7581d32c feat(profiles): add AI-assisted profile suggestions
Add ability for users to describe what kind of agent profile they need
in natural language, and have AI generate a suggestion with name,
description, config values, and rationale.

- Add ProfileSuggestionHandler with schema-aware prompting
- Add SuggestProfileModal component with example prompts
- Update AgentProfilesPanel with suggest button and description field
- Streamline ValidConfigKeys to only agent-supported settings
- Update profile validation tests for simplified schema
2026-01-15 13:24:18 +00:00
rcourtman
e6a658a04d docs(ui): clarify kiosk mode usage in token preset description
Update the "Kiosk / Dashboard" token preset description to mention
the ?kiosk=1 URL parameter that hides navigation and filter panels,
making it clearer how to set up a wall display.

Addresses feedback from #1102
2026-01-13 23:46:34 +00:00
rcourtman
9cd53814a3 feat(alerts): add per-volume disk thresholds for host agents
Allow users to set custom disk usage thresholds per mounted filesystem
on host agents, rather than applying a single threshold to all volumes.

This addresses NAS/NVR use cases where some volumes (e.g., NVR storage)
intentionally run at 99% while others need strict monitoring.

Backend:
- Check for disk-specific overrides before using HostDefaults.Disk
- Override key format: host:<hostId>/disk:<mountpoint>
- Support both custom thresholds and disable per-disk

Frontend:
- Add 'hostDisk' resource type
- Add "Host Disks" collapsible section in Thresholds → Hosts tab
- Group disks by host for easier navigation

Closes #1103
2026-01-13 23:38:20 +00:00
rcourtman
2246aee35f chore: replace 'enterprise' terminology with 'Pro' in hot-dev docs 2026-01-10 12:55:02 +00:00
rcourtman
668cdf3393 feat(license): add audit_logging, advanced_sso, advanced_reporting to Pro tier
Major changes:
- Add audit_logging, advanced_sso, advanced_reporting features to Pro tier
- Persist session username for RBAC authorization after restart
- Add hot-dev auto-detection for pulse-pro binary (enables SQLite audit logging)

Frontend improvements:
- Replace isEnterprise() with hasFeature() for granular feature gating
- Update AuditLogPanel, OIDCPanel, RolesPanel, UserAssignmentsPanel, AISettings
- Update AuditWebhookPanel to use hasFeature('audit_logging')

Backend changes:
- Session store now persists and restores username field
- Update CreateSession/CreateOIDCSession to accept username parameter
- GetSessionUsername falls back to persisted username after restart

Testing:
- Update license_test.go to reflect Pro tier feature changes
- Update session tests for new username parameter
2026-01-10 12:55:02 +00:00
rcourtman
d5c93fd226 fix: add cluster endpoint IP override and Windows agent download support
1. Add IPOverride field to ClusterEndpoint struct
   - Allows users to specify a custom IP that takes precedence over auto-discovered IPs
   - Fixes #929 and #1066 where Pulse used internal cluster IPs instead of management IPs
   - Added EffectiveIP() method to cleanly handle the override logic

2. Update connection code to use EffectiveIP()
   - monitor.go: Use override when building endpoint URLs
   - temperature_proxy.go: Use override for proxy connections

3. Add bare Windows EXE files to GitHub releases
   - Fixes #1064 where LXC/barebone installs couldn't download Windows agents
   - Modified build-release.sh to copy EXEs alongside ZIPs
   - Added EXEs to checksum generation
2026-01-08 23:04:25 +00:00
rcourtman
568aac6bd0 fix: multiple triage fixes for stability and correctness
1. Use correct mutex (diagMu) in cleanupDiagnosticSnapshots to prevent
   "concurrent map iteration and map write" panics (Fixes #1063)

2. Use cluster name for storage instance comparison in UpdateStorageForInstance
   to prevent storage duplication in clustered Proxmox setups (Fixes #1062)

3. Fix KUBECONFIG unbound variable error in install.sh by using ${KUBECONFIG:-}
   default parameter expansion (Fixes #1065)
2026-01-08 22:54:33 +00:00
rcourtman
d7000fafb6 fix: Empty array expansion fails on macOS bash 3.2 with set -u
macOS ships with bash 3.2 (GPLv2) which has a bug where expanding
an empty array like ${array[@]} with set -u enabled throws an
"unbound variable" error, even when the array is initialized.

Use ${arr[@]+"${arr[@]}"} pattern to safely handle empty arrays.

Related to #1046
2026-01-06 10:52:44 +00:00
rcourtman
c6182b2ed3 feat: Add FreeBSD/OPNsense support for the Pulse agent
Added FreeBSD amd64 and arm64 build targets to the release process:
- Build host-agent and unified agent binaries for FreeBSD
- Package FreeBSD tarballs in releases
- Include FreeBSD binaries in universal tarball for download endpoint

Updated agent install script with FreeBSD support:
- Fixed architecture detection (FreeBSD reports 'amd64' not 'x86_64')
- Added FreeBSD rc.d service handler with proper daemon management
- Automatic service enabling via rc.conf

This enables users to run the Pulse agent on FreeBSD-based systems
like OPNsense, pfSense, and vanilla FreeBSD.

Fixes #1041
2026-01-05 18:18:06 +00:00
rcourtman
87ca7c92e0 docs: update example in dev-deploy-agent script 2026-01-02 21:08:42 +00:00
rcourtman
4cd3e53c3e test: add regression tests for missing frontend fields
Ensures that LinkedHostAgentId, CommandsEnabled, IsLegacy, and LinkedNodeId
are correctly propagated to the frontend. This prevents regressions of the
bugs fixed for #952 and #971.
2026-01-02 20:45:35 +00:00
rcourtman
724362504e fix: Add SELinux context restoration for Fedora/RHEL systems. Related to #996
On SELinux-enforcing systems (Fedora, RHEL, CentOS), binaries installed to
non-standard locations need proper security contexts for systemd to execute
them. Without this, systemd fails with 'Permission denied' even when the
binary has correct Unix permissions.

Changes:
- Add restore_selinux_contexts() function to both install scripts
- Uses restorecon (preferred) or chcon (fallback) to set bin_t context
- Only runs when SELinux is detected and enforcing
- Called after binary installation, before systemd service start
2025-12-31 23:12:53 +00:00
rcourtman
f855625f65 feat: Add full-width mode toggle for wider views on large monitors. Related to #974 2025-12-30 12:20:44 +00:00
rcourtman
56cb913a51 fix: Improve Kubernetes detection and add --kubeconfig flag to installer
- Search for kubeconfig in /home/*/.kube/config in addition to /root/.kube/config
- Add --kubeconfig installer flag to specify custom kubeconfig path
- Auto-detect and pass kubeconfig path to agent when Kubernetes is enabled
- Respect KUBECONFIG environment variable when kubectl is working

Related to discussion #968
2025-12-29 23:48:17 +00:00
rcourtman
6ac5e3ebfe chore: Clean up build scripts and remove unused Docker agent entry point 2025-12-29 23:37:16 +00:00
rcourtman
0a20eed07a fix: Normalize URL to prevent double-slash in agent download. Related to #956
Strip trailing slashes from PULSE_URL to prevent URLs like
http://host:7655//download/pulse-agent which incorrectly match
the frontend route instead of the download endpoint.
2025-12-29 14:57:28 +00:00
rcourtman
2bf8e044df feat: Add Docker container update capability
- Add container update command handling to unified agent
- Agent can now receive update_container commands from Pulse server
- Pulls latest image, stops container, creates backup, starts new container
- Automatic rollback on failure
- Backup container cleaned up after 5 minutes
- Added comprehensive test coverage for container update logic
2025-12-29 09:00:40 +00:00
rcourtman
e0b6c12736 fix(install): clear all Proxmox state files on reinstall. Related to #925 2025-12-27 10:44:35 +00:00
rcourtman
8c440b6f54 feat: notify server during agent uninstallation
- Add /api/agents/host/uninstall endpoint for agent self-unregistration
- Update install.sh to notify server during --uninstall (reads agent ID from disk)
- Update install.ps1 with same logic for Windows
- Update frontend uninstall command to include URL/token flags

This ensures that when an agent is uninstalled, the host record is
immediately removed from Pulse and any linked PVE nodes have their
+Agent badge cleared.
2025-12-26 22:38:46 +00:00
rcourtman
a5d92d5359 fix: Add --disk-exclude support to install script
Users can now pass disk exclusion patterns during agent installation:

  curl ... | bash -s -- --disk-exclude '/mnt/*' --url ... --token ...

The flag is repeatable for multiple exclusion patterns.

Related to #896
2025-12-26 12:11:18 +00:00
rcourtman
0eb512f90d feat: Add SysV init support for legacy systems. Related to #894
Adds support for systems that use SysV init (like Asustor NAS) that don't have
systemd, OpenRC, or launchd. The installer now:

- Detects /etc/init.d as a fallback when no other init system is found
- Creates an LSB-compliant init script with start/stop/restart/status
- Uses update-rc.d (Debian) or chkconfig (RHEL) to enable on boot
- Falls back to manual rc.d symlink creation if neither tool is available
- Properly cleans up on uninstall
2025-12-24 19:40:23 +00:00
rcourtman
2420c2affb feat: Commands disabled by default, require --enable-commands to opt-in
BREAKING CHANGE: AI command execution on agents is now disabled by default.
Users who want AI auto-fix must explicitly enable it with --enable-commands
flag or PULSE_ENABLE_COMMANDS=true environment variable.

Changes:
- Add --enable-commands flag (opt-in for command execution)
- Commands disabled by default for security (defense-in-depth)
- --disable-commands is now deprecated (logs warning, no longer needed)
- PULSE_DISABLE_COMMANDS deprecated in favor of PULSE_ENABLE_COMMANDS
- Update installer script to use --enable-commands
- Backwards compatibility: PULSE_DISABLE_COMMANDS=false still enables commands

This addresses community feedback about secure defaults for arbitrary
command execution on production infrastructure.

Related to #889
2025-12-24 17:36:44 +00:00
rcourtman
73a92813f5 feat: add --disable-commands flag to installer script. Related to #889 2025-12-24 17:09:48 +00:00
rcourtman
3c3f560c4b Fix login re-auth with stale sessions and hot-dev encryption safety
- Login.tsx: Use apiClient.fetch with skipAuth to avoid auth loops
- router.go: Skip CSRF validation for /api/login endpoint
- hot-dev.sh: Detect encrypted files before generating new key to prevent data loss
2025-12-20 13:45:11 +00:00
rcourtman
7f05d87809 fix: add missing HandleLicenseFeatures method and related changes
- Add HandleLicenseFeatures handler that was missing from license_handlers.go
- Add /api/license/features route to router
- Update AI service and metadata provider
- Update frontend license API and components
- Fix CI build failure caused by tests referencing unimplemented method
2025-12-19 22:59:52 +00:00
rcourtman
13af682ce1 fix(config): add PULSE_AGENT_CONNECT_URL and improve Docker detection
- Add AgentConnectURL config option to override public URL for agents
- Improve install.sh to diagnose docker detection failures
- Update router to prioritize AgentConnectURL for agent install commands
2025-12-19 16:43:14 +00:00
rcourtman
65829983b5 v5: gate legacy sensor-proxy and prune dev docs 2025-12-18 21:51:25 +00:00
rcourtman
ab480ca489 fix: Prevent orphaned encrypted data when encryption key is deleted
- crypto.go: Add runtime validation to Encrypt() that verifies the key file
  still exists on disk before encrypting. If the key was deleted while Pulse
  is running, encryption now fails with a clear error instead of creating
  orphaned data that can never be decrypted.

- hot-dev.sh: Auto-generate encryption key for production data directory
  (/etc/pulse) when HOT_DEV_USE_PROD_DATA=true and key is missing. This
  prevents startup failures and ensures encrypted data can be created.

- Added test TestEncryptRefusesAfterKeyDeleted to verify the protection works.
2025-12-17 17:00:53 +00:00